Hi All,
I have an algo that gets the open prices for my selected universe. It does this using a scheduled event n minutes after the market opens. Now if I set n to 0, in the backtest I'm warned that it is filling using stale data, so I have to set it to 1 minute.
Is this same behavior true in live trading? If my universe is set to minute resolution, does that mean the earliest I can get open prices is one minute after the market opens?
I'm looking for the quickest way to get market prices without having to resort to ticks becase that would be overhead I don't need at all.
Thanks for any help!
Xin Wei
Hi Kctrader,
A quick workaround would be placing orders before the market opens. At QuantConnect, this will trigger a Market On Open order, which trades with the market open price once the market opens at 9:30 am. The strategy can use a self.TimeRules.At to implement this, for instance:
self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.At(9, 15), self.BeforeMarketOpen)
I've attached a backtest so you can check that the orders are now filled with market open price.
Alternatively, as you mentioned, you can use tick data to trade at the first tick.
I hope this helps!
Cole S
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!