Hello everyone,
I am a new comer and have a particular question regarding the data. I just set up the Lean on my workstation and ran the test locally. I found there are differences between the running test results and the data files provided by LEAN. For example, the SPY daily data is located at Lean\Data\equity\usa\daily, and I found in the file for 10/07/2013, the open, high, low and close are 167.41, 168.45, 167.25 and 167.45 respectively. On the other hand, when using "tradeBarHistory = History<TradeBar>("SPY", TimeSpan.FromDays(1));" in the test, I got 152.99, 153.94, 152.84 and 153.03. I am pretty sure the data were loaded from the data file to the test env. I am confused why the data are changed? Anyone can help? Thank you!
Alex
Alexandre Catarino
By default equity data in QuantConnect is Split and Dividend adjusted backwards in time to give smooth continuous prices. This allows easy use for indicators. Some algorithms need raw or partially adjusted price data. You can control this with the SetDataNormalizationMode() method. The DataNormalizationMode enum has the values Adjusted (default), Raw, SplitAdjusted, and TotalReturn. When data is set to Raw mode the dividends are paid as cash into your algorithm and the splits are directly applied to your holding quantity (link).
On 10/07/2013, the factor used to convert raw data (in the files) to adjusted data is 0.9138664 (see SPY factor file). When you multiple the prices 167.41, 168.45, 167.25 and 167.45 by it, you will get 152.99, 153.94, 152.84 and 153.03 respectively.
Alex Liu
Got it. Thanks a lot, Alex!
Alex Liu
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!