Skip to content

Commit

Permalink
[Bybit] update enums and add single contract value
Browse files Browse the repository at this point in the history
  • Loading branch information
techfreaque committed Feb 16, 2023
1 parent 52a4364 commit 8c7a03a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Trading/Exchange/bybit/bybit_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def parse_position(self, fixed, **kwargs):
# if side == enums.PositionSide.LONG.value else enums.PositionSide.SHORT

unrealized_pnl = self.safe_decimal(fixed,
ccxt_enums.ExchangePositionCCXTColumns.UNREALISED_PNL.value,
ccxt_enums.ExchangePositionCCXTColumns.UNREALIZED_PNL.value,
constants.ZERO)
liquidation_price = self.safe_decimal(fixed,
ccxt_enums.ExchangePositionCCXTColumns.LIQUIDATION_PRICE.value,
Expand All @@ -274,12 +274,16 @@ def parse_position(self, fixed, **kwargs):
),
trading_enums.ExchangeConstantsPositionColumns.SIZE.value:
size if original_side == trading_enums.PositionSide.LONG.value else -size,
trading_enums.ExchangeConstantsPositionColumns.SINGLE_CONTRACT_VALUE.value:
self.safe_decimal(
fixed, ccxt_enums.ExchangePositionCCXTColumns.CONTRACT_SIZE.value, constants.ONE
),
trading_enums.ExchangeConstantsPositionColumns.INITIAL_MARGIN.value:
self.safe_decimal(
fixed, ccxt_enums.ExchangePositionCCXTColumns.INITIAL_MARGIN.value,
constants.ZERO
),
trading_enums.ExchangeConstantsPositionColumns.NOTIONAL.value:
trading_enums.ExchangeConstantsPositionColumns.VALUE.value:
self.safe_decimal(
fixed, ccxt_enums.ExchangePositionCCXTColumns.NOTIONAL.value, constants.ZERO
),
Expand All @@ -288,7 +292,7 @@ def parse_position(self, fixed, **kwargs):
fixed, ccxt_enums.ExchangePositionCCXTColumns.LEVERAGE.value, constants.ONE
),
trading_enums.ExchangeConstantsPositionColumns.UNREALIZED_PNL.value: unrealized_pnl,
trading_enums.ExchangeConstantsPositionColumns.REALISED_PNL.value:
trading_enums.ExchangeConstantsPositionColumns.REALIZED_PNL.value:
self.safe_decimal(
fixed, self.BYBIT_REALIZED_PNL, constants.ZERO
),
Expand Down

0 comments on commit 8c7a03a

Please sign in to comment.