Hi all,
I have managed to obtain the previous days closing price via:
self.history_close = self.History(["SPY"], 1, Resolution.Daily)
self.previous_day_close = self.history_close.loc["SPY"]['close']
And I would like to compare this to the most current last price, or to the last 1 minute bar closing price (I am subscribed to minute resolution). Is this even possible, how does one obtain the current last price?
Any help would be greatly appreciated.
Christopher Phillips
Here is the following backtest, where I have tried to obtain the values and do a basic mathematical operation on them. Unfortunately it looks as though this is not working, as the backtest does not return any results at all.
Could someone point out where I am going wrong please?
Christopher Phillips
I tried outputting the contents of the numpy array: self.change_from_close to a csv, but it was unsuccessful. Is there a way to see the contents of a numpy array from within the backtest? Normally I would just use Jupyter and print the output.
Christopher Phillips
Louis Szeto You seem pretty knowledgeable about the price aspect of equities. Do you have any idea what I am doing wrong?
Louis Szeto
Hi Christopher
I wish the following could help you. A few points to mentions:
A bit of my personal suggestion, we would not use absolute value change in price usually as it is not stationary, try to use percentage change or log price change to eliminate the compound effect ;)
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.
Christopher Phillips
Wow, thanks so much for your help Louis Szeto ! I really appreciate your input, as the learning curve with QC is quite steep, even for someone experienced with Python.
Christopher Phillips
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!