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
ccxt/bitmart.py CHANGED
@@ -1302,7 +1302,7 @@ class bitmart(Exchange, ImplicitAPI):
1302
1302
  tickersById = self.index_by(tickers, 'symbol')
1303
1303
  elif market['swap']:
1304
1304
  tickersById = self.index_by(tickers, 'contract_symbol')
1305
- ticker = self.safe_value(tickersById, market['id'])
1305
+ ticker = self.safe_dict(tickersById, market['id'])
1306
1306
  return self.parse_ticker(ticker, market)
1307
1307
 
1308
1308
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -1549,7 +1549,7 @@ class bitmart(Exchange, ImplicitAPI):
1549
1549
  # }
1550
1550
  #
1551
1551
  data = self.safe_value(response, 'data', {})
1552
- trades = self.safe_value(data, 'trades', [])
1552
+ trades = self.safe_list(data, 'trades', [])
1553
1553
  return self.parse_trades(trades, market, since, limit)
1554
1554
 
1555
1555
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -1703,7 +1703,7 @@ class bitmart(Exchange, ImplicitAPI):
1703
1703
  # "trace": "96c989db-e0f5-46f5-bba6-60cfcbde699b"
1704
1704
  # }
1705
1705
  #
1706
- ohlcv = self.safe_value(response, 'data', [])
1706
+ ohlcv = self.safe_list(response, 'data', [])
1707
1707
  return self.parse_ohlcvs(ohlcv, market, timeframe, since, limit)
1708
1708
 
1709
1709
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1806,7 +1806,7 @@ class bitmart(Exchange, ImplicitAPI):
1806
1806
  # "trace": "4cad855074634097ac6ba5257c47305d.62.16959616054873723"
1807
1807
  # }
1808
1808
  #
1809
- data = self.safe_value(response, 'data', [])
1809
+ data = self.safe_list(response, 'data', [])
1810
1810
  return self.parse_trades(data, market, since, limit)
1811
1811
 
1812
1812
  def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1825,7 +1825,7 @@ class bitmart(Exchange, ImplicitAPI):
1825
1825
  'orderId': id,
1826
1826
  }
1827
1827
  response = self.privatePostSpotV4QueryOrderTrades(self.extend(request, params))
1828
- data = self.safe_value(response, 'data', {})
1828
+ data = self.safe_list(response, 'data', [])
1829
1829
  return self.parse_trades(data, None, since, limit)
1830
1830
 
1831
1831
  def custom_parse_balance(self, response, marketType) -> Balances:
@@ -2616,7 +2616,7 @@ class bitmart(Exchange, ImplicitAPI):
2616
2616
  # }
2617
2617
  #
2618
2618
  data = self.safe_value(response, 'data', {})
2619
- orders = self.safe_value(data, 'orders', [])
2619
+ orders = self.safe_list(data, 'orders', [])
2620
2620
  return self.parse_orders(orders, market, since, limit)
2621
2621
 
2622
2622
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -2731,7 +2731,7 @@ class bitmart(Exchange, ImplicitAPI):
2731
2731
  # "trace": "7f9d94g10f9d4513bc08a7rfc3a5559a.71.16957022303515933"
2732
2732
  # }
2733
2733
  #
2734
- data = self.safe_value(response, 'data', [])
2734
+ data = self.safe_list(response, 'data', [])
2735
2735
  return self.parse_orders(data, market, since, limit)
2736
2736
 
2737
2737
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -2775,7 +2775,7 @@ class bitmart(Exchange, ImplicitAPI):
2775
2775
  response = self.privatePostSpotV4QueryHistoryOrders(self.extend(request, params))
2776
2776
  else:
2777
2777
  response = self.privateGetContractPrivateOrderHistory(self.extend(request, params))
2778
- data = self.safe_value(response, 'data', [])
2778
+ data = self.safe_list(response, 'data', [])
2779
2779
  return self.parse_orders(data, market, since, limit)
2780
2780
 
2781
2781
  def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -2882,7 +2882,7 @@ class bitmart(Exchange, ImplicitAPI):
2882
2882
  # "trace": "4cad855075664097af6ba5257c47605d.63.14957831547451715"
2883
2883
  # }
2884
2884
  #
2885
- data = self.safe_value(response, 'data', {})
2885
+ data = self.safe_dict(response, 'data', {})
2886
2886
  return self.parse_order(data, market)
2887
2887
 
2888
2888
  def fetch_deposit_address(self, code: str, params={}):
@@ -2921,7 +2921,7 @@ class bitmart(Exchange, ImplicitAPI):
2921
2921
  # }
2922
2922
  # }
2923
2923
  #
2924
- data = self.safe_value(response, 'data', {})
2924
+ data = self.safe_dict(response, 'data', {})
2925
2925
  return self.parse_deposit_address(data, currency)
2926
2926
 
2927
2927
  def parse_deposit_address(self, depositAddress, currency=None):
@@ -3058,7 +3058,7 @@ class bitmart(Exchange, ImplicitAPI):
3058
3058
  # }
3059
3059
  #
3060
3060
  data = self.safe_value(response, 'data', {})
3061
- records = self.safe_value(data, 'records', [])
3061
+ records = self.safe_list(data, 'records', [])
3062
3062
  return self.parse_transactions(records, currency, since, limit)
3063
3063
 
3064
3064
  def fetch_deposit(self, id: str, code: Str = None, params={}):
@@ -3097,7 +3097,7 @@ class bitmart(Exchange, ImplicitAPI):
3097
3097
  # }
3098
3098
  #
3099
3099
  data = self.safe_value(response, 'data', {})
3100
- record = self.safe_value(data, 'record', {})
3100
+ record = self.safe_dict(data, 'record', {})
3101
3101
  return self.parse_transaction(record)
3102
3102
 
3103
3103
  def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -3147,7 +3147,7 @@ class bitmart(Exchange, ImplicitAPI):
3147
3147
  # }
3148
3148
  #
3149
3149
  data = self.safe_value(response, 'data', {})
3150
- record = self.safe_value(data, 'record', {})
3150
+ record = self.safe_dict(data, 'record', {})
3151
3151
  return self.parse_transaction(record)
3152
3152
 
3153
3153
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -3665,7 +3665,7 @@ class bitmart(Exchange, ImplicitAPI):
3665
3665
  # }
3666
3666
  #
3667
3667
  data = self.safe_value(response, 'data', {})
3668
- records = self.safe_value(data, 'records', [])
3668
+ records = self.safe_list(data, 'records', [])
3669
3669
  return self.parse_transfers(records, currency, since, limit)
3670
3670
 
3671
3671
  def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -3774,7 +3774,7 @@ class bitmart(Exchange, ImplicitAPI):
3774
3774
  # "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.72.16946575108274991"
3775
3775
  # }
3776
3776
  #
3777
- data = self.safe_value(response, 'data', {})
3777
+ data = self.safe_dict(response, 'data', {})
3778
3778
  return self.parse_open_interest(data, market)
3779
3779
 
3780
3780
  def parse_open_interest(self, interest, market: Market = None):
@@ -3930,7 +3930,7 @@ class bitmart(Exchange, ImplicitAPI):
3930
3930
  # }
3931
3931
  #
3932
3932
  data = self.safe_value(response, 'data', [])
3933
- first = self.safe_value(data, 0, {})
3933
+ first = self.safe_dict(data, 0, {})
3934
3934
  return self.parse_position(first, market)
3935
3935
 
3936
3936
  def fetch_positions(self, symbols: Strings = None, params={}):
ccxt/bitopro.py CHANGED
@@ -1574,7 +1574,7 @@ class bitopro(Exchange, ImplicitAPI):
1574
1574
  # ]
1575
1575
  # }
1576
1576
  #
1577
- data = self.safe_value(response, 'data', [])
1577
+ data = self.safe_list(response, 'data', [])
1578
1578
  return self.parse_deposit_withdraw_fees(data, codes, 'currency')
1579
1579
 
1580
1580
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
ccxt/bitrue.py CHANGED
@@ -2403,7 +2403,7 @@ class bitrue(Exchange, ImplicitAPI):
2403
2403
  # ]
2404
2404
  # }
2405
2405
  #
2406
- data = self.safe_value(response, 'data', [])
2406
+ data = self.safe_list(response, 'data', [])
2407
2407
  return self.parse_transactions(data, currency, since, limit)
2408
2408
 
2409
2409
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -2641,7 +2641,7 @@ class bitrue(Exchange, ImplicitAPI):
2641
2641
  # }
2642
2642
  # }
2643
2643
  #
2644
- data = self.safe_value(response, 'data', {})
2644
+ data = self.safe_dict(response, 'data', {})
2645
2645
  return self.parse_transaction(data, currency)
2646
2646
 
2647
2647
  def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
@@ -2692,7 +2692,7 @@ class bitrue(Exchange, ImplicitAPI):
2692
2692
  """
2693
2693
  self.load_markets()
2694
2694
  response = self.spotV1PublicGetExchangeInfo(params)
2695
- coins = self.safe_value(response, 'coins')
2695
+ coins = self.safe_list(response, 'coins')
2696
2696
  return self.parse_deposit_withdraw_fees(coins, codes, 'coin')
2697
2697
 
2698
2698
  def parse_transfer(self, transfer, currency=None):
@@ -2810,7 +2810,7 @@ class bitrue(Exchange, ImplicitAPI):
2810
2810
  # 'data': null
2811
2811
  # }
2812
2812
  #
2813
- data = self.safe_value(response, 'data', {})
2813
+ data = self.safe_dict(response, 'data', {})
2814
2814
  return self.parse_transfer(data, currency)
2815
2815
 
2816
2816
  def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
ccxt/bitso.py CHANGED
@@ -670,7 +670,7 @@ class bitso(Exchange, ImplicitAPI):
670
670
  # ]
671
671
  # }
672
672
  #
673
- payload = self.safe_value(response, 'payload', [])
673
+ payload = self.safe_list(response, 'payload', [])
674
674
  return self.parse_ohlcvs(payload, market, timeframe, since, limit)
675
675
 
676
676
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -1183,7 +1183,7 @@ class bitso(Exchange, ImplicitAPI):
1183
1183
  # }
1184
1184
  #
1185
1185
  transactions = self.safe_value(response, 'payload', [])
1186
- first = self.safe_value(transactions, 0, {})
1186
+ first = self.safe_dict(transactions, 0, {})
1187
1187
  return self.parse_transaction(first)
1188
1188
 
1189
1189
  def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -1224,7 +1224,7 @@ class bitso(Exchange, ImplicitAPI):
1224
1224
  # }]
1225
1225
  # }
1226
1226
  #
1227
- transactions = self.safe_value(response, 'payload', [])
1227
+ transactions = self.safe_list(response, 'payload', [])
1228
1228
  return self.parse_transactions(transactions, currency, since, limit, params)
1229
1229
 
1230
1230
  def fetch_deposit_address(self, code: str, params={}):
@@ -1396,7 +1396,7 @@ class bitso(Exchange, ImplicitAPI):
1396
1396
  # }
1397
1397
  # }
1398
1398
  #
1399
- payload = self.safe_value(response, 'payload', {})
1399
+ payload = self.safe_list(response, 'payload', [])
1400
1400
  return self.parse_deposit_withdraw_fees(payload, codes)
1401
1401
 
1402
1402
  def parse_deposit_withdraw_fees(self, response, codes=None, currencyIdKey=None):
@@ -1524,7 +1524,7 @@ class bitso(Exchange, ImplicitAPI):
1524
1524
  # }
1525
1525
  #
1526
1526
  payload = self.safe_value(response, 'payload', [])
1527
- first = self.safe_value(payload, 0)
1527
+ first = self.safe_dict(payload, 0)
1528
1528
  return self.parse_transaction(first, currency)
1529
1529
 
1530
1530
  def safe_network(self, networkId):
ccxt/bitstamp.py CHANGED
@@ -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:
ccxt/bitteam.py CHANGED
@@ -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
  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
  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
  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
  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:
ccxt/bl3p.py CHANGED
@@ -172,7 +172,7 @@ class bl3p(Exchange, ImplicitAPI):
172
172
  'market': market['id'],
173
173
  }
174
174
  response = 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:
ccxt/btcturk.py CHANGED
@@ -410,7 +410,7 @@ class btcturk(Exchange, ImplicitAPI):
410
410
  """
411
411
  self.load_markets()
412
412
  response = 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
  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 = 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
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -701,7 +701,7 @@ class btcturk(Exchange, ImplicitAPI):
701
701
  response = 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
  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):
ccxt/bybit.py CHANGED
@@ -1132,70 +1132,6 @@ class bybit(Exchange, ImplicitAPI):
1132
1132
  def upgrade_unified_trade_account(self, params={}):
1133
1133
  return self.privatePostV5AccountUpgradeToUta(params)
1134
1134
 
1135
- def convert_expire_date(self, date):
1136
- # parse YYMMDD to timestamp
1137
- year = date[0:2]
1138
- month = date[2:4]
1139
- day = date[4:6]
1140
- reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
1141
- return reconstructedDate
1142
-
1143
- def convert_expire_date_to_market_id_date(self, date):
1144
- # parse 231229 to 29DEC23
1145
- year = date[0:2]
1146
- monthRaw = date[2:4]
1147
- month = None
1148
- day = date[4:6]
1149
- if monthRaw == '01':
1150
- month = 'JAN'
1151
- elif monthRaw == '02':
1152
- month = 'FEB'
1153
- elif monthRaw == '03':
1154
- month = 'MAR'
1155
- elif monthRaw == '04':
1156
- month = 'APR'
1157
- elif monthRaw == '05':
1158
- month = 'MAY'
1159
- elif monthRaw == '06':
1160
- month = 'JUN'
1161
- elif monthRaw == '07':
1162
- month = 'JUL'
1163
- elif monthRaw == '08':
1164
- month = 'AUG'
1165
- elif monthRaw == '09':
1166
- month = 'SEP'
1167
- elif monthRaw == '10':
1168
- month = 'OCT'
1169
- elif monthRaw == '11':
1170
- month = 'NOV'
1171
- elif monthRaw == '12':
1172
- month = 'DEC'
1173
- reconstructedDate = day + month + year
1174
- return reconstructedDate
1175
-
1176
- def convert_market_id_expire_date(self, date):
1177
- # parse 22JAN23 to 230122
1178
- monthMappping = {
1179
- 'JAN': '01',
1180
- 'FEB': '02',
1181
- 'MAR': '03',
1182
- 'APR': '04',
1183
- 'MAY': '05',
1184
- 'JUN': '06',
1185
- 'JUL': '07',
1186
- 'AUG': '08',
1187
- 'SEP': '09',
1188
- 'OCT': '10',
1189
- 'NOV': '11',
1190
- 'DEC': '12',
1191
- }
1192
- year = date[0:2]
1193
- monthName = date[2:5]
1194
- month = self.safe_string(monthMappping, monthName)
1195
- day = date[5:7]
1196
- reconstructedDate = day + month + year
1197
- return reconstructedDate
1198
-
1199
1135
  def create_expired_option_market(self, symbol: str):
1200
1136
  # support expired option contracts
1201
1137
  quote = 'USD'
@@ -2040,7 +1976,7 @@ class bybit(Exchange, ImplicitAPI):
2040
1976
  #
2041
1977
  result = self.safe_value(response, 'result', [])
2042
1978
  tickers = self.safe_value(result, 'list', [])
2043
- rawTicker = self.safe_value(tickers, 0)
1979
+ rawTicker = self.safe_dict(tickers, 0)
2044
1980
  return self.parse_ticker(rawTicker, market)
2045
1981
 
2046
1982
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -2049,6 +1985,7 @@ class bybit(Exchange, ImplicitAPI):
2049
1985
  :see: https://bybit-exchange.github.io/docs/v5/market/tickers
2050
1986
  :param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2051
1987
  :param dict [params]: extra parameters specific to the exchange API endpoint
1988
+ :param str [params.subType]: *contract only* 'linear', 'inverse'
2052
1989
  :returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
2053
1990
  """
2054
1991
  self.load_markets()
@@ -2081,11 +2018,16 @@ class bybit(Exchange, ImplicitAPI):
2081
2018
  }
2082
2019
  type = None
2083
2020
  type, params = self.handle_market_type_and_params('fetchTickers', market, params)
2084
- if type == 'spot':
2021
+ # Calls like `.fetch_tickers(None, {subType:'inverse'})` should be supported for self exchange, so
2022
+ # as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2023
+ # with higher priority and only default to spot, if `subType` is not set in params
2024
+ passedSubType = self.safe_string(params, 'subType')
2025
+ subType = None
2026
+ subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
2027
+ # only if passedSubType is None, then use spot
2028
+ if type == 'spot' and passedSubType is None:
2085
2029
  request['category'] = 'spot'
2086
- elif type == 'swap' or type == 'future':
2087
- subType = None
2088
- subType, params = self.handle_sub_type_and_params('fetchTickers', market, params, 'linear')
2030
+ elif type == 'swap' or type == 'future' or subType is not None:
2089
2031
  request['category'] = subType
2090
2032
  elif type == 'option':
2091
2033
  request['category'] = 'option'
@@ -2129,7 +2071,7 @@ class bybit(Exchange, ImplicitAPI):
2129
2071
  # }
2130
2072
  #
2131
2073
  result = self.safe_value(response, 'result', {})
2132
- tickerList = self.safe_value(result, 'list', [])
2074
+ tickerList = self.safe_list(result, 'list', [])
2133
2075
  return self.parse_tickers(tickerList, parsedSymbols)
2134
2076
 
2135
2077
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -2252,7 +2194,7 @@ class bybit(Exchange, ImplicitAPI):
2252
2194
  # }
2253
2195
  #
2254
2196
  result = self.safe_value(response, 'result', {})
2255
- ohlcvs = self.safe_value(result, 'list', [])
2197
+ ohlcvs = self.safe_list(result, 'list', [])
2256
2198
  return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
2257
2199
 
2258
2200
  def parse_funding_rate(self, ticker, market: Market = None):
@@ -2686,7 +2628,7 @@ class bybit(Exchange, ImplicitAPI):
2686
2628
  # }
2687
2629
  #
2688
2630
  result = self.safe_value(response, 'result', {})
2689
- trades = self.safe_value(result, 'list', [])
2631
+ trades = self.safe_list(result, 'list', [])
2690
2632
  return self.parse_trades(trades, market, since, limit)
2691
2633
 
2692
2634
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
@@ -3381,7 +3323,7 @@ class bybit(Exchange, ImplicitAPI):
3381
3323
  # "time": 1672211918471
3382
3324
  # }
3383
3325
  #
3384
- order = self.safe_value(response, 'result', {})
3326
+ order = self.safe_dict(response, 'result', {})
3385
3327
  return self.parse_order(order, market)
3386
3328
 
3387
3329
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}, isUTA=True):
@@ -3762,7 +3704,7 @@ class bybit(Exchange, ImplicitAPI):
3762
3704
  # "tpTriggerBy":"UNKNOWN"
3763
3705
  # }
3764
3706
  #
3765
- order = self.safe_value(response, 'result', {})
3707
+ order = self.safe_dict(response, 'result', {})
3766
3708
  return self.parse_order(order, market)
3767
3709
 
3768
3710
  def edit_usdc_order(self, id, symbol, type, side, amount=None, price=None, params={}):
@@ -3810,7 +3752,7 @@ class bybit(Exchange, ImplicitAPI):
3810
3752
  # "retExtMap": {}
3811
3753
  # }
3812
3754
  #
3813
- result = self.safe_value(response, 'result', {})
3755
+ result = self.safe_dict(response, 'result', {})
3814
3756
  return self.parse_order(result, market)
3815
3757
 
3816
3758
  def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
@@ -3959,7 +3901,7 @@ class bybit(Exchange, ImplicitAPI):
3959
3901
  # "retExtMap": {}
3960
3902
  # }
3961
3903
  #
3962
- result = self.safe_value(response, 'result', {})
3904
+ result = self.safe_dict(response, 'result', {})
3963
3905
  return self.parse_order(result, market)
3964
3906
 
3965
3907
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -4017,7 +3959,7 @@ class bybit(Exchange, ImplicitAPI):
4017
3959
  # "time": 1672217377164
4018
3960
  # }
4019
3961
  #
4020
- result = self.safe_value(response, 'result', {})
3962
+ result = self.safe_dict(response, 'result', {})
4021
3963
  return self.parse_order(result, market)
4022
3964
 
4023
3965
  def cancel_orders(self, ids, symbol: Str = None, params={}):
@@ -4288,7 +4230,7 @@ class bybit(Exchange, ImplicitAPI):
4288
4230
  # }
4289
4231
  #
4290
4232
  result = self.safe_value(response, 'result', {})
4291
- data = self.safe_value(result, 'dataList', [])
4233
+ data = self.safe_list(result, 'dataList', [])
4292
4234
  return self.parse_orders(data, market, since, limit)
4293
4235
 
4294
4236
  def fetch_order_classic(self, id: str, symbol: Str = None, params={}):
@@ -4858,7 +4800,7 @@ class bybit(Exchange, ImplicitAPI):
4858
4800
  # }
4859
4801
  #
4860
4802
  result = self.safe_value(response, 'result', {})
4861
- dataList = self.safe_value(result, 'dataList', [])
4803
+ dataList = self.safe_list(result, 'dataList', [])
4862
4804
  return self.parse_trades(dataList, market, since, limit)
4863
4805
 
4864
4806
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -5049,7 +4991,7 @@ class bybit(Exchange, ImplicitAPI):
5049
4991
  chains = self.safe_value(result, 'chains', [])
5050
4992
  chainsIndexedById = self.index_by(chains, 'chain')
5051
4993
  selectedNetworkId = self.select_network_id_from_raw_networks(code, networkCode, chainsIndexedById)
5052
- addressObject = self.safe_value(chainsIndexedById, selectedNetworkId, {})
4994
+ addressObject = self.safe_dict(chainsIndexedById, selectedNetworkId, {})
5053
4995
  return self.parse_deposit_address(addressObject, currency)
5054
4996
 
5055
4997
  def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -5579,7 +5521,7 @@ class bybit(Exchange, ImplicitAPI):
5579
5521
  # "time": "1666892894902"
5580
5522
  # }
5581
5523
  #
5582
- result = self.safe_value(response, 'result', {})
5524
+ result = self.safe_dict(response, 'result', {})
5583
5525
  return self.parse_transaction(result, currency)
5584
5526
 
5585
5527
  def fetch_position(self, symbol: str, params={}):
@@ -5958,6 +5900,11 @@ class bybit(Exchange, ImplicitAPI):
5958
5900
  timestamp = self.parse8601(self.safe_string(position, 'updated_at'))
5959
5901
  if timestamp is None:
5960
5902
  timestamp = self.safe_integer_n(position, ['updatedTime', 'updatedAt'])
5903
+ tradeMode = self.safe_integer(position, 'tradeMode', 0)
5904
+ marginMode = None
5905
+ if (not self.options['enableUnifiedAccount']) or (self.options['enableUnifiedAccount'] and market['inverse']):
5906
+ # tradeMode would work for classic and UTA(inverse)
5907
+ marginMode = 'isolated' if (tradeMode == 1) else 'cross'
5961
5908
  collateralString = self.safe_string(position, 'positionBalance')
5962
5909
  entryPrice = self.omit_zero(self.safe_string_2(position, 'entryPrice', 'avgPrice'))
5963
5910
  liquidationPrice = self.omit_zero(self.safe_string(position, 'liqPrice'))
@@ -6014,7 +5961,7 @@ class bybit(Exchange, ImplicitAPI):
6014
5961
  'markPrice': self.safe_number(position, 'markPrice'),
6015
5962
  'lastPrice': None,
6016
5963
  'collateral': self.parse_number(collateralString),
6017
- 'marginMode': None,
5964
+ 'marginMode': marginMode,
6018
5965
  'side': side,
6019
5966
  'percentage': None,
6020
5967
  'stopLossPrice': self.safe_number_2(position, 'stop_loss', 'stopLoss'),
@@ -6985,7 +6932,7 @@ class bybit(Exchange, ImplicitAPI):
6985
6932
  # }
6986
6933
  #
6987
6934
  data = self.safe_value(response, 'result', {})
6988
- rows = self.safe_value(data, 'rows', [])
6935
+ rows = self.safe_list(data, 'rows', [])
6989
6936
  return self.parse_deposit_withdraw_fees(rows, codes, 'coin')
6990
6937
 
6991
6938
  def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
ccxt/coincheck.py CHANGED
@@ -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
  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
  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
  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):