If `ExtendedMarketHours` is set to True for a security and the algorithm places a trade during extended market hours, is the order filled at the closing price during the extended market hours or is the order converted to `MarketOnOpenOrder` to fill at the closing price after the market opens?
When I place a trade during extended market hours, it seems like the latter. If this is the case without configurable options, then trading during extended markt hours would not be supported right?
Jared Broad
US Equity markets don't support market orders after market close; to execute extended market hours orders you need to use limit orders. This is due to limited liquidity after market close.
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.
Stinus Hojensbo
So you want be able to use SetHoldings during extended market hours since it uses market orders?Â
Shile Wen
Hi Stinus,You are correct in that SetHoldings would not trade in Extended Market Hours (they would get converted to On Market Open orders) because only Limit Orders can be placed immediately during this time, however, it is possible to emulate SetHoldings with Limit Orders using the following:
quantity = self.CalculateOrderQuantity(symbol, target) self.LimitOrder(symbol, quantity, price)
Best,
Shile WenÂ
Stinus Hojensbo
Got it, thanks Shile. For others reading this thread, self.Liquidate will also create an On Market Open. Â
Jeff.hernandez
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!