Back

Accessing Pre Market Data

Hi, 

I have been trying to retreive the historical price data for the current day but haven't seen any documentation on how to do it. It sounds like the straightforward way to do this is by saving the data either in a Conssolidator or inside the OnData method; however when initializing my algo the following settings

self.UniverseSettings.Resolution = Resolution.Minute
self.UniverseSettings.ExtendedMarketHours = True

the OnData method gets traveresed once at 5 am est .... and then not again until 9 am; skipping the time in between. Moreover, I've tried calling the History class at these time to retreive the price history for yesterday's after hours + today's pre-market up to (4 pm yesterday to 9:00 am = 15 hours = 900 minutes)

history = algorithm.History(security.Symbol, TimeSpan.FromMinutes(900), Resolution.Minute)

However, I'm only able to retreive the current price at 5:00 am and 9:00 am repectively but not see what the stock traded at say 6:34 am until the next day when the history gets refreshed. 

 

 

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.


Hey Carlos,

One way to access extended market hours data for equities is by assigning extendedMarketHours = True in the AddEquity method:

AddEquity(ticker, resolution = Resolution.Minute, market = Market.USA, fillDataForward = true, leverage = 0m, extendedMarketHours = false)

Take care to write out each field value in the method because named parameters are not supported.
So you will need to use:

AddEquity(ticker, Resolution, Market.USA, True, 1, True)

Best
Rahul

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