hummingbot: Binance perpetual: Stuck cancelling an order
Describe the bug
Opening ticket for tracking:
When running a perpetual market making strategy using binance perpetual for long period (days), there are instances that the bot gets stuck in a repeated loop, attempting to cancel an order. When you check the exchange, there are no active closing position. In this screenshot, both orders x-3QreWesy-SDEUT75601643346706004336 and x-3QreWesy-BDEUT75601643346706004126 fails to cancel. In the logs, these affected orders didn’t receive any completion event for the cancellation.

Steps To Reproduce Here are the steps to reproduce the issue (see attachments in the section below):
- Create a perpetual market making strategy using binance_perpetual as connector
- Start the the strategy and leave the bot running for long period or few days.
- Regularly monitor the bot for any cancellation issue
Screenshots
Release version 0.46.0
Attachments
WARNING: Do NOT publish any exchange API keys or your wallet’s private key. Whoever has access to them may steal your assets!
Optional: your discord username:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 37 (18 by maintainers)
@raymondcarl @amitds1997 I found the error, the issue is in the connector. I will provide a solution for today
@cardosofede this impacts all strategy that uses binance_perpetual not just perpetual market making strategy. This is happening with other strategy such as hedge too. It should be an issue related to binance_perpetual connector only.
I am also trying to debug this issue on my end.
My observations:
self._sb_order_tracker.in_flight_cancelsbut not present inself._market_info.market.in_flight_orders(shown by @cardosofede in the comment above).active_ordersproperty depends uponmarket_pair_to_active_ordersand the logic for that is different b/wPerpetualMarketMakingOrderTrackerand the baseOrderTrackerIf
PerpetualMarketMakingOrderTracker.market_pair_to_active_ordershad the same logic, I can see how we would not face this issue because the order is still inin_flight_cancels. But this kind of leaves the actual question still open about why the state was not correctly updated after the order cancellation and it is still present inin_flight_cancelsI think that I found something! In Flight Orders from the connector:
Active orders from the OrderTracker:
Tomorrow I will continue with the research ! Hope that I can solve this soon.
@raymondcarl hey Raymond! thanks for the previous investigation, tomorrow I will fix this issue (hope so haha). Some things about your comments.
My guess is that as we are using the cached orders + inflight orders to cancel the order, it will try to cancel the same order at least for 30 seconds (the default value for the TTL cache).
Tomorrow I will debug it because this are all thoughts!
Is this one already assigned to you? @cardosofede