I'm testing a buy & hold strategy on the SPY as a total return symbol, but I'm having trouble coding this properly. Would you mind taking a look at my project for me?
The probable operative code follows, which is my only reference to "DataNormalizationMode.TotalReturn".
AddSecurity(SecurityType.Equity, symbol, Resolution.Minute);
Securities[symbol].SetDataNormalizationMode(DataNormalizationMode.TotalReturn);
When I run the buy & hold SPY test from Dec 28, 2009 through July 28, 2015 I generate less than the SPX Benchmark does on QC for the same period, and my ending portfolio value approximates that for the SPY on Dividend Channel (DC) without dividend reinvestment. The QC Benchmark for SPX generates $211,500 over this period which matches that on DC.
So I anticipate I am not buying the SPY as a total return symbol in my code. Can you show me how to do this? I suspect I am missing either an important reference or concept....
Thank you very much!
Michael Handschuh
John Jay Buchtel
Michael Handschuh
John Jay Buchtel
Michael Handschuh
Jared Broad
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.
John Jay Buchtel
Michael Handschuh
John Jay Buchtel
Michael Handschuh
//class variable decimal sumOfDividends = 0m; string Symbol = "SPY"; // initialize var priceIndicator = Identity(Symbol); // modify priceIndicator with the dividends var totalReturnPrice = new FunctionalIndicator(Symbol + "_TotalReturn",
input => input + sumOfDividends,
ind => true);
// OnData(Dividends data)
sumOfDividends += data[Symbol].Distribution;
Try this out and let me know how you make out, if you get stuck, please post an algorithm and I can take a peak.
John Jay Buchtel
John Jay Buchtel
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!