Hello,
I am quite new to using QuantConnect and have recently deployed my first live algo to Binance Future USD-M exchange, when my order is triggered, I got the following error.
2025-03-04 04:53:05 : New Order Event: Time: 03/04/2025 04:53:02 OrderID: 1 EventID: 1 Symbol: BTCUSDT Status: Invalid Quantity: -0.13521 Message: Brokerage failed to place orders: [1]
2025-03-04 04:53:05 : ⚠️ Order not filled: Status = 7, Reason:
2025-03-04 04:53:05 : Warning: Due to brokerage limitations, orders will be rounded to the nearest lot size of 0.00001
2025-03-04 04:53:05 : Brokerage Warning: Symbol is not supported BTCUSDT
2025-03-04 04:53:05 : Brokerage failed to place orders: [1]
It seems to be an issue with size? I thought USD-M still put in order size in BTC terms, so -0.13521 is not an amount that is too small. Anyone has experience trading live in Binance USD-M exchange?
Mia Alissi
Based on the analysis of the code snippet, make sure to address the following within the context of your algorithm to resolve the order issue:
Ensure
self
is Defined: The error states thatself
is not defined. This typically indicates that the code should be within a class method (e.g.,initialize
,on_data
) in your algorithm, whereself
refers to an instance of the class such asQCAlgorithm
.Define
order_quantity
: Make sure thatorder_quantity
is properly defined and assigned a value in the context where you plan to use it.Here's a modified code snippet that follows PEP 8 guidelines, assuming it's part of a method in your QCAlgorithm subclass:
Ensure this code is part of your main algorithm class (
QCAlgorithm
subclass), and adjustorder_quantity
as needed. This will round the order quantity to the nearestlot_size
and place an order if the quantity meets or exceeds the lot size.Sources: Order Errors - QuantConnect.com, Binance - QuantConnect.com, Immediate Execution Model Works With Binance Fee Model, Bybit Crypto Futures Regression Algorithm
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.
Daniel Zuo
Thank you. I thought the rounding to lot size is automatic.
Daniel Zuo
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!