Hello everyone, I have been messing with the research environment, and I found some odd behavior that I don't think it's intended.
If I have a RollingWindow with daily resolution and convert if to a pandas DataFrame, the time values that were supposed to be “00:00:00” convert instead to “01:00:00”. When I have it on hourly resolution, the time goes from “13:00:00” to “13:01:00”
Does anyone have an idea why does this happen?
Here is some example code.
qb = QuantBook()
spy = qb.AddEquity('SPY')
history = qb.History(qb.Securities.Keys, 5, Resolution.Daily)
window = RollingWindow[TradeBar](5)
for idx, x in history.iterrows():
bar = TradeBar(idx[1], idx[0], x.open, x.high, x.low, x.close, x.volume)
window.Add(bar)
print(window[0].Time)
df = qb.PandasConverter.GetDataFrame[TradeBar](window)
print(df)
Alexandre Catarino
Hi Victor Gomez ,
The default period of a TradeBar object is one minute, and EndTime is defined by the Time + Period. The data frame is timestamped with the EndTime.
We can set the TradeBat period with:
Best regards,
Alex
Did you know you can own a part of QuantConnect and shape the future of quant finance? See more and invest in at wefunder.com/quantconnect
Victor Gomez
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!