Do Market On Open orders not fill in the backtester until the end of the trading day? I am testing around with them, and in my function that runs before 16 min before the close, self.Portfolio['SPY'].Quantity is zero, even though in the Trades tab I can see that my Market On Open against 'SPY' order got filled that day. However, I am logging order update messages, and all of my fill messages corresponding to my Market On Open order are logged with a timestamp after market close (which I guess matches up with me not seeing any quantity in my SPY position).
KILLC
In case anyone else has this issue, I want to post the response I got from support which fixed the issue. Thank you to Jing Wu ! The crux of the issue was that I was subscribing to daily data, whereas I should have been subscribing to data on a more granular frequency.
"In order to fire the intraday event like "x minutes after the market open" or "every x minutes", you should request the intraday data when you add the asset, otherwise there is no price data to fill the order intraday.
self.AddEquity(instrument, Resolution.Minute)"
KILLC
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!