Hi I have a question on the use of DataNormalization. I've done the BootCamps and run through the docs but am still fuzzy on whether we need them to account for stock splits.
The literature says that OnData automatically adjusts for stock splits but what does that just apply on prices or also holdings i.e. number of shares as the $ value of our holdings should remain the same after the split.
If OnData adjusts for both prices and holdings why would we need DataNorm then? Unless it adjusts for prices but not holdings?
Clarifications appreciated.
Thanks and regards,
Clarence
Derek Melchin
Hi Clarence,
When using raw data normalization, prices are fed into the algorithm as they would have be known in real-time. When a split occurs, the quantity of holdings in the portfolio is automatically adjusted. See the attached backtest for reference.
In contrast, using the adjusted data normalization (default), the prices fed to OnData are back-adjusted. That is, they are not the prices that would have been seen in reality. Refer to our documentation for more information.
Best,
Derek Melchin
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.
Clarence Andre
Many thanks Derek. In other words if I understand you correctly, "Raw Data Normalization" doesn't achieve anything going forward as "prices fed to On-Data are back-adjusted". I was thinking from a perspective of modeling market capitalization we had to adjust two things in a stock split - prices and shares outstanding. Prices are adjusted but without DataNormalization, would number of shares outstanding also adjust automatically? Perhaps not a concern in QuantConnect as we're only tracking prices? Otherwise why even bother with DataNormalization in the first place?
Jared Broad
Suggest re-reading Derek's post closer/slower =) I think you're misunderstanding the actions we take for the different modes. Raw Price mode deposits dividends and adjusts the quantity of stock. i.e. acts as per the reality of the markets.
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.
Clarence Andre
Hi Jared, I did. My interest in the topic was actually first stimulated by the post you had written that got me thinking in the first place. I was thinking that OnData automatically adjusts back prices but not holdings so if we want to adjust for both, we need to use DataNormalization. That was my understanding based on what you had written. The real question is whether we need to use DataNormalization in our algorithms each time in anticipation that stocks may get split? I've had similar discussions with people in the Algo class am doing plus the instructor but nobody seems to have a definitive view. Your clarifications are much appreciated. Thanks again, Clarence.
Jared Broad
You cannot switch normalization on and off. It is applied over the entire backtest or not at all. Data Normalization is not applied in live-mode - it's impossible. You can only use it in backtesting.
"adjust for both, we need to use DataNormalization" - raw factors in the historical dividends and splits just as accurately. Normalization includes both these factors into the price.
I'd suggest you think about it in terms of the "algorithm", not OnData. The algorithm is either running adjusted or raw. It has nothing to do with OnData.
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.
Clarence Andre
Many thanks Jared. The illustration you provided is extremely helpful. Get it now. DataNormalization applies to just the backtested period and not what happens after.
Jared Broad
No worries! Please pay it forward =)
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.
Ricardo Cortez
As a follow up, if we are running the algo in live mode, how can we prenvent or take into account future splits?, would stop orders or buy/sell signals be automatically triggered?
Thanks!
Derek Melchin
Hi Ricardo,
When splits occur, stop orders are automatically adjusted. See the attached backtest for reference.
If there are any lookback windows or indicators that are used to compute buy/sell signals, these will need to be reset and warmed-up again to accommodate for the split.
Best,
Derek Melchin
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.
Maksat Haytmyradov
Hi QC experts,
Can you please enlighten me how option contracts are handled when there is stock split? What modification I need to make so that option holding price updated with splits?
Thanks a lot,
Maksat
Louis Szeto
Hi Maksat
We're sorry that LEAN hasn't support options auto-adjustment during split events yet. Right now, options will be liquidated when encountering split events automatically.
Best
Louis
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.
Maksat Haytmyradov
Hi Louis,
Thank you for explanation. This helps.
Unfortunately, my algorithm heavily relies on option trades and my PL metrics are totally screwed when I trust lean to automatically liquidate contracts. Therefore, I would like to close option contracts day before split occurs, From documentation I found it is possible to access split equities with data.Dividents.ContainsKey["AAPL"], but I assume this container is populated after split has already happened. Can you please help me understand if it is possible to identify stocks before their split date?
Thanks a lot,
Maksat
Louis Szeto
Hi Maksat
Yes, the Split and Dividends information was conferred after it happened. Yet, we can fetch upcoming split events by a conditional statement
Then we'll still have one trade day for our strategies. Please check the attached backtest for your reference.
Best
Louis
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.
Maksat Haytmyradov
Hi Louis,
Awesome! this is all I need.
Best,
Maksat
Clarence Andre
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!