In my initialize function, I have this
self.UniverseSettings.Resolution = Resolution.Minute
self.Schedule.On(self.DateRules.EveryDay(),
self.TimeRules.At(10, 50),
Action(self.my_trade))
And inside the my_trade function I have this:
h1 = self.History(stock_list, 31, Resolution.Daily)
h2 = self.History(stock_list, 5, Resolution.Minute)
self.Debug(h1)
self.Debug(h2)
Which returns this: (For H2)
Bu i would obviously expect h2 to return the prices for the past 5 minutes starting a 10:50 AM,
What Am I doing wrong ?
Emilio Freire
Hi Stephane,
Is it giving you that for all days or just for some? 2006-12-29 was a Friday so if what you're showing above is the logs from the following Saturday or Sunday that could be the reason? I think DateRules.EveryDay() runs every day, so trying with DateRules.EveryDay("SPY") to run it only every trading day.
Just an idea!
Emilio
Alexandre Catarino
The StartDate of the algorithm in question was set to Jan 1st, 2007. Since the market is closed, the History request returned data from the last trading day (Dec 29th, 2006). Stting the StartDate to a trading date, e.g.: Jan 2nd, 2007 fixes the issue.
Stephane b
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!