I am trying to get the price for an equity at the start of the day to use during the day for a trading strategy.
In the Initialize section I have::
self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.At(9,30,1), Action(self.openPrice))
And then the function:
def openPrice(self):
self.googopen = float(self.Securities["GOOG"].Price)
I have a log running and the value I get at 9.31 is Zero.
If I run the script over two days I get the closing price of day one in day two.
I appreciate I am extremely new to this and it is a case of not understanding the structure of the data but have got stuck.
Thanks
Lucas
Hi TobyQ
Can you share your script?
I think the reason that you are getting the data with a day delay, is that you are accessing it with Resolution.Daily. This means that the day has to pass, to get the daily data. This is shown right here
TobyQ
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!