Hello, I just wanted to share what I've noticed with my crypto algo and wondering if anybody else had the same experience than me. After may 2024, all my trades are being executed at stale price with the default syntax of the AddCrypto method:
self.symbol = self.AddCrypto("BTCEUR", resolution= Resolution.Daily).Symbol
I have in my algo some control to verify that the symbol bar is available before doing any trade.
if data.Bars.ContainsKey(self.symbol):
After specifying the market to use (other than Coinbase which seems to be the default one) for the addCrypto method, the issue seems resolve :
self.symbol = self.AddCrypto("BTCEUR", resolution= Resolution.Daily, market=Market.KRAKEN).Symbol
Is there an issue with the data provider ?
If I wanted to trade live the algo, would the trades be impacted with quantconnect being the dataprovider for the algo or is it only a backtesting issue ?
Mia Alissi
Based on the information gathered, here are some insights and steps to address Narloc's concerns:
Default Market for
AddCrypto
: TheAddCrypto
method defaults to a specific market if none is specified. If the default market (e.g., Coinbase) has issues, specifying a different market like Kraken can resolve stale price issues. This is evident from the API documentation, which states that themarket
parameter can be specified to choose a different data source.Impact on Live Trading: QuantConnect's data provider uses live data streams for execution. Any discrepancies in backtesting data should not impact live trading as long as the data source is reliable. The documentation confirms that live trading algorithms run on co-located servers, reducing latency and ensuring real-time data accuracy.
Data Provider Reliability: Ensure that the chosen market for live trading is stable and has a good track record of data accuracy to avoid stale prices. Switching to a reliable market like Kraken, as Narloc did, can help mitigate these issues.
Historical vs. Live Data: QuantConnect provides extensive historical data, which can be used to verify the accuracy of backtesting results against live trading outcomes. The documentation highlights that historical data is available for all resolutions, ensuring comprehensive backtesting capabilities.
Latency Considerations: While QuantConnect is not designed for high-frequency trading, it offers low latency for live trading, which should minimize the impact of stale data. The documentation mentions latencies of 5-40 milliseconds for US Equities, with similar expectations for crypto markets.
Brokerage Model and Market Specification: Always specify the brokerage model and market explicitly in the algorithm to ensure consistency between backtesting and live trading environments. This practice helps avoid issues related to default market settings.
Monitor and Adjust: Continuously monitor the algorithm's performance in live trading and adjust the data source or market if any discrepancies are observed. This proactive approach ensures the algorithm remains effective and accurate.
By following these steps, Narloc can ensure that their algorithm performs reliably in both backtesting and live trading environments.
Sources: Crypto - QuantConnect.com, US Equities - QuantConnect.com, Data Preparation - QuantConnect.com, Bitfinex - QuantConnect.com, Piotroski F-Score Investing
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.
Narloc
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!