ccxt 4.2.84__py2.py3-none-any.whl → 4.2.86__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

Files changed (152) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/coinex.py +232 -123
  3. ccxt/ace.py +5 -5
  4. ccxt/ascendex.py +8 -8
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ace.py +5 -5
  7. ccxt/async_support/ascendex.py +8 -8
  8. ccxt/async_support/base/exchange.py +3 -27
  9. ccxt/async_support/bigone.py +12 -12
  10. ccxt/async_support/binance.py +20 -32
  11. ccxt/async_support/bingx.py +45 -28
  12. ccxt/async_support/bit2c.py +1 -1
  13. ccxt/async_support/bitbank.py +27 -29
  14. ccxt/async_support/bitbns.py +5 -5
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +1 -1
  17. ccxt/async_support/bitget.py +29 -24
  18. ccxt/async_support/bithumb.py +5 -5
  19. ccxt/async_support/bitmart.py +16 -16
  20. ccxt/async_support/bitopro.py +1 -1
  21. ccxt/async_support/bitrue.py +4 -4
  22. ccxt/async_support/bitso.py +5 -5
  23. ccxt/async_support/bitstamp.py +1 -1
  24. ccxt/async_support/bitteam.py +8 -8
  25. ccxt/async_support/bl3p.py +1 -1
  26. ccxt/async_support/btcturk.py +6 -6
  27. ccxt/async_support/bybit.py +30 -83
  28. ccxt/async_support/coincheck.py +4 -4
  29. ccxt/async_support/coinex.py +404 -262
  30. ccxt/async_support/coinlist.py +7 -7
  31. ccxt/async_support/coinmate.py +4 -4
  32. ccxt/async_support/coinmetro.py +3 -3
  33. ccxt/async_support/coinone.py +5 -5
  34. ccxt/async_support/coinspot.py +2 -2
  35. ccxt/async_support/cryptocom.py +17 -17
  36. ccxt/async_support/currencycom.py +1 -1
  37. ccxt/async_support/delta.py +0 -8
  38. ccxt/async_support/deribit.py +16 -80
  39. ccxt/async_support/digifinex.py +8 -8
  40. ccxt/async_support/exmo.py +8 -8
  41. ccxt/async_support/gate.py +0 -8
  42. ccxt/async_support/hitbtc.py +5 -4
  43. ccxt/async_support/hollaex.py +7 -7
  44. ccxt/async_support/htx.py +7 -7
  45. ccxt/async_support/huobijp.py +3 -3
  46. ccxt/async_support/idex.py +12 -12
  47. ccxt/async_support/independentreserve.py +2 -2
  48. ccxt/async_support/indodax.py +2 -2
  49. ccxt/async_support/kraken.py +8 -8
  50. ccxt/async_support/krakenfutures.py +6 -6
  51. ccxt/async_support/kucoin.py +4 -1
  52. ccxt/async_support/kucoinfutures.py +8 -8
  53. ccxt/async_support/kuna.py +16 -16
  54. ccxt/async_support/latoken.py +2 -2
  55. ccxt/async_support/lbank.py +10 -10
  56. ccxt/async_support/luno.py +4 -4
  57. ccxt/async_support/mercado.py +5 -5
  58. ccxt/async_support/mexc.py +6 -6
  59. ccxt/async_support/ndax.py +1 -1
  60. ccxt/async_support/novadax.py +9 -9
  61. ccxt/async_support/oceanex.py +7 -7
  62. ccxt/async_support/okcoin.py +15 -14
  63. ccxt/async_support/okx.py +23 -31
  64. ccxt/async_support/onetrading.py +4 -4
  65. ccxt/async_support/p2b.py +7 -7
  66. ccxt/async_support/phemex.py +12 -12
  67. ccxt/async_support/poloniexfutures.py +5 -5
  68. ccxt/async_support/probit.py +11 -11
  69. ccxt/async_support/timex.py +7 -7
  70. ccxt/async_support/tokocrypto.py +9 -9
  71. ccxt/async_support/wavesexchange.py +3 -3
  72. ccxt/async_support/whitebit.py +5 -5
  73. ccxt/async_support/woo.py +1 -1
  74. ccxt/async_support/zaif.py +1 -1
  75. ccxt/async_support/zonda.py +7 -7
  76. ccxt/base/exchange.py +66 -23
  77. ccxt/bigone.py +12 -12
  78. ccxt/binance.py +20 -32
  79. ccxt/bingx.py +45 -28
  80. ccxt/bit2c.py +1 -1
  81. ccxt/bitbank.py +27 -29
  82. ccxt/bitbns.py +5 -5
  83. ccxt/bitfinex.py +1 -1
  84. ccxt/bitfinex2.py +1 -1
  85. ccxt/bitget.py +29 -24
  86. ccxt/bithumb.py +5 -5
  87. ccxt/bitmart.py +16 -16
  88. ccxt/bitopro.py +1 -1
  89. ccxt/bitrue.py +4 -4
  90. ccxt/bitso.py +5 -5
  91. ccxt/bitstamp.py +1 -1
  92. ccxt/bitteam.py +8 -8
  93. ccxt/bl3p.py +1 -1
  94. ccxt/btcturk.py +6 -6
  95. ccxt/bybit.py +30 -83
  96. ccxt/coincheck.py +4 -4
  97. ccxt/coinex.py +404 -262
  98. ccxt/coinlist.py +7 -7
  99. ccxt/coinmate.py +4 -4
  100. ccxt/coinmetro.py +3 -3
  101. ccxt/coinone.py +5 -5
  102. ccxt/coinspot.py +2 -2
  103. ccxt/cryptocom.py +17 -17
  104. ccxt/currencycom.py +1 -1
  105. ccxt/delta.py +0 -8
  106. ccxt/deribit.py +16 -80
  107. ccxt/digifinex.py +8 -8
  108. ccxt/exmo.py +8 -8
  109. ccxt/gate.py +0 -8
  110. ccxt/hitbtc.py +5 -4
  111. ccxt/hollaex.py +7 -7
  112. ccxt/htx.py +7 -7
  113. ccxt/huobijp.py +3 -3
  114. ccxt/idex.py +12 -12
  115. ccxt/independentreserve.py +2 -2
  116. ccxt/indodax.py +2 -2
  117. ccxt/kraken.py +8 -8
  118. ccxt/krakenfutures.py +6 -6
  119. ccxt/kucoin.py +4 -1
  120. ccxt/kucoinfutures.py +8 -8
  121. ccxt/kuna.py +16 -16
  122. ccxt/latoken.py +2 -2
  123. ccxt/lbank.py +10 -10
  124. ccxt/luno.py +4 -4
  125. ccxt/mercado.py +5 -5
  126. ccxt/mexc.py +6 -6
  127. ccxt/ndax.py +1 -1
  128. ccxt/novadax.py +9 -9
  129. ccxt/oceanex.py +7 -7
  130. ccxt/okcoin.py +15 -14
  131. ccxt/okx.py +23 -31
  132. ccxt/onetrading.py +4 -4
  133. ccxt/p2b.py +7 -7
  134. ccxt/phemex.py +12 -12
  135. ccxt/poloniexfutures.py +5 -5
  136. ccxt/pro/__init__.py +1 -1
  137. ccxt/pro/binance.py +150 -112
  138. ccxt/pro/bitget.py +1 -0
  139. ccxt/pro/kucoin.py +6 -7
  140. ccxt/pro/okx.py +12 -1
  141. ccxt/probit.py +11 -11
  142. ccxt/timex.py +7 -7
  143. ccxt/tokocrypto.py +9 -9
  144. ccxt/wavesexchange.py +3 -3
  145. ccxt/whitebit.py +5 -5
  146. ccxt/woo.py +1 -1
  147. ccxt/zaif.py +1 -1
  148. ccxt/zonda.py +7 -7
  149. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/METADATA +6 -6
  150. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/RECORD +152 -152
  151. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/WHEEL +0 -0
  152. {ccxt-4.2.84.dist-info → ccxt-4.2.86.dist-info}/top_level.txt +0 -0
@@ -1073,7 +1073,7 @@ class bitstamp(Exchange, ImplicitAPI):
1073
1073
  # }
1074
1074
  #
1075
1075
  data = self.safe_value(response, 'data', {})
1076
- ohlc = self.safe_value(data, 'ohlc', [])
1076
+ ohlc = self.safe_list(data, 'ohlc', [])
1077
1077
  return self.parse_ohlcvs(ohlc, market, timeframe, since, limit)
1078
1078
 
1079
1079
  def parse_balance(self, response) -> Balances:
@@ -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):