Skip to content

Commit

Permalink
[Binance] simplify position parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Nov 28, 2024
1 parent eb46410 commit 82a7c33
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions Trading/Exchange/binance/binance_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,6 @@ def fix_trades(self, raw, **kwargs):
def parse_position(self, fixed, force_empty=False, **kwargs):
try:
parsed = super().parse_position(fixed, force_empty=force_empty, **kwargs)
parsed[trading_enums.ExchangeConstantsPositionColumns.MARGIN_TYPE.value] = \
trading_enums.MarginType(
fixed.get(ccxt_enums.ExchangePositionCCXTColumns.MARGIN_MODE.value)
)
# use one way by default.
if parsed[trading_enums.ExchangeConstantsPositionColumns.POSITION_MODE.value] is None:
parsed[trading_enums.ExchangeConstantsPositionColumns.POSITION_MODE.value] = (
trading_enums.PositionMode.HEDGE if fixed.get(ccxt_enums.ExchangePositionCCXTColumns.HEDGED.value,
True)
else trading_enums.PositionMode.ONE_WAY
)
return parsed
except decimal.InvalidOperation:
# on binance, positions might be invalid (ex: LUNAUSD_PERP as None contact size)
return None
Expand Down

0 comments on commit 82a7c33

Please sign in to comment.