Hello quantconnect community,
I have a problem that i can't figure out, maybe i missing something because it's suppose to be simple task. I'm trying to SetDataNormalizationMode of QQQ to raw. Buy when i set the mode to Raw/Adjusted and Logs the price i am getting that exactly same value. what am i doing wrong? thanks in advance
# region imports
from AlgorithmImports import *
# endregion
class CryingVioletWolf(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2023, 9, 23)
self.SetCash(100000)
qqq = self.AddEquity("QQQ", Resolution.Hour)
qqq.SetDataNormalizationMode(DataNormalizationMode.Raw);
self.symbol = "QQQ"
def OnData(self, data):
if data.ContainsKey(self.symbol) and data[self.symbol] is not None:
self.Log(f"Price_{data[self.symbol].Close}")
Mia Alissi
Hello Eli,
The
SetDataNormalizationMode
method is used to define how historical data is adjusted for corporate actions. By default, LEAN adjusts Equity data for splits and dividends to produce a smooth price curve. When you set the DataNormalizationMode to Raw, it means no modifications are made to the asset price at all. For Equities, dividends are paid in cash and splits are applied directly to your portfolio quantity.However, it's important to note that the Raw price today is identical to the current market price. This means that if there have been no corporate actions (like splits or dividends) recently, the Raw and Adjusted prices will be the same. This could be why you're seeing the same values when you log the price.
Here is how you can set the DataNormalizationMode to Raw:
And here is how you can log the price:
If you're still seeing the same values for Raw and Adjusted prices, it could be because there have been no recent corporate actions affecting the price of QQQ.
Sources:
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.
Eli Katz
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!