Fast trading with Neural Networks

Hello EveryBody,

I am training IAs with Tensorflow to determine optimal trading strategies by seconds slices but there are some dark points that I don't understand in the API.

When I place an order with SetHoldings in OnData Event : At which time of the Algorithm is the Trade filled in BackTest with DataSlices ? Is it filled right away or at the end of the OnData Method and before the next OnData? Is it :

OnData Begin(data slice) ===> order place ===> OnData End ===> order filled ===> On data(next data slice) ?


OnData Begin(data slice) ===> order place ===> order filled ===> OnData End ===> On Data(next data slice) ?


OnData Begin(data slice) ===> order place (independently of which slice) ===> OnData End ===> OnData(next data slice)

So in the last scenario, the order is filled indepedently of which Data Slice I'm In, so the faster my strategy construction is, the faster I can place an order. In that case, if I determine a strategy for this second to the next and the strategy calculation is longer than 1 second (if Data Slices are 1 second), the order is pointless...

Thanks It would help a lot

Update Backtest


such things you could test with a simple log output. just use the

OnOrderEvent (see documentation)

if you want to test when it is executed.

also search the community on interactive brokers experience. i think an marketorder from sending to executing takes 2 seconds minimum.


Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed