Hi,
I have the following code for continuous WTI futures access:
self.AddFuture(Futures.Energies.CrudeOilWTI, extendedMarketHours=True)
I checked the price back in 2007 and 2008. I found up to $500 or $600 prices. So obviously the price of the continuous contract has been adjusted. But the documentation says “add_future” call has both “data_mapping_mode” and “data_normalization_mode” set to None by default, which should technically be “no adjustment" perhaps? But clearly it is adjusted.
So I'm wondering by default what does it do in terms of adjustment, like how the date is chosen and which method is used? I'm trying to reproduce and the closest setting is BACKWARDS_RATIO + OPEN_INTEREST, but even these settings don't match the price exactly.
Thanks!
Mia Alissi
Hi Shiming,
The
AddFuture
method indeed hasdata_mapping_mode
anddata_normalization_mode
set to None by default. However, if you use a data normalization mode that's not in the list, LEAN automatically converts it toDataNormalizationMode.BackwardsRatio
source.The
DataNormalizationMode.BackwardsRatio
eliminates price jumps between two consecutive contracts by multiplying the prices by their ratio. The last contract has the true price source.The data mapping mode defines when contract rollovers occur. The
DataMappingMode
enumeration has the following members:LAST_TRADING_DAY
,FIRST_DAY_MONTH
,OPEN_INTEREST
,OPEN_INTEREST_ANNUAL
source.If you want to specify the data normalization mode and data mapping mode, you can do so as follows:
source
I hope this helps! Let me know if you have any other questions.
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.
Shiming He
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!