ccxt 4.2.84__py2.py3-none-any.whl → 4.2.85__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ace.py +5 -5
  3. ccxt/ascendex.py +8 -8
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/ace.py +5 -5
  6. ccxt/async_support/ascendex.py +8 -8
  7. ccxt/async_support/base/exchange.py +3 -27
  8. ccxt/async_support/bigone.py +12 -12
  9. ccxt/async_support/binance.py +20 -32
  10. ccxt/async_support/bingx.py +12 -9
  11. ccxt/async_support/bit2c.py +1 -1
  12. ccxt/async_support/bitbank.py +8 -8
  13. ccxt/async_support/bitbns.py +5 -5
  14. ccxt/async_support/bitfinex.py +1 -1
  15. ccxt/async_support/bitfinex2.py +1 -1
  16. ccxt/async_support/bitget.py +29 -24
  17. ccxt/async_support/bithumb.py +5 -5
  18. ccxt/async_support/bitmart.py +16 -16
  19. ccxt/async_support/bitopro.py +1 -1
  20. ccxt/async_support/bitrue.py +4 -4
  21. ccxt/async_support/bitso.py +5 -5
  22. ccxt/async_support/bitstamp.py +1 -1
  23. ccxt/async_support/bitteam.py +8 -8
  24. ccxt/async_support/bl3p.py +1 -1
  25. ccxt/async_support/btcturk.py +6 -6
  26. ccxt/async_support/bybit.py +30 -83
  27. ccxt/async_support/coincheck.py +4 -4
  28. ccxt/async_support/coinex.py +11 -11
  29. ccxt/async_support/coinlist.py +7 -7
  30. ccxt/async_support/coinmate.py +4 -4
  31. ccxt/async_support/coinmetro.py +3 -3
  32. ccxt/async_support/coinone.py +5 -5
  33. ccxt/async_support/coinspot.py +2 -2
  34. ccxt/async_support/cryptocom.py +17 -17
  35. ccxt/async_support/currencycom.py +1 -1
  36. ccxt/async_support/delta.py +0 -8
  37. ccxt/async_support/deribit.py +16 -80
  38. ccxt/async_support/digifinex.py +8 -8
  39. ccxt/async_support/exmo.py +8 -8
  40. ccxt/async_support/gate.py +0 -8
  41. ccxt/async_support/hitbtc.py +5 -4
  42. ccxt/async_support/hollaex.py +7 -7
  43. ccxt/async_support/htx.py +7 -7
  44. ccxt/async_support/huobijp.py +3 -3
  45. ccxt/async_support/idex.py +2 -2
  46. ccxt/async_support/independentreserve.py +2 -2
  47. ccxt/async_support/indodax.py +2 -2
  48. ccxt/async_support/kraken.py +8 -8
  49. ccxt/async_support/krakenfutures.py +6 -6
  50. ccxt/async_support/kucoin.py +4 -1
  51. ccxt/async_support/kucoinfutures.py +8 -8
  52. ccxt/async_support/kuna.py +16 -16
  53. ccxt/async_support/latoken.py +2 -2
  54. ccxt/async_support/lbank.py +10 -10
  55. ccxt/async_support/luno.py +4 -4
  56. ccxt/async_support/mercado.py +5 -5
  57. ccxt/async_support/mexc.py +6 -6
  58. ccxt/async_support/ndax.py +1 -1
  59. ccxt/async_support/novadax.py +9 -9
  60. ccxt/async_support/oceanex.py +7 -7
  61. ccxt/async_support/okcoin.py +13 -13
  62. ccxt/async_support/okx.py +23 -31
  63. ccxt/async_support/onetrading.py +4 -4
  64. ccxt/async_support/p2b.py +7 -7
  65. ccxt/async_support/phemex.py +12 -12
  66. ccxt/async_support/poloniexfutures.py +5 -5
  67. ccxt/async_support/probit.py +11 -11
  68. ccxt/async_support/timex.py +7 -7
  69. ccxt/async_support/tokocrypto.py +9 -9
  70. ccxt/async_support/wavesexchange.py +3 -3
  71. ccxt/async_support/whitebit.py +5 -5
  72. ccxt/async_support/woo.py +1 -1
  73. ccxt/async_support/zaif.py +1 -1
  74. ccxt/async_support/zonda.py +7 -7
  75. ccxt/base/exchange.py +66 -23
  76. ccxt/bigone.py +12 -12
  77. ccxt/binance.py +20 -32
  78. ccxt/bingx.py +12 -9
  79. ccxt/bit2c.py +1 -1
  80. ccxt/bitbank.py +8 -8
  81. ccxt/bitbns.py +5 -5
  82. ccxt/bitfinex.py +1 -1
  83. ccxt/bitfinex2.py +1 -1
  84. ccxt/bitget.py +29 -24
  85. ccxt/bithumb.py +5 -5
  86. ccxt/bitmart.py +16 -16
  87. ccxt/bitopro.py +1 -1
  88. ccxt/bitrue.py +4 -4
  89. ccxt/bitso.py +5 -5
  90. ccxt/bitstamp.py +1 -1
  91. ccxt/bitteam.py +8 -8
  92. ccxt/bl3p.py +1 -1
  93. ccxt/btcturk.py +6 -6
  94. ccxt/bybit.py +30 -83
  95. ccxt/coincheck.py +4 -4
  96. ccxt/coinex.py +11 -11
  97. ccxt/coinlist.py +7 -7
  98. ccxt/coinmate.py +4 -4
  99. ccxt/coinmetro.py +3 -3
  100. ccxt/coinone.py +5 -5
  101. ccxt/coinspot.py +2 -2
  102. ccxt/cryptocom.py +17 -17
  103. ccxt/currencycom.py +1 -1
  104. ccxt/delta.py +0 -8
  105. ccxt/deribit.py +16 -80
  106. ccxt/digifinex.py +8 -8
  107. ccxt/exmo.py +8 -8
  108. ccxt/gate.py +0 -8
  109. ccxt/hitbtc.py +5 -4
  110. ccxt/hollaex.py +7 -7
  111. ccxt/htx.py +7 -7
  112. ccxt/huobijp.py +3 -3
  113. ccxt/idex.py +2 -2
  114. ccxt/independentreserve.py +2 -2
  115. ccxt/indodax.py +2 -2
  116. ccxt/kraken.py +8 -8
  117. ccxt/krakenfutures.py +6 -6
  118. ccxt/kucoin.py +4 -1
  119. ccxt/kucoinfutures.py +8 -8
  120. ccxt/kuna.py +16 -16
  121. ccxt/latoken.py +2 -2
  122. ccxt/lbank.py +10 -10
  123. ccxt/luno.py +4 -4
  124. ccxt/mercado.py +5 -5
  125. ccxt/mexc.py +6 -6
  126. ccxt/ndax.py +1 -1
  127. ccxt/novadax.py +9 -9
  128. ccxt/oceanex.py +7 -7
  129. ccxt/okcoin.py +13 -13
  130. ccxt/okx.py +23 -31
  131. ccxt/onetrading.py +4 -4
  132. ccxt/p2b.py +7 -7
  133. ccxt/phemex.py +12 -12
  134. ccxt/poloniexfutures.py +5 -5
  135. ccxt/pro/__init__.py +1 -1
  136. ccxt/pro/binance.py +150 -112
  137. ccxt/pro/kucoin.py +6 -7
  138. ccxt/pro/okx.py +12 -1
  139. ccxt/probit.py +11 -11
  140. ccxt/timex.py +7 -7
  141. ccxt/tokocrypto.py +9 -9
  142. ccxt/wavesexchange.py +3 -3
  143. ccxt/whitebit.py +5 -5
  144. ccxt/woo.py +1 -1
  145. ccxt/zaif.py +1 -1
  146. ccxt/zonda.py +7 -7
  147. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/METADATA +4 -4
  148. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/RECORD +150 -150
  149. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/WHEEL +0 -0
  150. {ccxt-4.2.84.dist-info → ccxt-4.2.85.dist-info}/top_level.txt +0 -0
@@ -669,7 +669,7 @@ class bitteam(Exchange, ImplicitAPI):
669
669
  # }
670
670
  #
671
671
  result = self.safe_value(response, 'result', {})
672
- data = self.safe_value(result, 'data', [])
672
+ data = self.safe_list(result, 'data', [])
673
673
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
674
674
 
675
675
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -844,7 +844,7 @@ class bitteam(Exchange, ImplicitAPI):
844
844
  # }
845
845
  #
846
846
  result = self.safe_value(response, 'result', {})
847
- orders = self.safe_value(result, 'orders', [])
847
+ orders = self.safe_list(result, 'orders', [])
848
848
  return self.parse_orders(orders, market, since, limit)
849
849
 
850
850
  async def fetch_order(self, id: str, symbol: Str = None, params={}) -> Order:
@@ -901,7 +901,7 @@ class bitteam(Exchange, ImplicitAPI):
901
901
  # }
902
902
  # }
903
903
  #
904
- result = self.safe_value(response, 'result')
904
+ result = self.safe_dict(response, 'result')
905
905
  return self.parse_order(result, market)
906
906
 
907
907
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -1001,7 +1001,7 @@ class bitteam(Exchange, ImplicitAPI):
1001
1001
  # }
1002
1002
  # }
1003
1003
  #
1004
- order = self.safe_value(response, 'result', {})
1004
+ order = self.safe_dict(response, 'result', {})
1005
1005
  return self.parse_order(order, market)
1006
1006
 
1007
1007
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -1026,7 +1026,7 @@ class bitteam(Exchange, ImplicitAPI):
1026
1026
  # }
1027
1027
  # }
1028
1028
  #
1029
- result = self.safe_value(response, 'result', {})
1029
+ result = self.safe_dict(response, 'result', {})
1030
1030
  return self.parse_order(result)
1031
1031
 
1032
1032
  async def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -1475,7 +1475,7 @@ class bitteam(Exchange, ImplicitAPI):
1475
1475
  # }
1476
1476
  #
1477
1477
  result = self.safe_value(response, 'result', {})
1478
- pair = self.safe_value(result, 'pair', {})
1478
+ pair = self.safe_dict(result, 'pair', {})
1479
1479
  return self.parse_ticker(pair, market)
1480
1480
 
1481
1481
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
@@ -1796,7 +1796,7 @@ class bitteam(Exchange, ImplicitAPI):
1796
1796
  # }
1797
1797
  #
1798
1798
  result = self.safe_value(response, 'result', {})
1799
- trades = self.safe_value(result, 'trades', [])
1799
+ trades = self.safe_list(result, 'trades', [])
1800
1800
  return self.parse_trades(trades, market, since, limit)
1801
1801
 
1802
1802
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -2087,7 +2087,7 @@ class bitteam(Exchange, ImplicitAPI):
2087
2087
  # }
2088
2088
  #
2089
2089
  result = self.safe_value(response, 'result', {})
2090
- transactions = self.safe_value(result, 'transactions', [])
2090
+ transactions = self.safe_list(result, 'transactions', [])
2091
2091
  return self.parse_transactions(transactions, currency, since, limit)
2092
2092
 
2093
2093
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
@@ -172,7 +172,7 @@ class bl3p(Exchange, ImplicitAPI):
172
172
  'market': market['id'],
173
173
  }
174
174
  response = await self.publicGetMarketOrderbook(self.extend(request, params))
175
- orderbook = self.safe_value(response, 'data')
175
+ orderbook = self.safe_dict(response, 'data')
176
176
  return self.parse_order_book(orderbook, market['symbol'], None, 'bids', 'asks', 'price_int', 'amount_int')
177
177
 
178
178
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
@@ -410,7 +410,7 @@ class btcturk(Exchange, ImplicitAPI):
410
410
  """
411
411
  await self.load_markets()
412
412
  response = await self.publicGetTicker(params)
413
- tickers = self.safe_value(response, 'data')
413
+ tickers = self.safe_list(response, 'data')
414
414
  return self.parse_tickers(tickers, symbols)
415
415
 
416
416
  async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
@@ -522,7 +522,7 @@ class btcturk(Exchange, ImplicitAPI):
522
522
  # ]
523
523
  # }
524
524
  #
525
- data = self.safe_value(response, 'data')
525
+ data = self.safe_list(response, 'data')
526
526
  return self.parse_trades(data, market, since, limit)
527
527
 
528
528
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -665,7 +665,7 @@ class btcturk(Exchange, ImplicitAPI):
665
665
  elif not ('newClientOrderId' in params):
666
666
  request['newClientOrderId'] = self.uuid()
667
667
  response = await self.privatePostOrder(self.extend(request, params))
668
- data = self.safe_value(response, 'data')
668
+ data = self.safe_dict(response, 'data')
669
669
  return self.parse_order(data, market)
670
670
 
671
671
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -701,7 +701,7 @@ class btcturk(Exchange, ImplicitAPI):
701
701
  response = await self.privateGetOpenOrders(self.extend(request, params))
702
702
  data = self.safe_value(response, 'data')
703
703
  bids = self.safe_value(data, 'bids', [])
704
- asks = self.safe_value(data, 'asks', [])
704
+ asks = self.safe_list(data, 'asks', [])
705
705
  return self.parse_orders(self.array_concat(bids, asks), market, since, limit)
706
706
 
707
707
  async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -745,7 +745,7 @@ class btcturk(Exchange, ImplicitAPI):
745
745
  # }
746
746
  # ]
747
747
  # }
748
- data = self.safe_value(response, 'data')
748
+ data = self.safe_list(response, 'data')
749
749
  return self.parse_orders(data, market, since, limit)
750
750
 
751
751
  def parse_order_status(self, status):
@@ -859,7 +859,7 @@ class btcturk(Exchange, ImplicitAPI):
859
859
  # "code": "0"
860
860
  # }
861
861
  #
862
- data = self.safe_value(response, 'data')
862
+ data = self.safe_list(response, 'data')
863
863
  return self.parse_trades(data, market, since, limit)
864
864
 
865
865
  def nonce(self):
@@ -1133,70 +1133,6 @@ class bybit(Exchange, ImplicitAPI):
1133
1133
  async def upgrade_unified_trade_account(self, params={}):
1134
1134
  return await self.privatePostV5AccountUpgradeToUta(params)
1135
1135
 
1136
- def convert_expire_date(self, date):
1137
- # parse YYMMDD to timestamp
1138
- year = date[0:2]
1139
- month = date[2:4]
1140
- day = date[4:6]
1141
- reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
1142
- return reconstructedDate
1143
-
1144
- def convert_expire_date_to_market_id_date(self, date):
1145
- # parse 231229 to 29DEC23
1146
- year = date[0:2]
1147
- monthRaw = date[2:4]
1148
- month = None
1149
- day = date[4:6]
1150
- if monthRaw == '01':
1151
- month = 'JAN'
1152
- elif monthRaw == '02':
1153
- month = 'FEB'
1154
- elif monthRaw == '03':
1155
- month = 'MAR'
1156
- elif monthRaw == '04':
1157
- month = 'APR'
1158
- elif monthRaw == '05':
1159
- month = 'MAY'
1160
- elif monthRaw == '06':
1161
- month = 'JUN'
1162
- elif monthRaw == '07':
1163
- month = 'JUL'
1164
- elif monthRaw == '08':
1165
- month = 'AUG'
1166
- elif monthRaw == '09':
1167
- month = 'SEP'
1168
- elif monthRaw == '10':
1169
- month = 'OCT'
1170
- elif monthRaw == '11':
1171
- month = 'NOV'
1172
- elif monthRaw == '12':
1173
- month = 'DEC'
1174
- reconstructedDate = day + month + year
1175
- return reconstructedDate
1176
-
1177
- def convert_market_id_expire_date(self, date):
1178
- # parse 22JAN23 to 230122
1179
- monthMappping = {
1180
- 'JAN': '01',
1181
- 'FEB': '02',
1182
- 'MAR': '03',
1183
- 'APR': '04',
1184
- 'MAY': '05',
1185
- 'JUN': '06',
1186
- 'JUL': '07',
1187
- 'AUG': '08',
1188
- 'SEP': '09',
1189
- 'OCT': '10',
1190
- 'NOV': '11',
1191
- 'DEC': '12',
1192
- }
1193
- year = date[0:2]
1194
- monthName = date[2:5]
1195
- month = self.safe_string(monthMappping, monthName)
1196
- day = date[5:7]
1197
- reconstructedDate = day + month + year
1198
- return reconstructedDate
1199
-
1200
1136
  def create_expired_option_market(self, symbol: str):
1201
1137
  # support expired option contracts
1202
1138
  quote = 'USD'
@@ -2041,7 +1977,7 @@ class bybit(Exchange, ImplicitAPI):
2041
1977
  #
2042
1978
  result = self.safe_value(response, 'result', [])
2043
1979
  tickers = self.safe_value(result, 'list', [])
2044
- rawTicker = self.safe_value(tickers, 0)
1980
+ rawTicker = self.safe_dict(tickers, 0)
2045
1981
  return self.parse_ticker(rawTicker, market)
2046
1982
 
2047
1983
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -2050,6 +1986,7 @@ class bybit(Exchange, ImplicitAPI):
2050
1986
  :see: https://bybit-exchange.github.io/docs/v5/market/tickers
2051
1987
  :param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2052
1988
  :param dict [params]: extra parameters specific to the exchange API endpoint
1989
+ :param str [params.subType]: *contract only* 'linear', 'inverse'
2053
1990
  :returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
2054
1991
  """
2055
1992
  await self.load_markets()
@@ -2082,11 +2019,16 @@ class bybit(Exchange, ImplicitAPI):
2082
2019
  }
2083
2020
  type = None
2084
2021
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2085
- if type == 'spot':
2022
+ # Calls like `.fetch_tickers(None, {subType:'inverse'})` should be supported for self exchange, so
2023
+ # as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2024
+ # with higher priority and only default to spot, if `subType` is not set in params
2025
+ passedSubType = self.safe_string(params, 'subType')
2026
+ subType = None
2027
+ subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
2028
+ # only if passedSubType is None, then use spot
2029
+ if type == 'spot' and passedSubType is None:
2086
2030
  request['category'] = 'spot'
2087
- elif type == 'swap' or type == 'future':
2088
- subType = None
2089
- subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
2031
+ elif type == 'swap' or type == 'future' or subType is not None:
2090
2032
  request['category'] = subType
2091
2033
  elif type == 'option':
2092
2034
  request['category'] = 'option'
@@ -2130,7 +2072,7 @@ class bybit(Exchange, ImplicitAPI):
2130
2072
  # }
2131
2073
  #
2132
2074
  result = self.safe_value(response, 'result', {})
2133
- tickerList = self.safe_value(result, 'list', [])
2075
+ tickerList = self.safe_list(result, 'list', [])
2134
2076
  return self.parse_tickers(tickerList, parsedSymbols)
2135
2077
 
2136
2078
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -2253,7 +2195,7 @@ class bybit(Exchange, ImplicitAPI):
2253
2195
  # }
2254
2196
  #
2255
2197
  result = self.safe_value(response, 'result', {})
2256
- ohlcvs = self.safe_value(result, 'list', [])
2198
+ ohlcvs = self.safe_list(result, 'list', [])
2257
2199
  return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
2258
2200
 
2259
2201
  def parse_funding_rate(self, ticker, market: Market = None):
@@ -2687,7 +2629,7 @@ class bybit(Exchange, ImplicitAPI):
2687
2629
  # }
2688
2630
  #
2689
2631
  result = self.safe_value(response, 'result', {})
2690
- trades = self.safe_value(result, 'list', [])
2632
+ trades = self.safe_list(result, 'list', [])
2691
2633
  return self.parse_trades(trades, market, since, limit)
2692
2634
 
2693
2635
  async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
@@ -3382,7 +3324,7 @@ class bybit(Exchange, ImplicitAPI):
3382
3324
  # "time": 1672211918471
3383
3325
  # }
3384
3326
  #
3385
- order = self.safe_value(response, 'result', {})
3327
+ order = self.safe_dict(response, 'result', {})
3386
3328
  return self.parse_order(order, market)
3387
3329
 
3388
3330
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}, isUTA=True):
@@ -3763,7 +3705,7 @@ class bybit(Exchange, ImplicitAPI):
3763
3705
  # "tpTriggerBy":"UNKNOWN"
3764
3706
  # }
3765
3707
  #
3766
- order = self.safe_value(response, 'result', {})
3708
+ order = self.safe_dict(response, 'result', {})
3767
3709
  return self.parse_order(order, market)
3768
3710
 
3769
3711
  async def edit_usdc_order(self, id, symbol, type, side, amount=None, price=None, params={}):
@@ -3811,7 +3753,7 @@ class bybit(Exchange, ImplicitAPI):
3811
3753
  # "retExtMap": {}
3812
3754
  # }
3813
3755
  #
3814
- result = self.safe_value(response, 'result', {})
3756
+ result = self.safe_dict(response, 'result', {})
3815
3757
  return self.parse_order(result, market)
3816
3758
 
3817
3759
  async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
@@ -3960,7 +3902,7 @@ class bybit(Exchange, ImplicitAPI):
3960
3902
  # "retExtMap": {}
3961
3903
  # }
3962
3904
  #
3963
- result = self.safe_value(response, 'result', {})
3905
+ result = self.safe_dict(response, 'result', {})
3964
3906
  return self.parse_order(result, market)
3965
3907
 
3966
3908
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -4018,7 +3960,7 @@ class bybit(Exchange, ImplicitAPI):
4018
3960
  # "time": 1672217377164
4019
3961
  # }
4020
3962
  #
4021
- result = self.safe_value(response, 'result', {})
3963
+ result = self.safe_dict(response, 'result', {})
4022
3964
  return self.parse_order(result, market)
4023
3965
 
4024
3966
  async def cancel_orders(self, ids, symbol: Str = None, params={}):
@@ -4289,7 +4231,7 @@ class bybit(Exchange, ImplicitAPI):
4289
4231
  # }
4290
4232
  #
4291
4233
  result = self.safe_value(response, 'result', {})
4292
- data = self.safe_value(result, 'dataList', [])
4234
+ data = self.safe_list(result, 'dataList', [])
4293
4235
  return self.parse_orders(data, market, since, limit)
4294
4236
 
4295
4237
  async def fetch_order_classic(self, id: str, symbol: Str = None, params={}):
@@ -4859,7 +4801,7 @@ class bybit(Exchange, ImplicitAPI):
4859
4801
  # }
4860
4802
  #
4861
4803
  result = self.safe_value(response, 'result', {})
4862
- dataList = self.safe_value(result, 'dataList', [])
4804
+ dataList = self.safe_list(result, 'dataList', [])
4863
4805
  return self.parse_trades(dataList, market, since, limit)
4864
4806
 
4865
4807
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -5050,7 +4992,7 @@ class bybit(Exchange, ImplicitAPI):
5050
4992
  chains = self.safe_value(result, 'chains', [])
5051
4993
  chainsIndexedById = self.index_by(chains, 'chain')
5052
4994
  selectedNetworkId = self.select_network_id_from_raw_networks(code, networkCode, chainsIndexedById)
5053
- addressObject = self.safe_value(chainsIndexedById, selectedNetworkId, {})
4995
+ addressObject = self.safe_dict(chainsIndexedById, selectedNetworkId, {})
5054
4996
  return self.parse_deposit_address(addressObject, currency)
5055
4997
 
5056
4998
  async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -5580,7 +5522,7 @@ class bybit(Exchange, ImplicitAPI):
5580
5522
  # "time": "1666892894902"
5581
5523
  # }
5582
5524
  #
5583
- result = self.safe_value(response, 'result', {})
5525
+ result = self.safe_dict(response, 'result', {})
5584
5526
  return self.parse_transaction(result, currency)
5585
5527
 
5586
5528
  async def fetch_position(self, symbol: str, params={}):
@@ -5959,6 +5901,11 @@ class bybit(Exchange, ImplicitAPI):
5959
5901
  timestamp = self.parse8601(self.safe_string(position, 'updated_at'))
5960
5902
  if timestamp is None:
5961
5903
  timestamp = self.safe_integer_n(position, ['updatedTime', 'updatedAt'])
5904
+ tradeMode = self.safe_integer(position, 'tradeMode', 0)
5905
+ marginMode = None
5906
+ if (not self.options['enableUnifiedAccount']) or (self.options['enableUnifiedAccount'] and market['inverse']):
5907
+ # tradeMode would work for classic and UTA(inverse)
5908
+ marginMode = 'isolated' if (tradeMode == 1) else 'cross'
5962
5909
  collateralString = self.safe_string(position, 'positionBalance')
5963
5910
  entryPrice = self.omit_zero(self.safe_string_2(position, 'entryPrice', 'avgPrice'))
5964
5911
  liquidationPrice = self.omit_zero(self.safe_string(position, 'liqPrice'))
@@ -6015,7 +5962,7 @@ class bybit(Exchange, ImplicitAPI):
6015
5962
  'markPrice': self.safe_number(position, 'markPrice'),
6016
5963
  'lastPrice': None,
6017
5964
  'collateral': self.parse_number(collateralString),
6018
- 'marginMode': None,
5965
+ 'marginMode': marginMode,
6019
5966
  'side': side,
6020
5967
  'percentage': None,
6021
5968
  'stopLossPrice': self.safe_number_2(position, 'stop_loss', 'stopLoss'),
@@ -6986,7 +6933,7 @@ class bybit(Exchange, ImplicitAPI):
6986
6933
  # }
6987
6934
  #
6988
6935
  data = self.safe_value(response, 'result', {})
6989
- rows = self.safe_value(data, 'rows', [])
6936
+ rows = self.safe_list(data, 'rows', [])
6990
6937
  return self.parse_deposit_withdraw_fees(rows, codes, 'coin')
6991
6938
 
6992
6939
  async def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -469,7 +469,7 @@ class coincheck(Exchange, ImplicitAPI):
469
469
  # ]
470
470
  # }
471
471
  #
472
- transactions = self.safe_value(response, 'data', [])
472
+ transactions = self.safe_list(response, 'data', [])
473
473
  return self.parse_trades(transactions, market, since, limit)
474
474
 
475
475
  async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
@@ -500,7 +500,7 @@ class coincheck(Exchange, ImplicitAPI):
500
500
  # "created_at": "2021-12-08T14:10:33.000Z"
501
501
  # }
502
502
  #
503
- data = self.safe_value(response, 'data', [])
503
+ data = self.safe_list(response, 'data', [])
504
504
  return self.parse_trades(data, market, since, limit)
505
505
 
506
506
  async def fetch_trading_fees(self, params={}):
@@ -636,7 +636,7 @@ class coincheck(Exchange, ImplicitAPI):
636
636
  # }
637
637
  # ]
638
638
  # }
639
- data = self.safe_value(response, 'deposits', [])
639
+ data = self.safe_list(response, 'deposits', [])
640
640
  return self.parse_transactions(data, currency, since, limit, {'type': 'deposit'})
641
641
 
642
642
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -678,7 +678,7 @@ class coincheck(Exchange, ImplicitAPI):
678
678
  # }
679
679
  # ]
680
680
  # }
681
- data = self.safe_value(response, 'data', [])
681
+ data = self.safe_list(response, 'data', [])
682
682
  return self.parse_transactions(data, currency, since, limit, {'type': 'withdrawal'})
683
683
 
684
684
  def parse_transaction_status(self, status):
@@ -1332,7 +1332,7 @@ class coinex(Exchange, ImplicitAPI):
1332
1332
  # "message": "OK"
1333
1333
  # }
1334
1334
  #
1335
- data = self.safe_value(response, 'data', [])
1335
+ data = self.safe_list(response, 'data', [])
1336
1336
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
1337
1337
 
1338
1338
  async def fetch_margin_balance(self, params={}):
@@ -2169,7 +2169,7 @@ class coinex(Exchange, ImplicitAPI):
2169
2169
  #
2170
2170
  # {"code":0,"data":{"status":"success"},"message":"OK"}
2171
2171
  #
2172
- data = self.safe_value(response, 'data', {})
2172
+ data = self.safe_dict(response, 'data', {})
2173
2173
  return self.parse_order(data, market)
2174
2174
 
2175
2175
  async def create_orders(self, orders: List[OrderRequest], params={}) -> List[Order]:
@@ -2447,7 +2447,7 @@ class coinex(Exchange, ImplicitAPI):
2447
2447
  # "message": "Success"
2448
2448
  # }
2449
2449
  #
2450
- data = self.safe_value(response, 'data', {})
2450
+ data = self.safe_dict(response, 'data', {})
2451
2451
  return self.parse_order(data, market)
2452
2452
 
2453
2453
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -2618,7 +2618,7 @@ class coinex(Exchange, ImplicitAPI):
2618
2618
  #
2619
2619
  # {"code":0,"data":{},"message":"Success"}
2620
2620
  #
2621
- data = self.safe_value(response, 'data')
2621
+ data = self.safe_dict(response, 'data')
2622
2622
  return self.parse_order(data, market)
2623
2623
 
2624
2624
  async def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -2799,7 +2799,7 @@ class coinex(Exchange, ImplicitAPI):
2799
2799
  # "message":"OK"
2800
2800
  # }
2801
2801
  #
2802
- data = self.safe_value(response, 'data')
2802
+ data = self.safe_dict(response, 'data')
2803
2803
  return self.parse_order(data, market)
2804
2804
 
2805
2805
  async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -3007,7 +3007,7 @@ class coinex(Exchange, ImplicitAPI):
3007
3007
  #
3008
3008
  tradeRequest = 'records' if (marketType == 'swap') else 'data'
3009
3009
  data = self.safe_value(response, 'data')
3010
- orders = self.safe_value(data, tradeRequest, [])
3010
+ orders = self.safe_list(data, tradeRequest, [])
3011
3011
  return self.parse_orders(orders, market, since, limit)
3012
3012
 
3013
3013
  async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -3066,7 +3066,7 @@ class coinex(Exchange, ImplicitAPI):
3066
3066
  # },
3067
3067
  # "message": "Success"
3068
3068
  # }
3069
- data = self.safe_value(response, 'data', {})
3069
+ data = self.safe_dict(response, 'data', {})
3070
3070
  return self.parse_deposit_address(data, currency)
3071
3071
 
3072
3072
  async def fetch_deposit_address(self, code: str, params={}):
@@ -3276,7 +3276,7 @@ class coinex(Exchange, ImplicitAPI):
3276
3276
  #
3277
3277
  tradeRequest = 'records' if swap else 'data'
3278
3278
  data = self.safe_value(response, 'data')
3279
- trades = self.safe_value(data, tradeRequest, [])
3279
+ trades = self.safe_list(data, tradeRequest, [])
3280
3280
  return self.parse_trades(trades, market, since, limit)
3281
3281
 
3282
3282
  async def fetch_positions(self, symbols: Strings = None, params={}):
@@ -3457,7 +3457,7 @@ class coinex(Exchange, ImplicitAPI):
3457
3457
  # "message": "OK"
3458
3458
  # }
3459
3459
  #
3460
- data = self.safe_value(response, 'data', [])
3460
+ data = self.safe_list(response, 'data', [])
3461
3461
  return self.parse_position(data[0], market)
3462
3462
 
3463
3463
  def parse_position(self, position, market: Market = None):
@@ -4107,7 +4107,7 @@ class coinex(Exchange, ImplicitAPI):
4107
4107
  # "message": "Ok"
4108
4108
  # }
4109
4109
  #
4110
- transaction = self.safe_value(response, 'data', {})
4110
+ transaction = self.safe_dict(response, 'data', {})
4111
4111
  return self.parse_transaction(transaction, currency)
4112
4112
 
4113
4113
  def parse_transaction_status(self, status):
@@ -4493,7 +4493,7 @@ class coinex(Exchange, ImplicitAPI):
4493
4493
  # }
4494
4494
  #
4495
4495
  data = self.safe_value(response, 'data', {})
4496
- transfers = self.safe_value(data, 'records', [])
4496
+ transfers = self.safe_list(data, 'records', [])
4497
4497
  return self.parse_transfers(transfers, currency, since, limit)
4498
4498
 
4499
4499
  async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -708,7 +708,7 @@ class coinlist(Exchange, ImplicitAPI):
708
708
  # ]
709
709
  # }
710
710
  #
711
- candles = self.safe_value(response, 'candles', [])
711
+ candles = self.safe_list(response, 'candles', [])
712
712
  return self.parse_ohlcvs(candles, market, timeframe, since, limit)
713
713
 
714
714
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -781,7 +781,7 @@ class coinlist(Exchange, ImplicitAPI):
781
781
  # ]
782
782
  # }
783
783
  #
784
- auctions = self.safe_value(response, 'auctions', [])
784
+ auctions = self.safe_list(response, 'auctions', [])
785
785
  return self.parse_trades(auctions, market, since, limit)
786
786
 
787
787
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -1163,7 +1163,7 @@ class coinlist(Exchange, ImplicitAPI):
1163
1163
  # ]
1164
1164
  # }
1165
1165
  #
1166
- fills = self.safe_value(response, 'fills', [])
1166
+ fills = self.safe_list(response, 'fills', [])
1167
1167
  return self.parse_trades(fills, market, since, limit)
1168
1168
 
1169
1169
  async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
@@ -1240,7 +1240,7 @@ class coinlist(Exchange, ImplicitAPI):
1240
1240
  # ]
1241
1241
  # }
1242
1242
  #
1243
- orders = self.safe_value(response, 'orders', [])
1243
+ orders = self.safe_list(response, 'orders', [])
1244
1244
  return self.parse_orders(orders, market, since, limit)
1245
1245
 
1246
1246
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
@@ -1458,7 +1458,7 @@ class coinlist(Exchange, ImplicitAPI):
1458
1458
  # "timestamp": "2023-10-26T11:30:55.376Z"
1459
1459
  # }
1460
1460
  #
1461
- order = self.safe_value(response, 'order', {})
1461
+ order = self.safe_dict(response, 'order', {})
1462
1462
  return self.parse_order(order, market)
1463
1463
 
1464
1464
  async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
@@ -1729,7 +1729,7 @@ class coinlist(Exchange, ImplicitAPI):
1729
1729
  # ]
1730
1730
  # }
1731
1731
  #
1732
- transfers = self.safe_value(response, 'transfers', [])
1732
+ transfers = self.safe_list(response, 'transfers', [])
1733
1733
  return self.parse_transfers(transfers, currency, since, limit)
1734
1734
 
1735
1735
  def parse_transfer(self, transfer, currency: Currency = None):
@@ -1889,7 +1889,7 @@ class coinlist(Exchange, ImplicitAPI):
1889
1889
  # "transfer_id": "d4a2d8dd-7def-4545-a062-761683b9aa05"
1890
1890
  # }
1891
1891
  #
1892
- data = self.safe_value(response, 'data', {})
1892
+ data = self.safe_dict(response, 'data', {})
1893
1893
  return self.parse_transaction(data, currency)
1894
1894
 
1895
1895
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
@@ -395,7 +395,7 @@ class coinmate(Exchange, ImplicitAPI):
395
395
  # }
396
396
  # }
397
397
  #
398
- data = self.safe_value(response, 'data')
398
+ data = self.safe_dict(response, 'data')
399
399
  return self.parse_ticker(data, market)
400
400
 
401
401
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -660,7 +660,7 @@ class coinmate(Exchange, ImplicitAPI):
660
660
  if since is not None:
661
661
  request['timestampFrom'] = since
662
662
  response = await self.privatePostTradeHistory(self.extend(request, params))
663
- data = self.safe_value(response, 'data', [])
663
+ data = self.safe_list(response, 'data', [])
664
664
  return self.parse_trades(data, None, since, limit)
665
665
 
666
666
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -758,7 +758,7 @@ class coinmate(Exchange, ImplicitAPI):
758
758
  # ]
759
759
  # }
760
760
  #
761
- data = self.safe_value(response, 'data', [])
761
+ data = self.safe_list(response, 'data', [])
762
762
  return self.parse_trades(data, market, since, limit)
763
763
 
764
764
  async def fetch_trading_fee(self, symbol: str, params={}):
@@ -985,7 +985,7 @@ class coinmate(Exchange, ImplicitAPI):
985
985
  if symbol:
986
986
  market = self.market(symbol)
987
987
  response = await self.privatePostOrderById(self.extend(request, params))
988
- data = self.safe_value(response, 'data')
988
+ data = self.safe_dict(response, 'data')
989
989
  return self.parse_order(data, market)
990
990
 
991
991
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -532,7 +532,7 @@ class coinmetro(Exchange, ImplicitAPI):
532
532
  # ]
533
533
  # }
534
534
  #
535
- candleHistory = self.safe_value(response, 'candleHistory', [])
535
+ candleHistory = self.safe_list(response, 'candleHistory', [])
536
536
  return self.parse_ohlcvs(candleHistory, market, timeframe, since, limit)
537
537
 
538
538
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -594,7 +594,7 @@ class coinmetro(Exchange, ImplicitAPI):
594
594
  # ]
595
595
  # }
596
596
  #
597
- tickHistory = self.safe_value(response, 'tickHistory', [])
597
+ tickHistory = self.safe_list(response, 'tickHistory', [])
598
598
  return self.parse_trades(tickHistory, market, since, limit)
599
599
 
600
600
  async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -851,7 +851,7 @@ class coinmetro(Exchange, ImplicitAPI):
851
851
  """
852
852
  await self.load_markets()
853
853
  response = await self.publicGetExchangePrices(params)
854
- latestPrices = self.safe_value(response, 'latestPrices', [])
854
+ latestPrices = self.safe_list(response, 'latestPrices', [])
855
855
  return self.parse_tickers(latestPrices, symbols)
856
856
 
857
857
  def parse_ticker(self, ticker, market: Market = None) -> Ticker: