ccxt 4.2.94__py2.py3-none-any.whl → 4.2.96__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 (185) hide show
  1. ccxt/__init__.py +2 -2
  2. ccxt/abstract/bitstamp.py +6 -0
  3. ccxt/abstract/coinbase.py +1 -0
  4. ccxt/ace.py +1 -1
  5. ccxt/ascendex.py +1 -1
  6. ccxt/async_support/__init__.py +2 -2
  7. ccxt/async_support/ace.py +1 -1
  8. ccxt/async_support/ascendex.py +1 -1
  9. ccxt/async_support/base/exchange.py +1 -1
  10. ccxt/async_support/bigone.py +1 -1
  11. ccxt/async_support/binance.py +3 -3
  12. ccxt/async_support/bingx.py +1 -1
  13. ccxt/async_support/bit2c.py +1 -1
  14. ccxt/async_support/bitbank.py +1 -1
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +1 -1
  17. ccxt/async_support/bitget.py +1 -1
  18. ccxt/async_support/bithumb.py +1 -1
  19. ccxt/async_support/bitmart.py +1 -1
  20. ccxt/async_support/bitmex.py +1 -1
  21. ccxt/async_support/bitopro.py +1 -1
  22. ccxt/async_support/bitrue.py +1 -1
  23. ccxt/async_support/bitso.py +1 -1
  24. ccxt/async_support/bitstamp.py +7 -1
  25. ccxt/async_support/bitteam.py +1 -1
  26. ccxt/async_support/bitvavo.py +1 -1
  27. ccxt/async_support/blockchaincom.py +1 -1
  28. ccxt/async_support/blofin.py +1 -1
  29. ccxt/async_support/btcalpha.py +1 -1
  30. ccxt/async_support/btcbox.py +1 -1
  31. ccxt/async_support/bybit.py +2 -2
  32. ccxt/async_support/cex.py +1 -1
  33. ccxt/async_support/coinbase.py +587 -103
  34. ccxt/async_support/coinbaseinternational.py +1 -1
  35. ccxt/async_support/coinbasepro.py +1 -1
  36. ccxt/async_support/coincheck.py +1 -1
  37. ccxt/async_support/coinex.py +62 -56
  38. ccxt/async_support/coinlist.py +1 -1
  39. ccxt/async_support/coinmate.py +1 -1
  40. ccxt/async_support/coinsph.py +1 -1
  41. ccxt/async_support/cryptocom.py +1 -1
  42. ccxt/async_support/currencycom.py +1 -1
  43. ccxt/async_support/delta.py +1 -1
  44. ccxt/async_support/deribit.py +1 -1
  45. ccxt/async_support/digifinex.py +1 -1
  46. ccxt/async_support/exmo.py +1 -1
  47. ccxt/async_support/gate.py +1 -1
  48. ccxt/async_support/gemini.py +27 -11
  49. ccxt/async_support/hitbtc.py +1 -1
  50. ccxt/async_support/hollaex.py +1 -1
  51. ccxt/async_support/htx.py +117 -116
  52. ccxt/async_support/huobijp.py +1 -1
  53. ccxt/async_support/idex.py +1 -1
  54. ccxt/async_support/indodax.py +1 -1
  55. ccxt/async_support/kraken.py +1 -1
  56. ccxt/async_support/krakenfutures.py +2 -2
  57. ccxt/async_support/kucoin.py +1 -1
  58. ccxt/async_support/kucoinfutures.py +1 -1
  59. ccxt/async_support/latoken.py +1 -1
  60. ccxt/async_support/lbank.py +1 -1
  61. ccxt/async_support/mexc.py +1 -1
  62. ccxt/async_support/ndax.py +1 -1
  63. ccxt/async_support/novadax.py +1 -1
  64. ccxt/async_support/oceanex.py +1 -1
  65. ccxt/async_support/okcoin.py +1 -1
  66. ccxt/async_support/okx.py +42 -42
  67. ccxt/async_support/onetrading.py +1 -1
  68. ccxt/async_support/p2b.py +1 -1
  69. ccxt/async_support/phemex.py +1 -1
  70. ccxt/async_support/poloniex.py +1 -1
  71. ccxt/async_support/poloniexfutures.py +1 -1
  72. ccxt/async_support/probit.py +1 -1
  73. ccxt/async_support/timex.py +1 -1
  74. ccxt/async_support/tokocrypto.py +1 -1
  75. ccxt/async_support/tradeogre.py +1 -1
  76. ccxt/async_support/upbit.py +2 -2
  77. ccxt/async_support/wavesexchange.py +1 -1
  78. ccxt/async_support/whitebit.py +1 -1
  79. ccxt/async_support/woo.py +1 -1
  80. ccxt/async_support/yobit.py +1 -1
  81. ccxt/async_support/zonda.py +1 -1
  82. ccxt/base/errors.py +7 -7
  83. ccxt/base/exchange.py +2 -2
  84. ccxt/bigone.py +1 -1
  85. ccxt/binance.py +3 -3
  86. ccxt/bingx.py +1 -1
  87. ccxt/bit2c.py +1 -1
  88. ccxt/bitbank.py +1 -1
  89. ccxt/bitfinex.py +1 -1
  90. ccxt/bitfinex2.py +1 -1
  91. ccxt/bitget.py +1 -1
  92. ccxt/bithumb.py +1 -1
  93. ccxt/bitmart.py +1 -1
  94. ccxt/bitmex.py +1 -1
  95. ccxt/bitopro.py +1 -1
  96. ccxt/bitrue.py +1 -1
  97. ccxt/bitso.py +1 -1
  98. ccxt/bitstamp.py +7 -1
  99. ccxt/bitteam.py +1 -1
  100. ccxt/bitvavo.py +1 -1
  101. ccxt/blockchaincom.py +1 -1
  102. ccxt/blofin.py +1 -1
  103. ccxt/btcalpha.py +1 -1
  104. ccxt/btcbox.py +1 -1
  105. ccxt/bybit.py +2 -2
  106. ccxt/cex.py +1 -1
  107. ccxt/coinbase.py +587 -103
  108. ccxt/coinbaseinternational.py +1 -1
  109. ccxt/coinbasepro.py +1 -1
  110. ccxt/coincheck.py +1 -1
  111. ccxt/coinex.py +62 -56
  112. ccxt/coinlist.py +1 -1
  113. ccxt/coinmate.py +1 -1
  114. ccxt/coinsph.py +1 -1
  115. ccxt/cryptocom.py +1 -1
  116. ccxt/currencycom.py +1 -1
  117. ccxt/delta.py +1 -1
  118. ccxt/deribit.py +1 -1
  119. ccxt/digifinex.py +1 -1
  120. ccxt/exmo.py +1 -1
  121. ccxt/gate.py +1 -1
  122. ccxt/gemini.py +27 -11
  123. ccxt/hitbtc.py +1 -1
  124. ccxt/hollaex.py +1 -1
  125. ccxt/htx.py +117 -116
  126. ccxt/huobijp.py +1 -1
  127. ccxt/idex.py +1 -1
  128. ccxt/indodax.py +1 -1
  129. ccxt/kraken.py +1 -1
  130. ccxt/krakenfutures.py +2 -2
  131. ccxt/kucoin.py +1 -1
  132. ccxt/kucoinfutures.py +1 -1
  133. ccxt/latoken.py +1 -1
  134. ccxt/lbank.py +1 -1
  135. ccxt/mexc.py +1 -1
  136. ccxt/ndax.py +1 -1
  137. ccxt/novadax.py +1 -1
  138. ccxt/oceanex.py +1 -1
  139. ccxt/okcoin.py +1 -1
  140. ccxt/okx.py +42 -42
  141. ccxt/onetrading.py +1 -1
  142. ccxt/p2b.py +1 -1
  143. ccxt/phemex.py +1 -1
  144. ccxt/poloniex.py +1 -1
  145. ccxt/poloniexfutures.py +1 -1
  146. ccxt/pro/__init__.py +1 -1
  147. ccxt/pro/ascendex.py +1 -1
  148. ccxt/pro/bitfinex2.py +1 -1
  149. ccxt/pro/bitget.py +1 -1
  150. ccxt/pro/bitmart.py +1 -1
  151. ccxt/pro/bitmex.py +1 -1
  152. ccxt/pro/bitstamp.py +1 -1
  153. ccxt/pro/bitvavo.py +1 -1
  154. ccxt/pro/blockchaincom.py +1 -1
  155. ccxt/pro/bybit.py +1 -1
  156. ccxt/pro/coinbase.py +31 -4
  157. ccxt/pro/coinbaseinternational.py +1 -1
  158. ccxt/pro/coinbasepro.py +1 -1
  159. ccxt/pro/coinex.py +1 -1
  160. ccxt/pro/cryptocom.py +1 -1
  161. ccxt/pro/gate.py +1 -1
  162. ccxt/pro/hitbtc.py +1 -1
  163. ccxt/pro/hollaex.py +1 -1
  164. ccxt/pro/htx.py +1 -1
  165. ccxt/pro/kraken.py +1 -1
  166. ccxt/pro/krakenfutures.py +1 -1
  167. ccxt/pro/okcoin.py +1 -1
  168. ccxt/pro/okx.py +1 -1
  169. ccxt/pro/poloniex.py +1 -1
  170. ccxt/pro/poloniexfutures.py +1 -1
  171. ccxt/pro/whitebit.py +1 -1
  172. ccxt/probit.py +1 -1
  173. ccxt/timex.py +1 -1
  174. ccxt/tokocrypto.py +1 -1
  175. ccxt/tradeogre.py +1 -1
  176. ccxt/upbit.py +2 -2
  177. ccxt/wavesexchange.py +1 -1
  178. ccxt/whitebit.py +1 -1
  179. ccxt/woo.py +1 -1
  180. ccxt/yobit.py +1 -1
  181. ccxt/zonda.py +1 -1
  182. {ccxt-4.2.94.dist-info → ccxt-4.2.96.dist-info}/METADATA +4 -4
  183. {ccxt-4.2.94.dist-info → ccxt-4.2.96.dist-info}/RECORD +185 -185
  184. {ccxt-4.2.94.dist-info → ccxt-4.2.96.dist-info}/WHEEL +0 -0
  185. {ccxt-4.2.94.dist-info → ccxt-4.2.96.dist-info}/top_level.txt +0 -0
ccxt/async_support/okx.py CHANGED
@@ -10,6 +10,7 @@ import hashlib
10
10
  from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import PermissionDenied
14
15
  from ccxt.base.errors import AccountNotEnabled
15
16
  from ccxt.base.errors import AccountSuspended
@@ -21,6 +22,7 @@ from ccxt.base.errors import InvalidAddress
21
22
  from ccxt.base.errors import InvalidOrder
22
23
  from ccxt.base.errors import OrderNotFound
23
24
  from ccxt.base.errors import CancelPending
25
+ from ccxt.base.errors import ContractUnavailable
24
26
  from ccxt.base.errors import NotSupported
25
27
  from ccxt.base.errors import NetworkError
26
28
  from ccxt.base.errors import RateLimitExceeded
@@ -28,8 +30,6 @@ from ccxt.base.errors import ExchangeNotAvailable
28
30
  from ccxt.base.errors import OnMaintenance
29
31
  from ccxt.base.errors import InvalidNonce
30
32
  from ccxt.base.errors import RequestTimeout
31
- from ccxt.base.errors import AuthenticationError
32
- from ccxt.base.errors import ContractUnavailable
33
33
  from ccxt.base.decimal_to_precision import TICK_SIZE
34
34
  from ccxt.base.precise import Precise
35
35
 
@@ -1139,7 +1139,7 @@ class okx(Exchange, ImplicitAPI):
1139
1139
  return super(okx, self).handle_market_type_and_params(methodName, market, params)
1140
1140
 
1141
1141
  def convert_to_instrument_type(self, type):
1142
- exchangeTypes = self.safe_value(self.options, 'exchangeType', {})
1142
+ exchangeTypes = self.safe_dict(self.options, 'exchangeType', {})
1143
1143
  return self.safe_string(exchangeTypes, type, type)
1144
1144
 
1145
1145
  def create_expired_option_market(self, symbol: str):
@@ -2773,7 +2773,7 @@ class okx(Exchange, ImplicitAPI):
2773
2773
  side = self.safe_string(rawOrder, 'side')
2774
2774
  amount = self.safe_value(rawOrder, 'amount')
2775
2775
  price = self.safe_value(rawOrder, 'price')
2776
- orderParams = self.safe_value(rawOrder, 'params', {})
2776
+ orderParams = self.safe_dict(rawOrder, 'params', {})
2777
2777
  extendedParams = self.extend(orderParams, params) # the request does not accept extra params since it's a list, so we're extending each order with the common params
2778
2778
  orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
2779
2779
  ordersRequests.append(orderRequest)
@@ -2935,8 +2935,8 @@ class okx(Exchange, ImplicitAPI):
2935
2935
  # "msg": ""
2936
2936
  # }
2937
2937
  #
2938
- data = self.safe_value(response, 'data', [])
2939
- first = self.safe_value(data, 0)
2938
+ data = self.safe_list(response, 'data', [])
2939
+ first = self.safe_dict(data, 0, {})
2940
2940
  order = self.parse_order(first, market)
2941
2941
  order['type'] = type
2942
2942
  order['side'] = side
@@ -4041,7 +4041,7 @@ class okx(Exchange, ImplicitAPI):
4041
4041
  paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
4042
4042
  if paginate:
4043
4043
  return await self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params)
4044
- options = self.safe_value(self.options, 'fetchLedger', {})
4044
+ options = self.safe_dict(self.options, 'fetchLedger', {})
4045
4045
  method = self.safe_string(options, 'method')
4046
4046
  method = self.safe_string(params, 'method', method)
4047
4047
  params = self.omit(params, 'method')
@@ -4356,7 +4356,7 @@ class okx(Exchange, ImplicitAPI):
4356
4356
  # ]
4357
4357
  # }
4358
4358
  #
4359
- data = self.safe_value(response, 'data', [])
4359
+ data = self.safe_list(response, 'data', [])
4360
4360
  filtered = self.filter_by(data, 'selected', True)
4361
4361
  parsed = self.parse_deposit_addresses(filtered, [currency['code']], False)
4362
4362
  return self.index_by(parsed, 'network')
@@ -4419,7 +4419,7 @@ class okx(Exchange, ImplicitAPI):
4419
4419
  }
4420
4420
  network = self.safe_string(params, 'network') # self line allows the user to specify either ERC20 or ETH
4421
4421
  if network is not None:
4422
- networks = self.safe_value(self.options, 'networks', {})
4422
+ networks = self.safe_dict(self.options, 'networks', {})
4423
4423
  network = self.safe_string(networks, network.upper(), network) # handle ETH>ERC20 alias
4424
4424
  request['chain'] = currency['id'] + '-' + network
4425
4425
  params = self.omit(params, 'network')
@@ -4427,7 +4427,7 @@ class okx(Exchange, ImplicitAPI):
4427
4427
  if fee is None:
4428
4428
  currencies = await self.fetch_currencies()
4429
4429
  self.currencies = self.deep_extend(self.currencies, currencies)
4430
- targetNetwork = self.safe_value(currency['networks'], self.network_id_to_code(network), {})
4430
+ targetNetwork = self.safe_dict(currency['networks'], self.network_id_to_code(network), {})
4431
4431
  fee = self.safe_string(targetNetwork, 'fee')
4432
4432
  if fee is None:
4433
4433
  raise ArgumentsRequired(self.id + ' withdraw() requires a "fee" string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set "0". Withdrawing to external digital asset address requires network transaction fee.')
@@ -4447,7 +4447,7 @@ class okx(Exchange, ImplicitAPI):
4447
4447
  # ]
4448
4448
  # }
4449
4449
  #
4450
- data = self.safe_value(response, 'data', [])
4450
+ data = self.safe_list(response, 'data', [])
4451
4451
  transaction = self.safe_dict(data, 0)
4452
4452
  return self.parse_transaction(transaction, currency)
4453
4453
 
@@ -4654,7 +4654,7 @@ class okx(Exchange, ImplicitAPI):
4654
4654
  # "msg": ''
4655
4655
  # }
4656
4656
  #
4657
- data = self.safe_value(response, 'data')
4657
+ data = self.safe_list(response, 'data', [])
4658
4658
  withdrawal = self.safe_dict(data, 0, {})
4659
4659
  return self.parse_transaction(withdrawal)
4660
4660
 
@@ -4926,8 +4926,8 @@ class okx(Exchange, ImplicitAPI):
4926
4926
  # ]
4927
4927
  # }
4928
4928
  #
4929
- data = self.safe_value(response, 'data', [])
4930
- position = self.safe_value(data, 0)
4929
+ data = self.safe_list(response, 'data', [])
4930
+ position = self.safe_dict(data, 0)
4931
4931
  if position is None:
4932
4932
  return None
4933
4933
  return self.parse_position(position, market)
@@ -4957,7 +4957,7 @@ class okx(Exchange, ImplicitAPI):
4957
4957
  marketIdsLength = len(marketIds)
4958
4958
  if marketIdsLength > 0:
4959
4959
  request['instId'] = ','.join(marketIds)
4960
- fetchPositionsOptions = self.safe_value(self.options, 'fetchPositions', {})
4960
+ fetchPositionsOptions = self.safe_dict(self.options, 'fetchPositions', {})
4961
4961
  method = self.safe_string(fetchPositionsOptions, 'method', 'privateGetAccountPositions')
4962
4962
  response = None
4963
4963
  if method == 'privateGetAccountPositionsHistory':
@@ -5010,7 +5010,7 @@ class okx(Exchange, ImplicitAPI):
5010
5010
  # ]
5011
5011
  # }
5012
5012
  #
5013
- positions = self.safe_value(response, 'data', [])
5013
+ positions = self.safe_list(response, 'data', [])
5014
5014
  result = []
5015
5015
  for i in range(0, len(positions)):
5016
5016
  result.append(self.parse_position(positions[i]))
@@ -5198,7 +5198,7 @@ class okx(Exchange, ImplicitAPI):
5198
5198
  """
5199
5199
  await self.load_markets()
5200
5200
  currency = self.currency(code)
5201
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
5201
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
5202
5202
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
5203
5203
  toId = self.safe_string(accountsByType, toAccount, toAccount)
5204
5204
  request = {
@@ -5238,7 +5238,7 @@ class okx(Exchange, ImplicitAPI):
5238
5238
  # ]
5239
5239
  # }
5240
5240
  #
5241
- data = self.safe_value(response, 'data', [])
5241
+ data = self.safe_list(response, 'data', [])
5242
5242
  rawTransfer = self.safe_dict(data, 0, {})
5243
5243
  return self.parse_transfer(rawTransfer, currency)
5244
5244
 
@@ -5301,7 +5301,7 @@ class okx(Exchange, ImplicitAPI):
5301
5301
  amount = self.safe_number(transfer, 'amt')
5302
5302
  fromAccountId = self.safe_string(transfer, 'from')
5303
5303
  toAccountId = self.safe_string(transfer, 'to')
5304
- accountsById = self.safe_value(self.options, 'accountsById', {})
5304
+ accountsById = self.safe_dict(self.options, 'accountsById', {})
5305
5305
  timestamp = self.safe_integer(transfer, 'ts')
5306
5306
  balanceChange = self.safe_string(transfer, 'sz')
5307
5307
  if balanceChange is not None:
@@ -5351,7 +5351,7 @@ class okx(Exchange, ImplicitAPI):
5351
5351
  # "msg": ""
5352
5352
  # }
5353
5353
  #
5354
- data = self.safe_value(response, 'data', [])
5354
+ data = self.safe_list(response, 'data', [])
5355
5355
  transfer = self.safe_dict(data, 0)
5356
5356
  return self.parse_transfer(transfer)
5357
5357
 
@@ -5536,8 +5536,8 @@ class okx(Exchange, ImplicitAPI):
5536
5536
  # "msg": ""
5537
5537
  # }
5538
5538
  #
5539
- data = self.safe_value(response, 'data', [])
5540
- entry = self.safe_value(data, 0, {})
5539
+ data = self.safe_list(response, 'data', [])
5540
+ entry = self.safe_dict(data, 0, {})
5541
5541
  return self.parse_funding_rate(entry, market)
5542
5542
 
5543
5543
  async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -5669,7 +5669,7 @@ class okx(Exchange, ImplicitAPI):
5669
5669
  # "type": "8"
5670
5670
  # }
5671
5671
  #
5672
- data = self.safe_value(response, 'data', [])
5672
+ data = self.safe_list(response, 'data', [])
5673
5673
  result = []
5674
5674
  for i in range(0, len(data)):
5675
5675
  entry = data[i]
@@ -5840,7 +5840,7 @@ class okx(Exchange, ImplicitAPI):
5840
5840
  # ],
5841
5841
  # }
5842
5842
  #
5843
- data = self.safe_value(response, 'data', [])
5843
+ data = self.safe_list(response, 'data', [])
5844
5844
  rates = []
5845
5845
  for i in range(0, len(data)):
5846
5846
  rates.append(self.parse_borrow_rate(data[i]))
@@ -5873,8 +5873,8 @@ class okx(Exchange, ImplicitAPI):
5873
5873
  # "msg": ""
5874
5874
  # }
5875
5875
  #
5876
- data = self.safe_value(response, 'data')
5877
- rate = self.safe_value(data, 0)
5876
+ data = self.safe_list(response, 'data', [])
5877
+ rate = self.safe_dict(data, 0, {})
5878
5878
  return self.parse_borrow_rate(rate)
5879
5879
 
5880
5880
  def parse_borrow_rate(self, info, currency: Currency = None):
@@ -5969,7 +5969,7 @@ class okx(Exchange, ImplicitAPI):
5969
5969
  # "msg": ""
5970
5970
  # }
5971
5971
  #
5972
- data = self.safe_value(response, 'data')
5972
+ data = self.safe_list(response, 'data', [])
5973
5973
  return self.parse_borrow_rate_histories(data, codes, since, limit)
5974
5974
 
5975
5975
  async def fetch_borrow_rate_history(self, code: str, since: Int = None, limit: Int = None, params={}):
@@ -6009,7 +6009,7 @@ class okx(Exchange, ImplicitAPI):
6009
6009
  # "msg": ""
6010
6010
  # }
6011
6011
  #
6012
- data = self.safe_value(response, 'data')
6012
+ data = self.safe_list(response, 'data', [])
6013
6013
  return self.parse_borrow_rate_history(data, code, since, limit)
6014
6014
 
6015
6015
  async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
@@ -6189,7 +6189,7 @@ class okx(Exchange, ImplicitAPI):
6189
6189
  # ]
6190
6190
  # }
6191
6191
  #
6192
- data = self.safe_value(response, 'data')
6192
+ data = self.safe_list(response, 'data', [])
6193
6193
  return self.parse_market_leverage_tiers(data, market)
6194
6194
 
6195
6195
  def parse_market_leverage_tiers(self, info, market: Market = None):
@@ -6282,7 +6282,7 @@ class okx(Exchange, ImplicitAPI):
6282
6282
  # "msg": ""
6283
6283
  # }
6284
6284
  #
6285
- data = self.safe_value(response, 'data')
6285
+ data = self.safe_list(response, 'data', [])
6286
6286
  interest = self.parse_borrow_interests(data)
6287
6287
  return self.filter_by_currency_since_limit(interest, code, since, limit)
6288
6288
 
@@ -6335,8 +6335,8 @@ class okx(Exchange, ImplicitAPI):
6335
6335
  # "msg": ""
6336
6336
  # }
6337
6337
  #
6338
- data = self.safe_value(response, 'data', [])
6339
- loan = self.safe_value(data, 0)
6338
+ data = self.safe_list(response, 'data', [])
6339
+ loan = self.safe_dict(data, 0, {})
6340
6340
  return self.parse_margin_loan(loan, currency)
6341
6341
 
6342
6342
  async def repay_cross_margin(self, code: str, amount, params={}):
@@ -6377,8 +6377,8 @@ class okx(Exchange, ImplicitAPI):
6377
6377
  # "msg": ""
6378
6378
  # }
6379
6379
  #
6380
- data = self.safe_value(response, 'data', [])
6381
- loan = self.safe_value(data, 0)
6380
+ data = self.safe_list(response, 'data', [])
6381
+ loan = self.safe_dict(data, 0, {})
6382
6382
  return self.parse_margin_loan(loan, currency)
6383
6383
 
6384
6384
  def parse_margin_loan(self, info, currency: Currency = None):
@@ -6455,8 +6455,8 @@ class okx(Exchange, ImplicitAPI):
6455
6455
  :param int [params.until]: The time in ms of the latest record to retrieve unix timestamp
6456
6456
  :returns: An array of `open interest structures <https://docs.ccxt.com/#/?id=open-interest-structure>`
6457
6457
  """
6458
- options = self.safe_value(self.options, 'fetchOpenInterestHistory', {})
6459
- timeframes = self.safe_value(options, 'timeframes', {})
6458
+ options = self.safe_dict(self.options, 'fetchOpenInterestHistory', {})
6459
+ timeframes = self.safe_dict(options, 'timeframes', {})
6460
6460
  timeframe = self.safe_string(timeframes, timeframe, timeframe)
6461
6461
  if timeframe != '5m' and timeframe != '1H' and timeframe != '1D':
6462
6462
  raise BadRequest(self.id + ' fetchOpenInterestHistory cannot only use the 5m, 1h, and 1d timeframe')
@@ -6721,7 +6721,7 @@ class okx(Exchange, ImplicitAPI):
6721
6721
  # "msg": ""
6722
6722
  # }
6723
6723
  #
6724
- data = self.safe_value(response, 'data', [])
6724
+ data = self.safe_list(response, 'data', [])
6725
6725
  settlements = self.parse_settlements(data, market)
6726
6726
  sorted = self.sort_by(settlements, 'timestamp')
6727
6727
  return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
@@ -6760,7 +6760,7 @@ class okx(Exchange, ImplicitAPI):
6760
6760
  for i in range(0, len(settlements)):
6761
6761
  entry = settlements[i]
6762
6762
  timestamp = self.safe_integer(entry, 'ts')
6763
- details = self.safe_value(entry, 'details', [])
6763
+ details = self.safe_list(entry, 'details', [])
6764
6764
  for j in range(0, len(details)):
6765
6765
  settlement = self.parse_settlement(details[j], market)
6766
6766
  result.append(self.extend(settlement, {
@@ -6800,7 +6800,7 @@ class okx(Exchange, ImplicitAPI):
6800
6800
  # "msg": ""
6801
6801
  # }
6802
6802
  #
6803
- underlyings = self.safe_value(response, 'data', [])
6803
+ underlyings = self.safe_list(response, 'data', [])
6804
6804
  return underlyings[0]
6805
6805
 
6806
6806
  async def fetch_greeks(self, symbol: str, params={}) -> Greeks:
@@ -6850,7 +6850,7 @@ class okx(Exchange, ImplicitAPI):
6850
6850
  # "msg": ""
6851
6851
  # }
6852
6852
  #
6853
- data = self.safe_value(response, 'data', [])
6853
+ data = self.safe_list(response, 'data', [])
6854
6854
  for i in range(0, len(data)):
6855
6855
  entry = data[i]
6856
6856
  entryMarketId = self.safe_string(entry, 'instId')
@@ -6963,7 +6963,7 @@ class okx(Exchange, ImplicitAPI):
6963
6963
  # "outTime": "1701877077102579"
6964
6964
  # }
6965
6965
  #
6966
- data = self.safe_value(response, 'data')
6966
+ data = self.safe_list(response, 'data', [])
6967
6967
  order = self.safe_dict(data, 0)
6968
6968
  return self.parse_order(order, market)
6969
6969
 
@@ -7272,7 +7272,7 @@ class okx(Exchange, ImplicitAPI):
7272
7272
  code = self.safe_string(response, 'code')
7273
7273
  if (code != '0') and (code != '2'): # 2 means that bulk operation partially succeeded
7274
7274
  feedback = self.id + ' ' + body
7275
- data = self.safe_value(response, 'data', [])
7275
+ data = self.safe_list(response, 'data', [])
7276
7276
  for i in range(0, len(data)):
7277
7277
  error = data[i]
7278
7278
  errorCode = self.safe_string(error, 'sCode')
@@ -8,6 +8,7 @@ from ccxt.abstract.onetrading import ImplicitAPI
8
8
  from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import PermissionDenied
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
@@ -17,7 +18,6 @@ from ccxt.base.errors import InvalidOrder
17
18
  from ccxt.base.errors import OrderNotFound
18
19
  from ccxt.base.errors import DDoSProtection
19
20
  from ccxt.base.errors import ExchangeNotAvailable
20
- from ccxt.base.errors import AuthenticationError
21
21
  from ccxt.base.decimal_to_precision import TICK_SIZE
22
22
  from ccxt.base.precise import Precise
23
23
 
ccxt/async_support/p2b.py CHANGED
@@ -8,11 +8,11 @@ from ccxt.abstract.p2b import ImplicitAPI
8
8
  import hashlib
9
9
  from ccxt.base.types import Int, Market, Num, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers
10
10
  from typing import List
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import ArgumentsRequired
12
13
  from ccxt.base.errors import BadRequest
13
14
  from ccxt.base.errors import InsufficientFunds
14
15
  from ccxt.base.errors import ExchangeNotAvailable
15
- from ccxt.base.errors import AuthenticationError
16
16
  from ccxt.base.decimal_to_precision import TICK_SIZE
17
17
 
18
18
 
@@ -10,6 +10,7 @@ import numbers
10
10
  from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import PermissionDenied
14
15
  from ccxt.base.errors import AccountSuspended
15
16
  from ccxt.base.errors import ArgumentsRequired
@@ -23,7 +24,6 @@ from ccxt.base.errors import DuplicateOrderId
23
24
  from ccxt.base.errors import NotSupported
24
25
  from ccxt.base.errors import DDoSProtection
25
26
  from ccxt.base.errors import RateLimitExceeded
26
- from ccxt.base.errors import AuthenticationError
27
27
  from ccxt.base.decimal_to_precision import TICK_SIZE
28
28
  from ccxt.base.precise import Precise
29
29
 
@@ -9,6 +9,7 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import PermissionDenied
13
14
  from ccxt.base.errors import AccountSuspended
14
15
  from ccxt.base.errors import ArgumentsRequired
@@ -21,7 +22,6 @@ from ccxt.base.errors import NotSupported
21
22
  from ccxt.base.errors import ExchangeNotAvailable
22
23
  from ccxt.base.errors import OnMaintenance
23
24
  from ccxt.base.errors import RequestTimeout
24
- from ccxt.base.errors import AuthenticationError
25
25
  from ccxt.base.decimal_to_precision import TICK_SIZE
26
26
  from ccxt.base.precise import Precise
27
27
 
@@ -8,6 +8,7 @@ from ccxt.abstract.poloniexfutures import ImplicitAPI
8
8
  import hashlib
9
9
  from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
10
10
  from typing import List
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import AccountSuspended
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
@@ -17,7 +18,6 @@ from ccxt.base.errors import NotSupported
17
18
  from ccxt.base.errors import RateLimitExceeded
18
19
  from ccxt.base.errors import ExchangeNotAvailable
19
20
  from ccxt.base.errors import InvalidNonce
20
- from ccxt.base.errors import AuthenticationError
21
21
  from ccxt.base.decimal_to_precision import TICK_SIZE
22
22
  from ccxt.base.precise import Precise
23
23
 
@@ -9,6 +9,7 @@ import math
9
9
  from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import BadSymbol
@@ -19,7 +20,6 @@ from ccxt.base.errors import InvalidOrder
19
20
  from ccxt.base.errors import DDoSProtection
20
21
  from ccxt.base.errors import RateLimitExceeded
21
22
  from ccxt.base.errors import ExchangeNotAvailable
22
- from ccxt.base.errors import AuthenticationError
23
23
  from ccxt.base.decimal_to_precision import TRUNCATE
24
24
  from ccxt.base.decimal_to_precision import TICK_SIZE
25
25
  from ccxt.base.precise import Precise
@@ -8,6 +8,7 @@ from ccxt.abstract.timex import ImplicitAPI
8
8
  from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import PermissionDenied
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
@@ -17,7 +18,6 @@ from ccxt.base.errors import OrderNotFound
17
18
  from ccxt.base.errors import NotSupported
18
19
  from ccxt.base.errors import RateLimitExceeded
19
20
  from ccxt.base.errors import ExchangeNotAvailable
20
- from ccxt.base.errors import AuthenticationError
21
21
  from ccxt.base.decimal_to_precision import TICK_SIZE
22
22
  from ccxt.base.precise import Precise
23
23
 
@@ -10,6 +10,7 @@ import json
10
10
  from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import PermissionDenied
14
15
  from ccxt.base.errors import AccountSuspended
15
16
  from ccxt.base.errors import ArgumentsRequired
@@ -29,7 +30,6 @@ from ccxt.base.errors import ExchangeNotAvailable
29
30
  from ccxt.base.errors import OnMaintenance
30
31
  from ccxt.base.errors import InvalidNonce
31
32
  from ccxt.base.errors import RequestTimeout
32
- from ccxt.base.errors import AuthenticationError
33
33
  from ccxt.base.decimal_to_precision import TRUNCATE
34
34
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
35
35
  from ccxt.base.precise import Precise
@@ -8,9 +8,9 @@ from ccxt.abstract.tradeogre import ImplicitAPI
8
8
  from ccxt.base.types import IndexType, Int, Market, Num, Order, OrderSide, OrderType, Str, Ticker
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import BadRequest
12
13
  from ccxt.base.errors import InsufficientFunds
13
- from ccxt.base.errors import AuthenticationError
14
14
  from ccxt.base.decimal_to_precision import TICK_SIZE
15
15
 
16
16
 
@@ -8,14 +8,14 @@ from ccxt.abstract.upbit import ImplicitAPI
8
8
  from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import PermissionDenied
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InsufficientFunds
16
+ from ccxt.base.errors import AddressPending
15
17
  from ccxt.base.errors import InvalidOrder
16
18
  from ccxt.base.errors import OrderNotFound
17
- from ccxt.base.errors import AuthenticationError
18
- from ccxt.base.errors import AddressPending
19
19
  from ccxt.base.decimal_to_precision import TICK_SIZE
20
20
  from ccxt.base.precise import Precise
21
21
 
@@ -11,6 +11,7 @@ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBo
11
11
  from typing import List
12
12
  from typing import Any
13
13
  from ccxt.base.errors import ExchangeError
14
+ from ccxt.base.errors import AuthenticationError
14
15
  from ccxt.base.errors import AccountSuspended
15
16
  from ccxt.base.errors import ArgumentsRequired
16
17
  from ccxt.base.errors import BadRequest
@@ -20,7 +21,6 @@ from ccxt.base.errors import InvalidOrder
20
21
  from ccxt.base.errors import OrderNotFound
21
22
  from ccxt.base.errors import DuplicateOrderId
22
23
  from ccxt.base.errors import ExchangeNotAvailable
23
- from ccxt.base.errors import AuthenticationError
24
24
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
25
25
  from ccxt.base.precise import Precise
26
26
 
@@ -9,6 +9,7 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import PermissionDenied
13
14
  from ccxt.base.errors import ArgumentsRequired
14
15
  from ccxt.base.errors import BadRequest
@@ -19,7 +20,6 @@ from ccxt.base.errors import OrderNotFound
19
20
  from ccxt.base.errors import NotSupported
20
21
  from ccxt.base.errors import DDoSProtection
21
22
  from ccxt.base.errors import ExchangeNotAvailable
22
- from ccxt.base.errors import AuthenticationError
23
23
  from ccxt.base.decimal_to_precision import TICK_SIZE
24
24
  from ccxt.base.precise import Precise
25
25
 
ccxt/async_support/woo.py CHANGED
@@ -9,13 +9,13 @@ import hashlib
9
9
  from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InvalidOrder
15
16
  from ccxt.base.errors import NotSupported
16
17
  from ccxt.base.errors import RateLimitExceeded
17
18
  from ccxt.base.errors import OnMaintenance
18
- from ccxt.base.errors import AuthenticationError
19
19
  from ccxt.base.decimal_to_precision import TICK_SIZE
20
20
  from ccxt.base.precise import Precise
21
21
 
@@ -9,6 +9,7 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import InsufficientFunds
14
15
  from ccxt.base.errors import InvalidOrder
@@ -17,7 +18,6 @@ from ccxt.base.errors import DDoSProtection
17
18
  from ccxt.base.errors import RateLimitExceeded
18
19
  from ccxt.base.errors import ExchangeNotAvailable
19
20
  from ccxt.base.errors import InvalidNonce
20
- from ccxt.base.errors import AuthenticationError
21
21
  from ccxt.base.decimal_to_precision import TICK_SIZE
22
22
  from ccxt.base.precise import Precise
23
23
 
@@ -9,6 +9,7 @@ import hashlib
9
9
  from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import PermissionDenied
13
14
  from ccxt.base.errors import AccountSuspended
14
15
  from ccxt.base.errors import BadRequest
@@ -20,7 +21,6 @@ from ccxt.base.errors import OrderImmediatelyFillable
20
21
  from ccxt.base.errors import RateLimitExceeded
21
22
  from ccxt.base.errors import OnMaintenance
22
23
  from ccxt.base.errors import InvalidNonce
23
- from ccxt.base.errors import AuthenticationError
24
24
  from ccxt.base.decimal_to_precision import TICK_SIZE
25
25
  from ccxt.base.precise import Precise
26
26
 
ccxt/base/errors.py CHANGED
@@ -34,6 +34,7 @@ error_hierarchy = {
34
34
  },
35
35
  'NotSupported': {},
36
36
  'ProxyError': {},
37
+ 'ExchangeClosedByUser': {},
37
38
  },
38
39
  'OperationFailed': {
39
40
  'NetworkError': {
@@ -46,7 +47,6 @@ error_hierarchy = {
46
47
  'RequestTimeout': {},
47
48
  },
48
49
  },
49
- 'ExchangeClosedByUser': {},
50
50
  },
51
51
  }
52
52
 
@@ -159,6 +159,10 @@ class ProxyError(ExchangeError):
159
159
  pass
160
160
 
161
161
 
162
+ class ExchangeClosedByUser(ExchangeError):
163
+ pass
164
+
165
+
162
166
  class OperationFailed(BaseError):
163
167
  pass
164
168
 
@@ -191,10 +195,6 @@ class RequestTimeout(NetworkError):
191
195
  pass
192
196
 
193
197
 
194
- class ExchangeClosedByUser(BaseError):
195
- pass
196
-
197
-
198
198
  __all__ = [
199
199
  'error_hierarchy',
200
200
  'BaseError',
@@ -224,6 +224,7 @@ __all__ = [
224
224
  'ContractUnavailable',
225
225
  'NotSupported',
226
226
  'ProxyError',
227
+ 'ExchangeClosedByUser',
227
228
  'OperationFailed',
228
229
  'NetworkError',
229
230
  'DDoSProtection',
@@ -231,6 +232,5 @@ __all__ = [
231
232
  'ExchangeNotAvailable',
232
233
  'OnMaintenance',
233
234
  'InvalidNonce',
234
- 'RequestTimeout',
235
- 'ExchangeClosedByUser'
235
+ 'RequestTimeout'
236
236
  ]
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.94'
7
+ __version__ = '4.2.96'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1341,7 +1341,7 @@ class Exchange(object):
1341
1341
  signature = Exchange.base64_to_binary(Exchange.rsa(token, Exchange.decode(secret), algorithm))
1342
1342
  elif algoType == 'ES':
1343
1343
  rawSignature = Exchange.ecdsa(token, secret, 'p256', algorithm)
1344
- signature = Exchange.base16_to_binary(rawSignature['r'] + rawSignature['s'])
1344
+ signature = Exchange.base16_to_binary(rawSignature['r'].rjust(64, "0") + rawSignature['s'].rjust(64, "0"))
1345
1345
  else:
1346
1346
  signature = Exchange.hmac(Exchange.encode(token), secret, algos[algorithm], 'binary')
1347
1347
  return token + '.' + Exchange.base64urlencode(signature)
ccxt/bigone.py CHANGED
@@ -8,6 +8,7 @@ from ccxt.abstract.bigone import ImplicitAPI
8
8
  from ccxt.base.types import Balances, Bool, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
+ from ccxt.base.errors import AuthenticationError
11
12
  from ccxt.base.errors import PermissionDenied
12
13
  from ccxt.base.errors import ArgumentsRequired
13
14
  from ccxt.base.errors import BadRequest
@@ -16,7 +17,6 @@ from ccxt.base.errors import InsufficientFunds
16
17
  from ccxt.base.errors import InvalidOrder
17
18
  from ccxt.base.errors import NotSupported
18
19
  from ccxt.base.errors import RateLimitExceeded
19
- from ccxt.base.errors import AuthenticationError
20
20
  from ccxt.base.decimal_to_precision import TICK_SIZE
21
21
  from ccxt.base.precise import Precise
22
22