Suppose I have the prices of an action XXXX at the second for three years. I want to use the data to train my Deep Neural Network model for standard day trading purposes (i.e. High Frequency Trading). However, I have to label each second of the data file with "-1", "0", "1" for sale order, do nothing or a buy order. I don't want to label each row manually because it will take a year to do this task. How could I parse the data with python to label each row by "-1" if it is a good time to sell, "0" for doing nothing or "1" for a buy order? For a time X, we know precisely the past prices and the future prices, so it could be doable to label all of them I figure.

Be aware that for a standard trading, we have to take into account the transaction fees. In my case, I pay \$4.95 for a buy and \$4.95 for a sell. For instance, if I buy 100 shares at $1, then in order not to lose money, I must at least cover the loss related transaction costs. Hence, the selling price much be at least \$1 + (\$9.90/100) = \$1.099 ~ \$1.1

Another important aspect is that my market making strategy is order flow. So I don't want to trade on low price changes. In fact, I want the machine assists me to trade at the beginning. So I need the machine to trade as a trader normal would do on a normal day trading.

UPDATE

The mid-price at time $t$ is denoted by $$p_t = \frac{s_t^{a,1} +
s_t^{b,1}}{2}.$$

This mid-price can evolve in minimum increments of half a tick but is
almost always observed to move at increments of a tick over time
intervals of a millisecond or less. In our feature set, each limit
order book update is recorded as an observation. Each observation is
labelled bases on whether the mid-price will increase, decrease or
remain over a horizon $h$: $$Y_t = \Delta p^t_{t+h},$$ where $\Delta
p^t_{t+h}$ is the forecast the discrete mid-price changes from time
$t$ to $t+h$, given measurement of the predictors up to time $t$. The
forecasting horizon $h$ can be chosen to represent a fixed number of
events or can be a fixed time interval.

1 Answer
1

You haven't stated what the criteria are for assigning labels of -1, 0, or 1. Also, if you are trading on the second time scale, then the price change per bar will be quite low. If the price change is +0.01 for a bar, and the asset price is \$1 per share (\$100 per trade for 100 shares), then then your profit will be \$1 from that trade, which won't cover the \$4.95 commission. If you are trading 100 shares per second, where on Earth are you going to find a brokerage that will process your Sell trade alerts/signals for a given second and settle the trade in milliseconds, so that if the next bar (second) is a Buy, the proceeds will be available to make the purchase?

Overall, for very low price changes on short time scales (seconds, ticks) you have trade thousands of shares for each alert in order to be profitable. But trading so many shares on a short time scale can result in a lack of sufficient funds very quickly since sell and cover trades won't get filled as quickly as the unit of time scale you are on.

Next, if you are training a deep learning ANN with several hidden layers, which will require hundreds of iterations to determine whether to go long (Buy) or short for each second's bar, how are you going to be able to run your input through the ANNs architecture and trained connection weights to make the prediction before the next bar?

Overall, there are some trading issues which could be disastrous based on what you want to do, such that trade settlements will become clogged up and insufficient funds will occur for future trades (selling shares can take many seconds).

$\begingroup$I don't want to trade at very low price changes. I would like to trade with the machine as a normal trader would. My market making strategy is order flow, littlefishfx.com/forex-education/…. How with python could I tell which price would be sell, buy or do nothing (1, -1, 0)?$\endgroup$
– JeremieApr 14 '18 at 19:00