The price from on_data is completely different to the prices in reality. help! prices from on_data returns numbers close to 103500 in reality it was way higher during that day.
Im a noob by the way dont judge.
QUANTCONNECT COMMUNITY
The price from on_data is completely different to the prices in reality. help! prices from on_data returns numbers close to 103500 in reality it was way higher during that day.
Im a noob by the way dont judge.
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.
Mia Alissi
Here are the actionable bugs and misconfigurations in your code that can cause the prices seen in on_data to be different from reality or otherwise unrealistic:
Wrong Brokerage Model for Futures
self.set_brokerage_model(BrokerageName.BINANCE), which is for Binance Spot. For trading crypto futures (like BTCUSDT perpetual), you need to use:self.set_brokerage_model(BrokerageName.BINANCE_FUTURES, AccountType.MARGIN)No Real Contract: Using Root Symbol
self.add_crypto_future("BTCUSDT", ...), you are adding the future "root", not a specific expiring or perpetual contract.self._future) are using this root, which can result in empty, missing, or unrealistic prices.Market Parameter Mismatch
market=Market.BINANCEfor spot, but for futures you may need to specifyMarket.BINANCEor the enum for Binance USDT-margined futures). If the market name is wrong, you may get no data or wrong prices.Conflicting Cash Currencies
self.set_account_currency("USDT", 10000000)andself.set_cash("CASH", 10000000).History Request Issues
self.history(self._future,1,Resolution.DAILY)before you have a valid (and mapped) active future contract may return an old, irrelevant price or nothing at all, making your grid orders totally disconnected from reality.Order Quantity Ignored
self.calculate_order_quantity()but always submit a hardcoded order of1contract, ignoring the value returned from the quantity function.How to fix:
calculate_order_quantity()for your orders.These issues will make your on_data prices either zero, out-of-date, or simply irrelevant to actual Binance Futures trading. Fixing them should make prices line up with "reality".
Sources: Binance Crypto Price Data - QuantConnect.com, docs writing algorithms datasets quantconnect binance crypto future margin rate data, docs writing algorithms datasets coinapi binance crypto future price data, Bybit Crypto Futures Regression Algorithm, Bybit Crypto Future Price Data - QuantConnect.com
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.
James Gui
thanks for the reply. I dont understand the second point of no real contract however. How do i fix that can you be a bit more in depth?
James Gui
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!