Hello,
I've been working with a 5-minute consolidator in QuantConnect and have noticed some discrepancies between Live and Backtest runs. I'm new to QC and I'm not sure if I've set things up correctly. See attached backtest. Here are the issues I've encountered:
1. Backtest vs Live Data: The 5-minute prices from my Backtest runs do not match the prices from my Live runs. For instance, the price of the 5-minute bar ending at 15/05/2024 11:15:00 in the Live run does not match the price of the bar with the same end time in the Backtest run. This discrepancy is not isolated but occurs for most of the 5-minute prices. I've attached a spreadsheet for reference.
2. Live Data Accuracy: During the Live run, I noticed that the prices of the 5-minute bars do not match the prices of the corresponding 1-minute bars. For example, the price of the 5-minute bar ending at 15/05/2024 11:15:00 is not the same as the price of the 1-minute bar ending at the same time.
I would greatly appreciate any guidance or suggestions on how to address these issues. Thank you in advance for your help.
Excel spreadsheet:
Thank you
QT
Mia Alissi
Hello 'QuantTrader',
The discrepancies you're observing between Live and Backtest runs, as well as between different bar resolutions, can be attributed to a few factors:
Backtest vs Live Data: In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values [source].
Live Data Accuracy: The difference between the prices of the 5-minute bars and the corresponding 1-minute bars can be due to the way bars are constructed. A 5-minute bar is built from the ticks during that 5-minute period and its price represents some aggregate of the prices during that period (e.g., open, close, high, low), not necessarily the price at the end of the period.
Regarding your Python code, it seems to be a simple algorithm that plots the price of a given security, and there's no obvious reason why it would report different prices for the same asset at the same time [source].
If you continue to observe significant price discrepancies, I would recommend posting a detailed question on the QuantConnect forum with specific examples. The community there may be able to provide further insights.
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.
QuantTrader
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!