I have an algo that uses the following and is suddenly not working. Did something change with QC or LEAN?
def Initialize(self):
self.SetSecurityInitializer(self.customSecurityInitializer)
def customSecurityInitializer(self, security):
security.SetDataNormalizationMode(DataNormalizationMode.Raw)
for bar in self.GetLastKnownPrices(security.Symbol):
security.SetMarketPrice(bar)
This code has always worked just fine, but now I am getting runtime errors that certain equity assets are set to adjusted and I need to set to DataNormalizationMode.Raw
Runtime Error: ArgumentException : The underlying equity asset (SGMO) is set to Adjusted, please change this to DataNormalizationMode.Raw with the SetDataNormalization() method at QuantConnect.Algorithm.QCAlgorithm.AddOptionContract(Symbol symbol, Nullable`1 resolution, Boolean fillDataForward, Decimal leverage) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Algorithm/QCAlgorithm.cs:line 1822 at OptionsFilter self.AddOptionContract(contract in main.py: line 132
I tried running the algo over dates that I know I've backtested successfully before and still get this error. FYI, I am using universes if that makes a difference.
Varad Kabade
Hi Jon Bailey,
Please add the following in the Initialize method to resolve the issue:
Best,
Varad Kabade
Jon Bailey
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!