Enabling ExtendedMarketHours in Jupyter notebooks environment

Back

How to enable ExtendedMarketHours in a Jupyter notebooks environment? I am trying to do some research on pre-market and after-market price in the Jupyter notebook. I tried the following code lines but all historical data are in the range of 9:30am-4pm. Is it possible to change the QCAlgorithm default on extendedMarketHours in the Jupyter notebooks environment? 

qb = QuantBook()
qb.UniverseSettings.ExtendedMarketHours = True  
qb.extendedMarketHours = True  
stock= qb.AddEquity( 'AAPL' , extendedMarketHours = True)
history = qb.History(stock.Symbol, start_time, end_time, Resolution.Minute, extendedMarketHours = True)


 

Update Backtest







 
0

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.


Hi Jack,

Lean doesn't support named args at the moment, part of why this method call isn't what we want. We would have to instead use the AddEquity method call we'd usually see in the QCAlgorithm on our QuantBook object for enabling Extended Market Hours. I've shown this in notebook of the attached backtest.

Best,
Shile Wen

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed