You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bybit/bitget perpetual accounts report HEDGE regardless of the exchange; position-mode switch reports success it can't deliver #210
UnifiedConnectorService._create_and_initialize_trading_connector() forces HEDGE on every perpetual connector at init, while the connector has trading_pairs=[]:
What that does depends on the connector, and for most of them it's harmless. The base PerpetualDerivativePyBase._execute_set_position_modereads the exchange's mode first: if the account is already HEDGE it sets local HEDGE; if not, it logs "No trading pairs configured" and leaves local at the ONEWAY default. Either way local matches the exchange on binance, okx and gate_io — the call never switches anything, but nothing depends on it doing so.
The bug is in the connectors that override that path, and in the switch endpoint.
1. bybit and bitget report HEDGE regardless of the account
bybit overrides _execute_set_position_mode to loop over self.trading_pairs with no exchange read. With an empty list the loop succeeds vacuously and local becomes HEDGE. (supported_position_modes() also returns both modes vacuously on an empty list, so the guard passes.)
bitget reads the exchange first, but _fetch_account_position_mode returns None without a pair to query with, then loops over the empty list → local HEDGE.
On a one-way account, orders then carry hedge-mode position fields (bybit positionIdx 1/2, bitget tradeSide) and the exchange rejects them, far from the cause.
hummingbot already has the right init path, _initialize_position_mode() (read the exchange, adopt it), but it runs from start_network(), which the API never calls for CEX connectors (_start_connector_network starts the polling tasks itself).
2. The switch endpoint reports success it can't deliver
POST /trading/{account}/{connector}/position-mode calls connector.set_position_mode(), which fires _execute_set_position_mode in the background and returns immediately. So it returns success when:
no pair is registered (the switch no-ops, or on bybit/bitget flips only the local mode), or
the exchange rejects the switch (e.g. open positions, Binance -4068).
Not covered
bitmart supports HEDGE but can't read the account's mode; local stays ONEWAY. Same for bybit after the fix: an account in HEDGE must be switched explicitly through the endpoint.
changed the title [-]Init-time HEDGE default has never reached the exchange (set_position_mode no-ops with trading_pairs=[])[/-][+]bybit/bitget perpetual accounts report HEDGE regardless of the exchange; position-mode switch reports success it can't deliver[/+]on Sep 29, 2026
Activity
(fix) position mode: adopt exchange truth at init, register pair and …
A perpetual account's position mode is the exchange's, and a switch i…
[-]Init-time HEDGE default has never reached the exchange (set_position_mode no-ops with trading_pairs=[])[/-][+]bybit/bitget perpetual accounts report HEDGE regardless of the exchange; position-mode switch reports success it can't deliver[/+]