MCPcopy Create free account
hub / github.com/ccxt/ccxt / parse_long_short_ratio

Method parse_long_short_ratio

python/ccxt/async_support/bybit.py:9061–9081  ·  view source on GitHub ↗
(self, info: dict, market: Market = None)

Source from the content-addressed store, hash-verified

9059 return self.parse_long_short_ratio_history(data, market)
9060
9061 def parse_long_short_ratio(self, info: dict, market: Market = None) -> LongShortRatio:
9062 #
9063 # {
9064 # "symbol": "BTCUSDT",
9065 # "buyRatio": "0.5707",
9066 # "sellRatio": "0.4293",
9067 # "timestamp": "1729123200000"
9068 # }
9069 #
9070 marketId = self.safe_string(info, 'symbol')
9071 timestamp = self.safe_integer_omit_zero(info, 'timestamp')
9072 longString = self.safe_string(info, 'buyRatio')
9073 shortString = self.safe_string(info, 'sellRatio')
9074 return {
9075 'info': info,
9076 'symbol': self.safe_symbol(marketId, market, None, 'contract'),
9077 'timestamp': timestamp,
9078 'datetime': self.iso8601(timestamp),
9079 'timeframe': None,
9080 'longShortRatio': self.parse_to_numeric(Precise.string_div(longString, shortString)),
9081 }
9082
9083 async def fetch_positions_adl_rank(self, symbols: Strings = None, params={}) -> List[ADL]:
9084 """

Callers

nothing calls this directly

Calls 6

safe_stringMethod · 0.80
safe_symbolMethod · 0.80
parse_to_numericMethod · 0.80
string_divMethod · 0.80
iso8601Method · 0.45

Tested by

no test coverage detected