ccxt 4.2.29__py2.py3-none-any.whl → 4.2.31__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 (133) hide show
  1. ccxt/__init__.py +3 -3
  2. ccxt/abstract/bybit.py +2 -2
  3. ccxt/abstract/coinbase.py +10 -0
  4. ccxt/abstract/okx.py +12 -1
  5. ccxt/ascendex.py +5 -5
  6. ccxt/async_support/__init__.py +3 -3
  7. ccxt/async_support/ascendex.py +5 -5
  8. ccxt/async_support/base/exchange.py +3 -3
  9. ccxt/async_support/bigone.py +2 -2
  10. ccxt/async_support/binance.py +892 -218
  11. ccxt/async_support/bingx.py +1 -1
  12. ccxt/async_support/bitfinex.py +1 -1
  13. ccxt/async_support/bitfinex2.py +421 -86
  14. ccxt/async_support/bitforex.py +3 -0
  15. ccxt/async_support/bitget.py +8 -4
  16. ccxt/async_support/bitmart.py +3 -3
  17. ccxt/async_support/bitmex.py +4 -4
  18. ccxt/async_support/bitrue.py +1 -1
  19. ccxt/async_support/bitso.py +1 -1
  20. ccxt/async_support/bitteam.py +2 -2
  21. ccxt/async_support/btcalpha.py +1 -1
  22. ccxt/async_support/bybit.py +3 -3
  23. ccxt/async_support/coinbase.py +20 -5
  24. ccxt/async_support/coincheck.py +1 -1
  25. ccxt/async_support/coinex.py +2 -2
  26. ccxt/async_support/coinlist.py +1 -1
  27. ccxt/async_support/coinmate.py +1 -1
  28. ccxt/async_support/coinmetro.py +2 -2
  29. ccxt/async_support/coinsph.py +1 -1
  30. ccxt/async_support/cryptocom.py +3 -3
  31. ccxt/async_support/deribit.py +1 -0
  32. ccxt/async_support/digifinex.py +6 -4
  33. ccxt/async_support/exmo.py +2 -2
  34. ccxt/async_support/gate.py +5 -5
  35. ccxt/async_support/gemini.py +3 -3
  36. ccxt/async_support/hitbtc.py +13 -17
  37. ccxt/async_support/hollaex.py +2 -2
  38. ccxt/async_support/htx.py +6 -6
  39. ccxt/async_support/huobijp.py +1 -1
  40. ccxt/async_support/kraken.py +3 -1
  41. ccxt/async_support/krakenfutures.py +4 -1
  42. ccxt/async_support/kucoin.py +17 -17
  43. ccxt/async_support/kucoinfutures.py +3 -3
  44. ccxt/async_support/lbank.py +4 -3
  45. ccxt/async_support/mexc.py +7 -7
  46. ccxt/async_support/novadax.py +1 -1
  47. ccxt/async_support/okcoin.py +2 -2
  48. ccxt/async_support/okx.py +22 -8
  49. ccxt/async_support/p2b.py +1 -0
  50. ccxt/async_support/phemex.py +3 -3
  51. ccxt/async_support/poloniexfutures.py +6 -3
  52. ccxt/async_support/probit.py +1 -1
  53. ccxt/async_support/timex.py +2 -2
  54. ccxt/async_support/tokocrypto.py +3 -3
  55. ccxt/async_support/wavesexchange.py +2 -2
  56. ccxt/async_support/whitebit.py +3 -3
  57. ccxt/async_support/woo.py +3 -3
  58. ccxt/async_support/yobit.py +1 -1
  59. ccxt/async_support/zaif.py +1 -1
  60. ccxt/async_support/zonda.py +3 -3
  61. ccxt/base/errors.py +13 -12
  62. ccxt/base/exchange.py +36 -26
  63. ccxt/bigone.py +2 -2
  64. ccxt/binance.py +892 -218
  65. ccxt/bingx.py +1 -1
  66. ccxt/bitfinex.py +1 -1
  67. ccxt/bitfinex2.py +421 -86
  68. ccxt/bitforex.py +3 -0
  69. ccxt/bitget.py +8 -4
  70. ccxt/bitmart.py +3 -3
  71. ccxt/bitmex.py +4 -4
  72. ccxt/bitrue.py +1 -1
  73. ccxt/bitso.py +1 -1
  74. ccxt/bitteam.py +2 -2
  75. ccxt/btcalpha.py +1 -1
  76. ccxt/bybit.py +3 -3
  77. ccxt/coinbase.py +20 -5
  78. ccxt/coincheck.py +1 -1
  79. ccxt/coinex.py +2 -2
  80. ccxt/coinlist.py +1 -1
  81. ccxt/coinmate.py +1 -1
  82. ccxt/coinmetro.py +2 -2
  83. ccxt/coinsph.py +1 -1
  84. ccxt/cryptocom.py +3 -3
  85. ccxt/deribit.py +1 -0
  86. ccxt/digifinex.py +6 -4
  87. ccxt/exmo.py +2 -2
  88. ccxt/gate.py +5 -5
  89. ccxt/gemini.py +3 -3
  90. ccxt/hitbtc.py +13 -17
  91. ccxt/hollaex.py +2 -2
  92. ccxt/htx.py +6 -6
  93. ccxt/huobijp.py +1 -1
  94. ccxt/kraken.py +3 -1
  95. ccxt/krakenfutures.py +4 -1
  96. ccxt/kucoin.py +17 -17
  97. ccxt/kucoinfutures.py +3 -3
  98. ccxt/lbank.py +4 -3
  99. ccxt/mexc.py +7 -7
  100. ccxt/novadax.py +1 -1
  101. ccxt/okcoin.py +2 -2
  102. ccxt/okx.py +22 -8
  103. ccxt/p2b.py +1 -0
  104. ccxt/phemex.py +3 -3
  105. ccxt/poloniexfutures.py +6 -3
  106. ccxt/pro/__init__.py +3 -1
  107. ccxt/pro/alpaca.py +1 -1
  108. ccxt/pro/binance.py +4 -4
  109. ccxt/pro/bitget.py +1 -1
  110. ccxt/pro/bitmart.py +1 -1
  111. ccxt/pro/bitmex.py +43 -7
  112. ccxt/pro/bitvavo.py +1 -1
  113. ccxt/pro/bybit.py +2 -2
  114. ccxt/pro/cex.py +2 -2
  115. ccxt/pro/independentreserve.py +1 -1
  116. ccxt/pro/okx.py +1 -1
  117. ccxt/pro/onetrading.py +2 -2
  118. ccxt/pro/p2b.py +407 -0
  119. ccxt/pro/probit.py +5 -5
  120. ccxt/pro/whitebit.py +1 -1
  121. ccxt/probit.py +1 -1
  122. ccxt/timex.py +2 -2
  123. ccxt/tokocrypto.py +3 -3
  124. ccxt/wavesexchange.py +2 -2
  125. ccxt/whitebit.py +3 -3
  126. ccxt/woo.py +3 -3
  127. ccxt/yobit.py +1 -1
  128. ccxt/zaif.py +1 -1
  129. ccxt/zonda.py +3 -3
  130. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/METADATA +6 -7
  131. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/RECORD +133 -132
  132. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/WHEEL +0 -0
  133. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/top_level.txt +0 -0
ccxt/async_support/htx.py CHANGED
@@ -3741,7 +3741,7 @@ class htx(Exchange, ImplicitAPI):
3741
3741
  response = None
3742
3742
  stop = self.safe_value(params, 'stop')
3743
3743
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
3744
- trailing = self.safe_value(params, 'trailing', False)
3744
+ trailing = self.safe_bool(params, 'trailing', False)
3745
3745
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
3746
3746
  if stop or stopLossTakeProfit or trailing:
3747
3747
  if limit is not None:
@@ -4065,7 +4065,7 @@ class htx(Exchange, ImplicitAPI):
4065
4065
  request['contract_code'] = market['id']
4066
4066
  stop = self.safe_value(params, 'stop')
4067
4067
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
4068
- trailing = self.safe_value(params, 'trailing', False)
4068
+ trailing = self.safe_bool(params, 'trailing', False)
4069
4069
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
4070
4070
  if market['linear']:
4071
4071
  marginMode = None
@@ -4692,7 +4692,7 @@ class htx(Exchange, ImplicitAPI):
4692
4692
  marketId = self.safe_string_2(order, 'contract_code', 'symbol')
4693
4693
  market = self.safe_market(marketId, market)
4694
4694
  timestamp = self.safe_integer_n(order, ['created_at', 'created-at', 'create_date'])
4695
- clientOrderId = self.safe_string_2(order, 'client_order_id', 'client-order-id')
4695
+ clientOrderId = self.safe_string_2(order, 'client_order_id', 'client-or' + 'der-id') # transpiler regex trick for php issue
4696
4696
  cost = None
4697
4697
  amount = None
4698
4698
  if (type is not None) and (type.find('market') >= 0):
@@ -5297,7 +5297,7 @@ class htx(Exchange, ImplicitAPI):
5297
5297
  request['contract_code'] = market['id']
5298
5298
  stop = self.safe_value(params, 'stop')
5299
5299
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
5300
- trailing = self.safe_value(params, 'trailing', False)
5300
+ trailing = self.safe_bool(params, 'trailing', False)
5301
5301
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
5302
5302
  if market['linear']:
5303
5303
  marginMode = None
@@ -5556,7 +5556,7 @@ class htx(Exchange, ImplicitAPI):
5556
5556
  request['contract_code'] = market['id']
5557
5557
  stop = self.safe_value(params, 'stop')
5558
5558
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
5559
- trailing = self.safe_value(params, 'trailing', False)
5559
+ trailing = self.safe_bool(params, 'trailing', False)
5560
5560
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
5561
5561
  if market['linear']:
5562
5562
  marginMode = None
@@ -5973,7 +5973,7 @@ class htx(Exchange, ImplicitAPI):
5973
5973
  request['chain'] = self.network_code_to_id(networkCode, code)
5974
5974
  amount = float(self.currency_to_precision(code, amount, networkCode))
5975
5975
  withdrawOptions = self.safe_value(self.options, 'withdraw', {})
5976
- if self.safe_value(withdrawOptions, 'includeFee', False):
5976
+ if self.safe_bool(withdrawOptions, 'includeFee', False):
5977
5977
  fee = self.safe_number(params, 'fee')
5978
5978
  if fee is None:
5979
5979
  currencies = await self.fetch_currencies()
@@ -1013,7 +1013,7 @@ class huobijp(Exchange, ImplicitAPI):
1013
1013
  depositEnabled = self.safe_value(currency, 'deposit-enabled')
1014
1014
  withdrawEnabled = self.safe_value(currency, 'withdraw-enabled')
1015
1015
  countryDisabled = self.safe_value(currency, 'country-disabled')
1016
- visible = self.safe_value(currency, 'visible', False)
1016
+ visible = self.safe_bool(currency, 'visible', False)
1017
1017
  state = self.safe_string(currency, 'state')
1018
1018
  active = visible and depositEnabled and withdrawEnabled and (state == 'online') and not countryDisabled
1019
1019
  name = self.safe_string(currency, 'display-name')
@@ -958,7 +958,9 @@ class kraken(Exchange, ImplicitAPI):
958
958
  else:
959
959
  request['interval'] = timeframe
960
960
  if since is not None:
961
- request['since'] = self.parse_to_int((since - 1) / 1000)
961
+ # contrary to kraken's api documentation, the since parameter must be passed in nanoseconds
962
+ # the adding of '000000' is copied from the fetchTrades function
963
+ request['since'] = self.number_to_string(since) + '000000' # expected to be in nanoseconds
962
964
  response = await self.publicGetOHLC(self.extend(request, params))
963
965
  #
964
966
  # {
@@ -57,6 +57,9 @@ class krakenfutures(Exchange, ImplicitAPI):
57
57
  'fetchClosedOrders': None, # https://support.kraken.com/hc/en-us/articles/360058243651-Historical-orders
58
58
  'fetchCrossBorrowRate': False,
59
59
  'fetchCrossBorrowRates': False,
60
+ 'fetchDepositAddress': False,
61
+ 'fetchDepositAddresses': False,
62
+ 'fetchDepositAddressesByNetwork': False,
60
63
  'fetchFundingHistory': None,
61
64
  'fetchFundingRate': 'emulated',
62
65
  'fetchFundingRateHistory': True,
@@ -546,7 +549,7 @@ class krakenfutures(Exchange, ImplicitAPI):
546
549
  volume = self.safe_string(ticker, 'vol24h')
547
550
  baseVolume = None
548
551
  quoteVolume = None
549
- isIndex = self.safe_value(market, 'index', False)
552
+ isIndex = self.safe_bool(market, 'index', False)
550
553
  if not isIndex:
551
554
  if market['linear']:
552
555
  baseVolume = volume
@@ -953,7 +953,7 @@ class kucoin(Exchange, ImplicitAPI):
953
953
  #
954
954
  data = self.safe_value(response, 'data')
955
955
  options = self.safe_value(self.options, 'fetchMarkets', {})
956
- fetchTickersFees = self.safe_value(options, 'fetchTickersFees', True)
956
+ fetchTickersFees = self.safe_bool(options, 'fetchTickersFees', True)
957
957
  tickersResponse = {}
958
958
  if fetchTickersFees:
959
959
  tickersResponse = await self.publicGetMarketAllTickers(params)
@@ -1156,12 +1156,12 @@ class kucoin(Exchange, ImplicitAPI):
1156
1156
  chain = chains[j]
1157
1157
  chainId = self.safe_string(chain, 'chainId')
1158
1158
  networkCode = self.network_id_to_code(chainId)
1159
- chainWithdrawEnabled = self.safe_value(chain, 'isWithdrawEnabled', False)
1159
+ chainWithdrawEnabled = self.safe_bool(chain, 'isWithdrawEnabled', False)
1160
1160
  if isWithdrawEnabled is None:
1161
1161
  isWithdrawEnabled = chainWithdrawEnabled
1162
1162
  else:
1163
1163
  isWithdrawEnabled = isWithdrawEnabled or chainWithdrawEnabled
1164
- chainDepositEnabled = self.safe_value(chain, 'isDepositEnabled', False)
1164
+ chainDepositEnabled = self.safe_bool(chain, 'isDepositEnabled', False)
1165
1165
  if isDepositEnabled is None:
1166
1166
  isDepositEnabled = chainDepositEnabled
1167
1167
  else:
@@ -1867,9 +1867,9 @@ class kucoin(Exchange, ImplicitAPI):
1867
1867
  """
1868
1868
  await self.load_markets()
1869
1869
  market = self.market(symbol)
1870
- testOrder = self.safe_value(params, 'test', False)
1870
+ testOrder = self.safe_bool(params, 'test', False)
1871
1871
  params = self.omit(params, 'test')
1872
- isHf = self.safe_value(params, 'hf', False)
1872
+ isHf = self.safe_bool(params, 'hf', False)
1873
1873
  triggerPrice, stopLossPrice, takeProfitPrice = self.handle_trigger_prices(params)
1874
1874
  tradeType = self.safe_string(params, 'tradeType') # keep it for backward compatibility
1875
1875
  isTriggerOrder = (triggerPrice or stopLossPrice or takeProfitPrice)
@@ -1976,7 +1976,7 @@ class kucoin(Exchange, ImplicitAPI):
1976
1976
  'symbol': market['id'],
1977
1977
  'orderList': ordersRequests,
1978
1978
  }
1979
- hf = self.safe_value(params, 'hf', False)
1979
+ hf = self.safe_bool(params, 'hf', False)
1980
1980
  params = self.omit(params, 'hf')
1981
1981
  response = None
1982
1982
  if hf:
@@ -2134,7 +2134,7 @@ class kucoin(Exchange, ImplicitAPI):
2134
2134
  request = {}
2135
2135
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
2136
2136
  stop = self.safe_value_2(params, 'stop', 'trigger', False)
2137
- hf = self.safe_value(params, 'hf', False)
2137
+ hf = self.safe_bool(params, 'hf', False)
2138
2138
  if hf:
2139
2139
  if symbol is None:
2140
2140
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol parameter for hf orders')
@@ -2177,8 +2177,8 @@ class kucoin(Exchange, ImplicitAPI):
2177
2177
  """
2178
2178
  await self.load_markets()
2179
2179
  request = {}
2180
- stop = self.safe_value(params, 'stop', False)
2181
- hf = self.safe_value(params, 'hf', False)
2180
+ stop = self.safe_bool(params, 'stop', False)
2181
+ hf = self.safe_bool(params, 'hf', False)
2182
2182
  params = self.omit(params, ['stop', 'hf'])
2183
2183
  marginMode, query = self.handle_margin_mode_and_params('cancelAllOrders', params)
2184
2184
  if symbol is not None:
@@ -2225,8 +2225,8 @@ class kucoin(Exchange, ImplicitAPI):
2225
2225
  await self.load_markets()
2226
2226
  lowercaseStatus = status.lower()
2227
2227
  until = self.safe_integer_2(params, 'until', 'till')
2228
- stop = self.safe_value(params, 'stop', False)
2229
- hf = self.safe_value(params, 'hf', False)
2228
+ stop = self.safe_bool(params, 'stop', False)
2229
+ hf = self.safe_bool(params, 'hf', False)
2230
2230
  params = self.omit(params, ['stop', 'hf', 'till', 'until'])
2231
2231
  marginMode, query = self.handle_margin_mode_and_params('fetchOrdersByStatus', params)
2232
2232
  if lowercaseStatus == 'open':
@@ -2381,8 +2381,8 @@ class kucoin(Exchange, ImplicitAPI):
2381
2381
  await self.load_markets()
2382
2382
  request = {}
2383
2383
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
2384
- stop = self.safe_value(params, 'stop', False)
2385
- hf = self.safe_value(params, 'hf', False)
2384
+ stop = self.safe_bool(params, 'stop', False)
2385
+ hf = self.safe_bool(params, 'hf', False)
2386
2386
  market = None
2387
2387
  if symbol is not None:
2388
2388
  market = self.market(symbol)
@@ -2545,10 +2545,10 @@ class kucoin(Exchange, ImplicitAPI):
2545
2545
  marketId = self.safe_string(order, 'symbol')
2546
2546
  timestamp = self.safe_integer(order, 'createdAt')
2547
2547
  feeCurrencyId = self.safe_string(order, 'feeCurrency')
2548
- cancelExist = self.safe_value(order, 'cancelExist', False)
2548
+ cancelExist = self.safe_bool(order, 'cancelExist', False)
2549
2549
  responseStop = self.safe_string(order, 'stop')
2550
2550
  stop = responseStop is not None
2551
- stopTriggered = self.safe_value(order, 'stopTriggered', False)
2551
+ stopTriggered = self.safe_bool(order, 'stopTriggered', False)
2552
2552
  isActive = self.safe_value_2(order, 'isActive', 'active')
2553
2553
  responseStatus = self.safe_string(order, 'status')
2554
2554
  status = None
@@ -2632,7 +2632,7 @@ class kucoin(Exchange, ImplicitAPI):
2632
2632
  if paginate:
2633
2633
  return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
2634
2634
  request = {}
2635
- hf = self.safe_value(params, 'hf', False)
2635
+ hf = self.safe_bool(params, 'hf', False)
2636
2636
  if hf and symbol is None:
2637
2637
  raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol parameter for hf orders')
2638
2638
  market = None
@@ -3258,7 +3258,7 @@ class kucoin(Exchange, ImplicitAPI):
3258
3258
  accountsByType = self.safe_value(self.options, 'accountsByType')
3259
3259
  type = self.safe_string(accountsByType, requestedType, requestedType)
3260
3260
  params = self.omit(params, 'type')
3261
- isHf = self.safe_value(params, 'hf', False)
3261
+ isHf = self.safe_bool(params, 'hf', False)
3262
3262
  if isHf:
3263
3263
  type = 'trade_hf'
3264
3264
  params = self.omit(params, 'hf')
@@ -1089,7 +1089,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1089
1089
  """
1090
1090
  await self.load_markets()
1091
1091
  market = self.market(symbol)
1092
- testOrder = self.safe_value(params, 'test', False)
1092
+ testOrder = self.safe_bool(params, 'test', False)
1093
1093
  params = self.omit(params, 'test')
1094
1094
  orderRequest = self.create_contract_order_request(symbol, type, side, amount, price, params)
1095
1095
  response = None
@@ -1699,7 +1699,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1699
1699
  # average = Precise.string_div(cost, Precise.string_mul(filled, market['contractSize']))
1700
1700
  # bool
1701
1701
  isActive = self.safe_value(order, 'isActive')
1702
- cancelExist = self.safe_value(order, 'cancelExist', False)
1702
+ cancelExist = self.safe_bool(order, 'cancelExist', False)
1703
1703
  status = None
1704
1704
  if isActive is not None:
1705
1705
  status = 'open' if isActive else 'closed'
@@ -2376,7 +2376,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
2376
2376
  await self.load_markets()
2377
2377
  market = self.market(symbol)
2378
2378
  clientOrderId = self.safe_string(params, 'clientOrderId')
2379
- testOrder = self.safe_value(params, 'test', False)
2379
+ testOrder = self.safe_bool(params, 'test', False)
2380
2380
  params = self.omit(params, ['test', 'clientOrderId'])
2381
2381
  if clientOrderId is None:
2382
2382
  clientOrderId = self.number_to_string(self.nonce())
@@ -62,6 +62,7 @@ class lbank(Exchange, ImplicitAPI):
62
62
  'fetchClosedOrders': False,
63
63
  'fetchCrossBorrowRate': False,
64
64
  'fetchCrossBorrowRates': False,
65
+ 'fetchDepositAddress': True,
65
66
  'fetchDepositWithdrawFee': 'emulated',
66
67
  'fetchDepositWithdrawFees': True,
67
68
  'fetchFundingHistory': False,
@@ -346,7 +347,7 @@ class lbank(Exchange, ImplicitAPI):
346
347
 
347
348
  async def fetch_markets(self, params={}):
348
349
  """
349
- retrieves data on all markets for lbank2
350
+ retrieves data on all markets for lbank
350
351
  :see: https://www.lbank.com/en-US/docs/index.html#trading-pairs
351
352
  :see: https://www.lbank.com/en-US/docs/contract.html#query-contract-information-list
352
353
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1260,7 +1261,7 @@ class lbank(Exchange, ImplicitAPI):
1260
1261
  await self.load_markets()
1261
1262
  market = self.market(symbol)
1262
1263
  clientOrderId = self.safe_string_2(params, 'custom_id', 'clientOrderId')
1263
- postOnly = self.safe_value(params, 'postOnly', False)
1264
+ postOnly = self.safe_bool(params, 'postOnly', False)
1264
1265
  timeInForce = self.safe_string_upper(params, 'timeInForce')
1265
1266
  params = self.omit(params, ['custom_id', 'clientOrderId', 'timeInForce', 'postOnly'])
1266
1267
  request = {
@@ -2167,7 +2168,7 @@ class lbank(Exchange, ImplicitAPI):
2167
2168
  """
2168
2169
  * @deprecated
2169
2170
  please use fetchDepositWithdrawFees instead
2170
- :param str[]|None codes: not used by lbank2 fetchTransactionFees()
2171
+ :param str[]|None codes: not used by lbank fetchTransactionFees()
2171
2172
  :param dict [params]: extra parameters specific to the exchange API endpoint
2172
2173
  :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
2173
2174
  """
@@ -958,8 +958,8 @@ class mexc(Exchange, ImplicitAPI):
958
958
  chain = chains[j]
959
959
  networkId = self.safe_string(chain, 'network')
960
960
  network = self.safe_network(networkId)
961
- isDepositEnabled = self.safe_value(chain, 'depositEnable', False)
962
- isWithdrawEnabled = self.safe_value(chain, 'withdrawEnable', False)
961
+ isDepositEnabled = self.safe_bool(chain, 'depositEnable', False)
962
+ isWithdrawEnabled = self.safe_bool(chain, 'withdrawEnable', False)
963
963
  active = (isDepositEnabled and isWithdrawEnabled)
964
964
  currencyActive = active or currencyActive
965
965
  withdrawMin = self.safe_string(chain, 'withdrawMin')
@@ -2116,7 +2116,7 @@ class mexc(Exchange, ImplicitAPI):
2116
2116
  await self.load_markets()
2117
2117
  symbol = market['symbol']
2118
2118
  unavailableContracts = self.safe_value(self.options, 'unavailableContracts', {})
2119
- isContractUnavaiable = self.safe_value(unavailableContracts, symbol, False)
2119
+ isContractUnavaiable = self.safe_bool(unavailableContracts, symbol, False)
2120
2120
  if isContractUnavaiable:
2121
2121
  raise NotSupported(self.id + ' createSwapOrder() does not support yet self symbol:' + symbol)
2122
2122
  openType = None
@@ -2171,7 +2171,7 @@ class mexc(Exchange, ImplicitAPI):
2171
2171
  leverage = self.safe_integer(params, 'leverage')
2172
2172
  if leverage is None:
2173
2173
  raise ArgumentsRequired(self.id + ' createSwapOrder() requires a leverage parameter for isolated margin orders')
2174
- reduceOnly = self.safe_value(params, 'reduceOnly', False)
2174
+ reduceOnly = self.safe_bool(params, 'reduceOnly', False)
2175
2175
  if reduceOnly:
2176
2176
  request['side'] = 2 if (side == 'buy') else 4
2177
2177
  else:
@@ -3397,7 +3397,7 @@ class mexc(Exchange, ImplicitAPI):
3397
3397
  request = {}
3398
3398
  marketType, params = self.handle_market_type_and_params('fetchBalance', None, params)
3399
3399
  marginMode = self.safe_string(params, 'marginMode')
3400
- isMargin = self.safe_value(params, 'margin', False)
3400
+ isMargin = self.safe_bool(params, 'margin', False)
3401
3401
  params = self.omit(params, ['margin', 'marginMode'])
3402
3402
  response = None
3403
3403
  if (marginMode is not None) or (isMargin) or (marketType == 'margin'):
@@ -4959,7 +4959,7 @@ class mexc(Exchange, ImplicitAPI):
4959
4959
  :returns Array: the marginMode in lowercase
4960
4960
  """
4961
4961
  defaultType = self.safe_string(self.options, 'defaultType')
4962
- isMargin = self.safe_value(params, 'margin', False)
4962
+ isMargin = self.safe_bool(params, 'margin', False)
4963
4963
  marginMode = None
4964
4964
  marginMode, params = super(mexc, self).handle_margin_mode_and_params(methodName, params, defaultValue)
4965
4965
  if (defaultType == 'margin') or (isMargin is True):
@@ -5035,7 +5035,7 @@ class mexc(Exchange, ImplicitAPI):
5035
5035
  # {"code":10216,"msg":"No available deposit address"}
5036
5036
  # {"success":true, "code":0, "data":1634095541710}
5037
5037
  #
5038
- success = self.safe_value(response, 'success', False) # v1
5038
+ success = self.safe_bool(response, 'success', False) # v1
5039
5039
  if success is True:
5040
5040
  return None
5041
5041
  responseCode = self.safe_string(response, 'code', None)
@@ -1117,7 +1117,7 @@ class novadax(Exchange, ImplicitAPI):
1117
1117
  #
1118
1118
  transfer = self.parse_transfer(response, currency)
1119
1119
  transferOptions = self.safe_value(self.options, 'transfer', {})
1120
- fillResponseFromRequest = self.safe_value(transferOptions, 'fillResponseFromRequest', True)
1120
+ fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
1121
1121
  if fillResponseFromRequest:
1122
1122
  transfer['fromAccount'] = fromAccount
1123
1123
  transfer['toAccount'] = toAccount
@@ -860,7 +860,7 @@ class okcoin(Exchange, ImplicitAPI):
860
860
  symbol = market['symbol']
861
861
  last = self.safe_string(ticker, 'last')
862
862
  open = self.safe_string(ticker, 'open24h')
863
- spot = self.safe_value(market, 'spot', False)
863
+ spot = self.safe_bool(market, 'spot', False)
864
864
  quoteVolume = self.safe_string(ticker, 'volCcy24h') if spot else None
865
865
  baseVolume = self.safe_string(ticker, 'vol24h')
866
866
  high = self.safe_string(ticker, 'high24h')
@@ -1364,7 +1364,7 @@ class okcoin(Exchange, ImplicitAPI):
1364
1364
  margin = True
1365
1365
  else:
1366
1366
  marginMode = defaultMarginMode
1367
- margin = self.safe_value(params, 'margin', False)
1367
+ margin = self.safe_bool(params, 'margin', False)
1368
1368
  if margin:
1369
1369
  defaultCurrency = market['quote'] if (side == 'buy') else market['base']
1370
1370
  currency = self.safe_string(params, 'ccy', defaultCurrency)
ccxt/async_support/okx.py CHANGED
@@ -364,9 +364,11 @@ class okx(Exchange, ImplicitAPI):
364
364
  'tradingBot/grid/sub-orders': 1,
365
365
  'tradingBot/grid/positions': 1,
366
366
  'tradingBot/grid/ai-param': 1,
367
- 'tradingBot/public/rsi-back-testing': 1,
367
+ 'tradingBot/signal/signals': 1,
368
368
  'tradingBot/signal/orders-algo-details': 1,
369
+ 'tradingBot/signal/orders-algo-history': 1,
369
370
  'tradingBot/signal/positions': 1,
371
+ 'tradingBot/signal/positions-history': 1,
370
372
  'tradingBot/signal/sub-orders': 1,
371
373
  'tradingBot/signal/event-history': 1,
372
374
  'tradingBot/recurring/orders-algo-pending': 1,
@@ -486,6 +488,15 @@ class okx(Exchange, ImplicitAPI):
486
488
  'tradingBot/grid/compute-margin-balance': 1,
487
489
  'tradingBot/grid/margin-balance': 1,
488
490
  'tradingBot/grid/min-investment': 1,
491
+ 'tradingBot/signal/create-signal': 1,
492
+ 'tradingBot/signal/order-algo': 1,
493
+ 'tradingBot/signal/stop-order-algo': 1,
494
+ 'tradingBot/signal/margin-balance': 1,
495
+ 'tradingBot/signal/amendTPSL': 1,
496
+ 'tradingBot/signal/set-instruments': 1,
497
+ 'tradingBot/signal/close-position': 1,
498
+ 'tradingBot/signal/sub-order': 1,
499
+ 'tradingBot/signal/cancel-sub-order': 1,
489
500
  'tradingBot/recurring/order-algo': 1,
490
501
  'tradingBot/recurring/amend-order-algo': 1,
491
502
  'tradingBot/recurring/stop-order-algo': 1,
@@ -2094,7 +2105,8 @@ class okx(Exchange, ImplicitAPI):
2094
2105
  historyBorder = now - ((1440 - 1) * durationInMilliseconds)
2095
2106
  if since < historyBorder:
2096
2107
  defaultType = 'HistoryCandles'
2097
- request['before'] = since
2108
+ startTime = max(since - 1, 0)
2109
+ request['before'] = startTime
2098
2110
  request['after'] = self.sum(since, durationInMilliseconds * limit)
2099
2111
  until = self.safe_integer(params, 'until')
2100
2112
  if until is not None:
@@ -2924,7 +2936,7 @@ class okx(Exchange, ImplicitAPI):
2924
2936
  if symbol is None:
2925
2937
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
2926
2938
  stop = self.safe_value_2(params, 'stop', 'trigger')
2927
- trailing = self.safe_value(params, 'trailing', False)
2939
+ trailing = self.safe_bool(params, 'trailing', False)
2928
2940
  if stop or trailing:
2929
2941
  orderInner = await self.cancel_orders([id], symbol, params)
2930
2942
  return self.safe_value(orderInner, 0)
@@ -2982,7 +2994,7 @@ class okx(Exchange, ImplicitAPI):
2982
2994
  clientOrderIds = self.parse_ids(self.safe_value_2(params, 'clOrdId', 'clientOrderId'))
2983
2995
  algoIds = self.parse_ids(self.safe_value(params, 'algoId'))
2984
2996
  stop = self.safe_value_2(params, 'stop', 'trigger')
2985
- trailing = self.safe_value(params, 'trailing', False)
2997
+ trailing = self.safe_bool(params, 'trailing', False)
2986
2998
  if stop or trailing:
2987
2999
  method = 'privatePostTradeCancelAlgos'
2988
3000
  if clientOrderIds is None:
@@ -3445,7 +3457,7 @@ class okx(Exchange, ImplicitAPI):
3445
3457
  method = self.safe_string(params, 'method', defaultMethod)
3446
3458
  ordType = self.safe_string(params, 'ordType')
3447
3459
  stop = self.safe_value_2(params, 'stop', 'trigger')
3448
- trailing = self.safe_value(params, 'trailing', False)
3460
+ trailing = self.safe_bool(params, 'trailing', False)
3449
3461
  if trailing or stop or (ordType in algoOrderTypes):
3450
3462
  method = 'privateGetTradeOrdersAlgoPending'
3451
3463
  if trailing:
@@ -3603,7 +3615,7 @@ class okx(Exchange, ImplicitAPI):
3603
3615
  method = self.safe_string(params, 'method', defaultMethod)
3604
3616
  ordType = self.safe_string(params, 'ordType')
3605
3617
  stop = self.safe_value_2(params, 'stop', 'trigger')
3606
- trailing = self.safe_value(params, 'trailing', False)
3618
+ trailing = self.safe_bool(params, 'trailing', False)
3607
3619
  if trailing:
3608
3620
  method = 'privateGetTradeOrdersAlgoHistory'
3609
3621
  request['ordType'] = 'move_order_stop'
@@ -3782,7 +3794,7 @@ class okx(Exchange, ImplicitAPI):
3782
3794
  method = self.safe_string(params, 'method', defaultMethod)
3783
3795
  ordType = self.safe_string(params, 'ordType')
3784
3796
  stop = self.safe_value_2(params, 'stop', 'trigger')
3785
- trailing = self.safe_value(params, 'trailing', False)
3797
+ trailing = self.safe_bool(params, 'trailing', False)
3786
3798
  if trailing or stop or (ordType in algoOrderTypes):
3787
3799
  method = 'privateGetTradeOrdersAlgoHistory'
3788
3800
  request['state'] = 'effective'
@@ -3936,10 +3948,12 @@ class okx(Exchange, ImplicitAPI):
3936
3948
  if symbol is not None:
3937
3949
  market = self.market(symbol)
3938
3950
  request['instId'] = market['id']
3951
+ if since is not None:
3952
+ request['begin'] = since
3939
3953
  request, params = self.handle_until_option('end', request, params)
3940
3954
  type, query = self.handle_market_type_and_params('fetchMyTrades', market, params)
3941
3955
  request['instType'] = self.convert_to_instrument_type(type)
3942
- if limit is not None:
3956
+ if (limit is not None) and (since is None): # limit = n, okx will return the n most recent results, instead of the n results after limit, so limit should only be sent when since is None
3943
3957
  request['limit'] = limit # default 100, max 100
3944
3958
  response = await self.privateGetTradeFillsHistory(self.extend(request, query))
3945
3959
  #
ccxt/async_support/p2b.py CHANGED
@@ -25,6 +25,7 @@ class p2b(Exchange, ImplicitAPI):
25
25
  'countries': ['LT'],
26
26
  'rateLimit': 100,
27
27
  'version': 'v2',
28
+ 'pro': True,
28
29
  'has': {
29
30
  'CORS': None,
30
31
  'spot': True,
@@ -2335,7 +2335,7 @@ class phemex(Exchange, ImplicitAPI):
2335
2335
  })
2336
2336
 
2337
2337
  def parse_order(self, order, market: Market = None) -> Order:
2338
- isSwap = self.safe_value(market, 'swap', False)
2338
+ isSwap = self.safe_bool(market, 'swap', False)
2339
2339
  hasPnl = ('closedPnl' in order)
2340
2340
  if isSwap or hasPnl:
2341
2341
  return self.parse_swap_order(order, market)
@@ -4032,7 +4032,7 @@ class phemex(Exchange, ImplicitAPI):
4032
4032
  if (leverage < -100) or (leverage > 100):
4033
4033
  raise BadRequest(self.id + ' setLeverage() leverage should be between -100 and 100')
4034
4034
  await self.load_markets()
4035
- isHedged = self.safe_value(params, 'hedged', False)
4035
+ isHedged = self.safe_bool(params, 'hedged', False)
4036
4036
  longLeverageRr = self.safe_integer(params, 'longLeverageRr')
4037
4037
  shortLeverageRr = self.safe_integer(params, 'shortLeverageRr')
4038
4038
  market = self.market(symbol)
@@ -4118,7 +4118,7 @@ class phemex(Exchange, ImplicitAPI):
4118
4118
  #
4119
4119
  transfer = self.parse_transfer(response)
4120
4120
  transferOptions = self.safe_value(self.options, 'transfer', {})
4121
- fillResponseFromRequest = self.safe_value(transferOptions, 'fillResponseFromRequest', True)
4121
+ fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
4122
4122
  if fillResponseFromRequest:
4123
4123
  if transfer['fromAccount'] is None:
4124
4124
  transfer['fromAccount'] = fromAccount
@@ -45,6 +45,9 @@ class poloniexfutures(Exchange, ImplicitAPI):
45
45
  'fetchBalance': True,
46
46
  'fetchClosedOrders': True,
47
47
  'fetchCurrencies': False,
48
+ 'fetchDepositAddress': False,
49
+ 'fetchDepositAddresses': False,
50
+ 'fetchDepositAddressesByNetwork': False,
48
51
  'fetchFundingRate': True,
49
52
  'fetchFundingRateHistory': False,
50
53
  'fetchL3OrderBook': True,
@@ -830,7 +833,7 @@ class poloniexfutures(Exchange, ImplicitAPI):
830
833
  request['price'] = self.price_to_precision(symbol, price)
831
834
  if timeInForce is not None:
832
835
  request['timeInForce'] = timeInForce
833
- postOnly = self.safe_value(params, 'postOnly', False)
836
+ postOnly = self.safe_bool(params, 'postOnly', False)
834
837
  hidden = self.safe_value(params, 'hidden')
835
838
  if postOnly and (hidden is not None):
836
839
  raise BadRequest(self.id + ' createOrder() does not support the postOnly parameter together with a hidden parameter')
@@ -1475,8 +1478,8 @@ class poloniexfutures(Exchange, ImplicitAPI):
1475
1478
  # precision reported by their api is 8 d.p.
1476
1479
  # average = Precise.string_div(rawCost, Precise.string_mul(filled, market['contractSize']))
1477
1480
  # bool
1478
- isActive = self.safe_value(order, 'isActive', False)
1479
- cancelExist = self.safe_value(order, 'cancelExist', False)
1481
+ isActive = self.safe_bool(order, 'isActive', False)
1482
+ cancelExist = self.safe_bool(order, 'cancelExist', False)
1480
1483
  status = 'open' if isActive else 'closed'
1481
1484
  id = self.safe_string(order, 'id')
1482
1485
  if 'cancelledOrderIds' in order:
@@ -297,7 +297,7 @@ class probit(Exchange, ImplicitAPI):
297
297
  quoteId = self.safe_string(market, 'quote_currency_id')
298
298
  base = self.safe_currency_code(baseId)
299
299
  quote = self.safe_currency_code(quoteId)
300
- closed = self.safe_value(market, 'closed', False)
300
+ closed = self.safe_bool(market, 'closed', False)
301
301
  takerFeeRate = self.safe_string(market, 'taker_fee_rate')
302
302
  taker = Precise.string_div(takerFeeRate, '100')
303
303
  makerFeeRate = self.safe_string(market, 'maker_fee_rate')
@@ -109,7 +109,7 @@ class timex(Exchange, ImplicitAPI):
109
109
  'rest': 'https://plasma-relay-backend.timex.io',
110
110
  },
111
111
  'www': 'https://timex.io',
112
- 'doc': 'https://docs.timex.io',
112
+ 'doc': 'https://plasma-relay-backend.timex.io/swagger-ui/index.html',
113
113
  'referral': 'https://timex.io/?refcode=1x27vNkTbP1uwkCck',
114
114
  },
115
115
  'api': {
@@ -701,7 +701,7 @@ class timex(Exchange, ImplicitAPI):
701
701
  market = self.market(symbol)
702
702
  uppercaseSide = side.upper()
703
703
  uppercaseType = type.upper()
704
- postOnly = self.safe_value(params, 'postOnly', False)
704
+ postOnly = self.safe_bool(params, 'postOnly', False)
705
705
  if postOnly:
706
706
  uppercaseType = 'POST_ONLY'
707
707
  params = self.omit(params, ['postOnly'])
@@ -706,7 +706,7 @@ class tokocrypto(Exchange, ImplicitAPI):
706
706
  if permissions[j] == 'TRD_GRP_003':
707
707
  active = False
708
708
  break
709
- isMarginTradingAllowed = self.safe_value(market, 'isMarginTradingAllowed', False)
709
+ isMarginTradingAllowed = self.safe_bool(market, 'isMarginTradingAllowed', False)
710
710
  entry = {
711
711
  'id': id,
712
712
  'lowercaseId': lowercaseId,
@@ -1555,7 +1555,7 @@ class tokocrypto(Exchange, ImplicitAPI):
1555
1555
  await self.load_markets()
1556
1556
  market = self.market(symbol)
1557
1557
  clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientId')
1558
- postOnly = self.safe_value(params, 'postOnly', False)
1558
+ postOnly = self.safe_bool(params, 'postOnly', False)
1559
1559
  # only supported for spot/margin api
1560
1560
  if postOnly:
1561
1561
  type = 'LIMIT_MAKER'
@@ -2328,7 +2328,7 @@ class tokocrypto(Exchange, ImplicitAPI):
2328
2328
  return None # fallback to default error handler
2329
2329
  # check success value for wapi endpoints
2330
2330
  # response in format {'msg': 'The coin does not exist.', 'success': True/false}
2331
- success = self.safe_value(response, 'success', True)
2331
+ success = self.safe_bool(response, 'success', True)
2332
2332
  if not success:
2333
2333
  messageInner = self.safe_string(response, 'msg')
2334
2334
  parsedMessage = None
@@ -409,7 +409,7 @@ class wavesexchange(Exchange, ImplicitAPI):
409
409
  # "matcherFee":"4077612"
410
410
  # }
411
411
  # }
412
- isDiscountFee = self.safe_value(params, 'isDiscountFee', False)
412
+ isDiscountFee = self.safe_bool(params, 'isDiscountFee', False)
413
413
  mode = None
414
414
  if isDiscountFee:
415
415
  mode = self.safe_value(response, 'discount')
@@ -2277,7 +2277,7 @@ class wavesexchange(Exchange, ImplicitAPI):
2277
2277
 
2278
2278
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2279
2279
  errorCode = self.safe_string(response, 'error')
2280
- success = self.safe_value(response, 'success', True)
2280
+ success = self.safe_bool(response, 'success', True)
2281
2281
  Exception = self.safe_value(self.exceptions, errorCode)
2282
2282
  if Exception is not None:
2283
2283
  messageInner = self.safe_string(response, 'message')
@@ -32,7 +32,7 @@ class whitebit(Exchange, ImplicitAPI):
32
32
  'name': 'WhiteBit',
33
33
  'version': 'v4',
34
34
  'countries': ['EE'],
35
- 'rateLimit': 500,
35
+ 'rateLimit': 50,
36
36
  'pro': True,
37
37
  'has': {
38
38
  'CORS': None,
@@ -429,8 +429,8 @@ class whitebit(Exchange, ImplicitAPI):
429
429
  currency = response[id]
430
430
  # breaks down in Python due to utf8 encoding issues on the exchange side
431
431
  # name = self.safe_string(currency, 'name')
432
- canDeposit = self.safe_value(currency, 'can_deposit', True)
433
- canWithdraw = self.safe_value(currency, 'can_withdraw', True)
432
+ canDeposit = self.safe_bool(currency, 'can_deposit', True)
433
+ canWithdraw = self.safe_bool(currency, 'can_withdraw', True)
434
434
  active = canDeposit and canWithdraw
435
435
  code = self.safe_currency_code(id)
436
436
  result[code] = {