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/htx.py CHANGED
@@ -3740,7 +3740,7 @@ class htx(Exchange, ImplicitAPI):
3740
3740
  response = None
3741
3741
  stop = self.safe_value(params, 'stop')
3742
3742
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
3743
- trailing = self.safe_value(params, 'trailing', False)
3743
+ trailing = self.safe_bool(params, 'trailing', False)
3744
3744
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
3745
3745
  if stop or stopLossTakeProfit or trailing:
3746
3746
  if limit is not None:
@@ -4064,7 +4064,7 @@ class htx(Exchange, ImplicitAPI):
4064
4064
  request['contract_code'] = market['id']
4065
4065
  stop = self.safe_value(params, 'stop')
4066
4066
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
4067
- trailing = self.safe_value(params, 'trailing', False)
4067
+ trailing = self.safe_bool(params, 'trailing', False)
4068
4068
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
4069
4069
  if market['linear']:
4070
4070
  marginMode = None
@@ -4691,7 +4691,7 @@ class htx(Exchange, ImplicitAPI):
4691
4691
  marketId = self.safe_string_2(order, 'contract_code', 'symbol')
4692
4692
  market = self.safe_market(marketId, market)
4693
4693
  timestamp = self.safe_integer_n(order, ['created_at', 'created-at', 'create_date'])
4694
- clientOrderId = self.safe_string_2(order, 'client_order_id', 'client-order-id')
4694
+ clientOrderId = self.safe_string_2(order, 'client_order_id', 'client-or' + 'der-id') # transpiler regex trick for php issue
4695
4695
  cost = None
4696
4696
  amount = None
4697
4697
  if (type is not None) and (type.find('market') >= 0):
@@ -5296,7 +5296,7 @@ class htx(Exchange, ImplicitAPI):
5296
5296
  request['contract_code'] = market['id']
5297
5297
  stop = self.safe_value(params, 'stop')
5298
5298
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
5299
- trailing = self.safe_value(params, 'trailing', False)
5299
+ trailing = self.safe_bool(params, 'trailing', False)
5300
5300
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
5301
5301
  if market['linear']:
5302
5302
  marginMode = None
@@ -5555,7 +5555,7 @@ class htx(Exchange, ImplicitAPI):
5555
5555
  request['contract_code'] = market['id']
5556
5556
  stop = self.safe_value(params, 'stop')
5557
5557
  stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
5558
- trailing = self.safe_value(params, 'trailing', False)
5558
+ trailing = self.safe_bool(params, 'trailing', False)
5559
5559
  params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing'])
5560
5560
  if market['linear']:
5561
5561
  marginMode = None
@@ -5972,7 +5972,7 @@ class htx(Exchange, ImplicitAPI):
5972
5972
  request['chain'] = self.network_code_to_id(networkCode, code)
5973
5973
  amount = float(self.currency_to_precision(code, amount, networkCode))
5974
5974
  withdrawOptions = self.safe_value(self.options, 'withdraw', {})
5975
- if self.safe_value(withdrawOptions, 'includeFee', False):
5975
+ if self.safe_bool(withdrawOptions, 'includeFee', False):
5976
5976
  fee = self.safe_number(params, 'fee')
5977
5977
  if fee is None:
5978
5978
  currencies = self.fetch_currencies()
ccxt/huobijp.py CHANGED
@@ -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')
ccxt/kraken.py CHANGED
@@ -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 = self.publicGetOHLC(self.extend(request, params))
963
965
  #
964
966
  # {
ccxt/krakenfutures.py CHANGED
@@ -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
ccxt/kucoin.py CHANGED
@@ -952,7 +952,7 @@ class kucoin(Exchange, ImplicitAPI):
952
952
  #
953
953
  data = self.safe_value(response, 'data')
954
954
  options = self.safe_value(self.options, 'fetchMarkets', {})
955
- fetchTickersFees = self.safe_value(options, 'fetchTickersFees', True)
955
+ fetchTickersFees = self.safe_bool(options, 'fetchTickersFees', True)
956
956
  tickersResponse = {}
957
957
  if fetchTickersFees:
958
958
  tickersResponse = self.publicGetMarketAllTickers(params)
@@ -1155,12 +1155,12 @@ class kucoin(Exchange, ImplicitAPI):
1155
1155
  chain = chains[j]
1156
1156
  chainId = self.safe_string(chain, 'chainId')
1157
1157
  networkCode = self.network_id_to_code(chainId)
1158
- chainWithdrawEnabled = self.safe_value(chain, 'isWithdrawEnabled', False)
1158
+ chainWithdrawEnabled = self.safe_bool(chain, 'isWithdrawEnabled', False)
1159
1159
  if isWithdrawEnabled is None:
1160
1160
  isWithdrawEnabled = chainWithdrawEnabled
1161
1161
  else:
1162
1162
  isWithdrawEnabled = isWithdrawEnabled or chainWithdrawEnabled
1163
- chainDepositEnabled = self.safe_value(chain, 'isDepositEnabled', False)
1163
+ chainDepositEnabled = self.safe_bool(chain, 'isDepositEnabled', False)
1164
1164
  if isDepositEnabled is None:
1165
1165
  isDepositEnabled = chainDepositEnabled
1166
1166
  else:
@@ -1866,9 +1866,9 @@ class kucoin(Exchange, ImplicitAPI):
1866
1866
  """
1867
1867
  self.load_markets()
1868
1868
  market = self.market(symbol)
1869
- testOrder = self.safe_value(params, 'test', False)
1869
+ testOrder = self.safe_bool(params, 'test', False)
1870
1870
  params = self.omit(params, 'test')
1871
- isHf = self.safe_value(params, 'hf', False)
1871
+ isHf = self.safe_bool(params, 'hf', False)
1872
1872
  triggerPrice, stopLossPrice, takeProfitPrice = self.handle_trigger_prices(params)
1873
1873
  tradeType = self.safe_string(params, 'tradeType') # keep it for backward compatibility
1874
1874
  isTriggerOrder = (triggerPrice or stopLossPrice or takeProfitPrice)
@@ -1975,7 +1975,7 @@ class kucoin(Exchange, ImplicitAPI):
1975
1975
  'symbol': market['id'],
1976
1976
  'orderList': ordersRequests,
1977
1977
  }
1978
- hf = self.safe_value(params, 'hf', False)
1978
+ hf = self.safe_bool(params, 'hf', False)
1979
1979
  params = self.omit(params, 'hf')
1980
1980
  response = None
1981
1981
  if hf:
@@ -2133,7 +2133,7 @@ class kucoin(Exchange, ImplicitAPI):
2133
2133
  request = {}
2134
2134
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
2135
2135
  stop = self.safe_value_2(params, 'stop', 'trigger', False)
2136
- hf = self.safe_value(params, 'hf', False)
2136
+ hf = self.safe_bool(params, 'hf', False)
2137
2137
  if hf:
2138
2138
  if symbol is None:
2139
2139
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol parameter for hf orders')
@@ -2176,8 +2176,8 @@ class kucoin(Exchange, ImplicitAPI):
2176
2176
  """
2177
2177
  self.load_markets()
2178
2178
  request = {}
2179
- stop = self.safe_value(params, 'stop', False)
2180
- hf = self.safe_value(params, 'hf', False)
2179
+ stop = self.safe_bool(params, 'stop', False)
2180
+ hf = self.safe_bool(params, 'hf', False)
2181
2181
  params = self.omit(params, ['stop', 'hf'])
2182
2182
  marginMode, query = self.handle_margin_mode_and_params('cancelAllOrders', params)
2183
2183
  if symbol is not None:
@@ -2224,8 +2224,8 @@ class kucoin(Exchange, ImplicitAPI):
2224
2224
  self.load_markets()
2225
2225
  lowercaseStatus = status.lower()
2226
2226
  until = self.safe_integer_2(params, 'until', 'till')
2227
- stop = self.safe_value(params, 'stop', False)
2228
- hf = self.safe_value(params, 'hf', False)
2227
+ stop = self.safe_bool(params, 'stop', False)
2228
+ hf = self.safe_bool(params, 'hf', False)
2229
2229
  params = self.omit(params, ['stop', 'hf', 'till', 'until'])
2230
2230
  marginMode, query = self.handle_margin_mode_and_params('fetchOrdersByStatus', params)
2231
2231
  if lowercaseStatus == 'open':
@@ -2380,8 +2380,8 @@ class kucoin(Exchange, ImplicitAPI):
2380
2380
  self.load_markets()
2381
2381
  request = {}
2382
2382
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
2383
- stop = self.safe_value(params, 'stop', False)
2384
- hf = self.safe_value(params, 'hf', False)
2383
+ stop = self.safe_bool(params, 'stop', False)
2384
+ hf = self.safe_bool(params, 'hf', False)
2385
2385
  market = None
2386
2386
  if symbol is not None:
2387
2387
  market = self.market(symbol)
@@ -2544,10 +2544,10 @@ class kucoin(Exchange, ImplicitAPI):
2544
2544
  marketId = self.safe_string(order, 'symbol')
2545
2545
  timestamp = self.safe_integer(order, 'createdAt')
2546
2546
  feeCurrencyId = self.safe_string(order, 'feeCurrency')
2547
- cancelExist = self.safe_value(order, 'cancelExist', False)
2547
+ cancelExist = self.safe_bool(order, 'cancelExist', False)
2548
2548
  responseStop = self.safe_string(order, 'stop')
2549
2549
  stop = responseStop is not None
2550
- stopTriggered = self.safe_value(order, 'stopTriggered', False)
2550
+ stopTriggered = self.safe_bool(order, 'stopTriggered', False)
2551
2551
  isActive = self.safe_value_2(order, 'isActive', 'active')
2552
2552
  responseStatus = self.safe_string(order, 'status')
2553
2553
  status = None
@@ -2631,7 +2631,7 @@ class kucoin(Exchange, ImplicitAPI):
2631
2631
  if paginate:
2632
2632
  return self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
2633
2633
  request = {}
2634
- hf = self.safe_value(params, 'hf', False)
2634
+ hf = self.safe_bool(params, 'hf', False)
2635
2635
  if hf and symbol is None:
2636
2636
  raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol parameter for hf orders')
2637
2637
  market = None
@@ -3257,7 +3257,7 @@ class kucoin(Exchange, ImplicitAPI):
3257
3257
  accountsByType = self.safe_value(self.options, 'accountsByType')
3258
3258
  type = self.safe_string(accountsByType, requestedType, requestedType)
3259
3259
  params = self.omit(params, 'type')
3260
- isHf = self.safe_value(params, 'hf', False)
3260
+ isHf = self.safe_bool(params, 'hf', False)
3261
3261
  if isHf:
3262
3262
  type = 'trade_hf'
3263
3263
  params = self.omit(params, 'hf')
ccxt/kucoinfutures.py CHANGED
@@ -1089,7 +1089,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1089
1089
  """
1090
1090
  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
  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())
ccxt/lbank.py CHANGED
@@ -61,6 +61,7 @@ class lbank(Exchange, ImplicitAPI):
61
61
  'fetchClosedOrders': False,
62
62
  'fetchCrossBorrowRate': False,
63
63
  'fetchCrossBorrowRates': False,
64
+ 'fetchDepositAddress': True,
64
65
  'fetchDepositWithdrawFee': 'emulated',
65
66
  'fetchDepositWithdrawFees': True,
66
67
  'fetchFundingHistory': False,
@@ -345,7 +346,7 @@ class lbank(Exchange, ImplicitAPI):
345
346
 
346
347
  def fetch_markets(self, params={}):
347
348
  """
348
- retrieves data on all markets for lbank2
349
+ retrieves data on all markets for lbank
349
350
  :see: https://www.lbank.com/en-US/docs/index.html#trading-pairs
350
351
  :see: https://www.lbank.com/en-US/docs/contract.html#query-contract-information-list
351
352
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1259,7 +1260,7 @@ class lbank(Exchange, ImplicitAPI):
1259
1260
  self.load_markets()
1260
1261
  market = self.market(symbol)
1261
1262
  clientOrderId = self.safe_string_2(params, 'custom_id', 'clientOrderId')
1262
- postOnly = self.safe_value(params, 'postOnly', False)
1263
+ postOnly = self.safe_bool(params, 'postOnly', False)
1263
1264
  timeInForce = self.safe_string_upper(params, 'timeInForce')
1264
1265
  params = self.omit(params, ['custom_id', 'clientOrderId', 'timeInForce', 'postOnly'])
1265
1266
  request = {
@@ -2166,7 +2167,7 @@ class lbank(Exchange, ImplicitAPI):
2166
2167
  """
2167
2168
  * @deprecated
2168
2169
  please use fetchDepositWithdrawFees instead
2169
- :param str[]|None codes: not used by lbank2 fetchTransactionFees()
2170
+ :param str[]|None codes: not used by lbank fetchTransactionFees()
2170
2171
  :param dict [params]: extra parameters specific to the exchange API endpoint
2171
2172
  :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
2172
2173
  """
ccxt/mexc.py CHANGED
@@ -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
  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)
ccxt/novadax.py CHANGED
@@ -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
ccxt/okcoin.py CHANGED
@@ -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/okx.py CHANGED
@@ -363,9 +363,11 @@ class okx(Exchange, ImplicitAPI):
363
363
  'tradingBot/grid/sub-orders': 1,
364
364
  'tradingBot/grid/positions': 1,
365
365
  'tradingBot/grid/ai-param': 1,
366
- 'tradingBot/public/rsi-back-testing': 1,
366
+ 'tradingBot/signal/signals': 1,
367
367
  'tradingBot/signal/orders-algo-details': 1,
368
+ 'tradingBot/signal/orders-algo-history': 1,
368
369
  'tradingBot/signal/positions': 1,
370
+ 'tradingBot/signal/positions-history': 1,
369
371
  'tradingBot/signal/sub-orders': 1,
370
372
  'tradingBot/signal/event-history': 1,
371
373
  'tradingBot/recurring/orders-algo-pending': 1,
@@ -485,6 +487,15 @@ class okx(Exchange, ImplicitAPI):
485
487
  'tradingBot/grid/compute-margin-balance': 1,
486
488
  'tradingBot/grid/margin-balance': 1,
487
489
  'tradingBot/grid/min-investment': 1,
490
+ 'tradingBot/signal/create-signal': 1,
491
+ 'tradingBot/signal/order-algo': 1,
492
+ 'tradingBot/signal/stop-order-algo': 1,
493
+ 'tradingBot/signal/margin-balance': 1,
494
+ 'tradingBot/signal/amendTPSL': 1,
495
+ 'tradingBot/signal/set-instruments': 1,
496
+ 'tradingBot/signal/close-position': 1,
497
+ 'tradingBot/signal/sub-order': 1,
498
+ 'tradingBot/signal/cancel-sub-order': 1,
488
499
  'tradingBot/recurring/order-algo': 1,
489
500
  'tradingBot/recurring/amend-order-algo': 1,
490
501
  'tradingBot/recurring/stop-order-algo': 1,
@@ -2093,7 +2104,8 @@ class okx(Exchange, ImplicitAPI):
2093
2104
  historyBorder = now - ((1440 - 1) * durationInMilliseconds)
2094
2105
  if since < historyBorder:
2095
2106
  defaultType = 'HistoryCandles'
2096
- request['before'] = since
2107
+ startTime = max(since - 1, 0)
2108
+ request['before'] = startTime
2097
2109
  request['after'] = self.sum(since, durationInMilliseconds * limit)
2098
2110
  until = self.safe_integer(params, 'until')
2099
2111
  if until is not None:
@@ -2923,7 +2935,7 @@ class okx(Exchange, ImplicitAPI):
2923
2935
  if symbol is None:
2924
2936
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
2925
2937
  stop = self.safe_value_2(params, 'stop', 'trigger')
2926
- trailing = self.safe_value(params, 'trailing', False)
2938
+ trailing = self.safe_bool(params, 'trailing', False)
2927
2939
  if stop or trailing:
2928
2940
  orderInner = self.cancel_orders([id], symbol, params)
2929
2941
  return self.safe_value(orderInner, 0)
@@ -2981,7 +2993,7 @@ class okx(Exchange, ImplicitAPI):
2981
2993
  clientOrderIds = self.parse_ids(self.safe_value_2(params, 'clOrdId', 'clientOrderId'))
2982
2994
  algoIds = self.parse_ids(self.safe_value(params, 'algoId'))
2983
2995
  stop = self.safe_value_2(params, 'stop', 'trigger')
2984
- trailing = self.safe_value(params, 'trailing', False)
2996
+ trailing = self.safe_bool(params, 'trailing', False)
2985
2997
  if stop or trailing:
2986
2998
  method = 'privatePostTradeCancelAlgos'
2987
2999
  if clientOrderIds is None:
@@ -3444,7 +3456,7 @@ class okx(Exchange, ImplicitAPI):
3444
3456
  method = self.safe_string(params, 'method', defaultMethod)
3445
3457
  ordType = self.safe_string(params, 'ordType')
3446
3458
  stop = self.safe_value_2(params, 'stop', 'trigger')
3447
- trailing = self.safe_value(params, 'trailing', False)
3459
+ trailing = self.safe_bool(params, 'trailing', False)
3448
3460
  if trailing or stop or (ordType in algoOrderTypes):
3449
3461
  method = 'privateGetTradeOrdersAlgoPending'
3450
3462
  if trailing:
@@ -3602,7 +3614,7 @@ class okx(Exchange, ImplicitAPI):
3602
3614
  method = self.safe_string(params, 'method', defaultMethod)
3603
3615
  ordType = self.safe_string(params, 'ordType')
3604
3616
  stop = self.safe_value_2(params, 'stop', 'trigger')
3605
- trailing = self.safe_value(params, 'trailing', False)
3617
+ trailing = self.safe_bool(params, 'trailing', False)
3606
3618
  if trailing:
3607
3619
  method = 'privateGetTradeOrdersAlgoHistory'
3608
3620
  request['ordType'] = 'move_order_stop'
@@ -3781,7 +3793,7 @@ class okx(Exchange, ImplicitAPI):
3781
3793
  method = self.safe_string(params, 'method', defaultMethod)
3782
3794
  ordType = self.safe_string(params, 'ordType')
3783
3795
  stop = self.safe_value_2(params, 'stop', 'trigger')
3784
- trailing = self.safe_value(params, 'trailing', False)
3796
+ trailing = self.safe_bool(params, 'trailing', False)
3785
3797
  if trailing or stop or (ordType in algoOrderTypes):
3786
3798
  method = 'privateGetTradeOrdersAlgoHistory'
3787
3799
  request['state'] = 'effective'
@@ -3935,10 +3947,12 @@ class okx(Exchange, ImplicitAPI):
3935
3947
  if symbol is not None:
3936
3948
  market = self.market(symbol)
3937
3949
  request['instId'] = market['id']
3950
+ if since is not None:
3951
+ request['begin'] = since
3938
3952
  request, params = self.handle_until_option('end', request, params)
3939
3953
  type, query = self.handle_market_type_and_params('fetchMyTrades', market, params)
3940
3954
  request['instType'] = self.convert_to_instrument_type(type)
3941
- if limit is not None:
3955
+ 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
3942
3956
  request['limit'] = limit # default 100, max 100
3943
3957
  response = self.privateGetTradeFillsHistory(self.extend(request, query))
3944
3958
  #
ccxt/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,
ccxt/phemex.py CHANGED
@@ -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
  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
ccxt/poloniexfutures.py CHANGED
@@ -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:
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.29'
7
+ __version__ = '4.2.31'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -64,6 +64,7 @@ from ccxt.pro.ndax import ndax # noqa
64
64
  from ccxt.pro.okcoin import okcoin # noqa: F401
65
65
  from ccxt.pro.okx import okx # noqa: F401
66
66
  from ccxt.pro.onetrading import onetrading # noqa: F401
67
+ from ccxt.pro.p2b import p2b # noqa: F401
67
68
  from ccxt.pro.phemex import phemex # noqa: F401
68
69
  from ccxt.pro.poloniex import poloniex # noqa: F401
69
70
  from ccxt.pro.poloniexfutures import poloniexfutures # noqa: F401
@@ -126,6 +127,7 @@ exchanges = [
126
127
  'okcoin',
127
128
  'okx',
128
129
  'onetrading',
130
+ 'p2b',
129
131
  'phemex',
130
132
  'poloniex',
131
133
  'poloniexfutures',
ccxt/pro/alpaca.py CHANGED
@@ -225,7 +225,7 @@ class alpaca(ccxt.async_support.alpaca):
225
225
  symbol = self.safe_symbol(marketId)
226
226
  datetime = self.safe_string(message, 't')
227
227
  timestamp = self.parse8601(datetime)
228
- isSnapshot = self.safe_value(message, 'r', False)
228
+ isSnapshot = self.safe_bool(message, 'r', False)
229
229
  orderbook = self.safe_value(self.orderbooks, symbol)
230
230
  if orderbook is None:
231
231
  orderbook = self.order_book()
ccxt/pro/binance.py CHANGED
@@ -1152,7 +1152,7 @@ class binance(ccxt.async_support.binance):
1152
1152
  if type in client.subscriptions:
1153
1153
  return None
1154
1154
  options = self.safe_value(self.options, 'watchBalance')
1155
- fetchBalanceSnapshot = self.safe_value(options, 'fetchBalanceSnapshot', False)
1155
+ fetchBalanceSnapshot = self.safe_bool(options, 'fetchBalanceSnapshot', False)
1156
1156
  if fetchBalanceSnapshot:
1157
1157
  messageHash = type + ':fetchBalanceSnapshot'
1158
1158
  if not (messageHash in client.futures):
@@ -1269,8 +1269,8 @@ class binance(ccxt.async_support.binance):
1269
1269
  self.set_balance_cache(client, type)
1270
1270
  self.set_positions_cache(client, type)
1271
1271
  options = self.safe_value(self.options, 'watchBalance')
1272
- fetchBalanceSnapshot = self.safe_value(options, 'fetchBalanceSnapshot', False)
1273
- awaitBalanceSnapshot = self.safe_value(options, 'awaitBalanceSnapshot', True)
1272
+ fetchBalanceSnapshot = self.safe_bool(options, 'fetchBalanceSnapshot', False)
1273
+ awaitBalanceSnapshot = self.safe_bool(options, 'awaitBalanceSnapshot', True)
1274
1274
  if fetchBalanceSnapshot and awaitBalanceSnapshot:
1275
1275
  await client.future(type + ':fetchBalanceSnapshot')
1276
1276
  messageHash = type + ':balance'
@@ -1417,7 +1417,7 @@ class binance(ccxt.async_support.binance):
1417
1417
  returnRateLimits = False
1418
1418
  returnRateLimits, params = self.handle_option_and_params(params, 'createOrderWs', 'returnRateLimits', False)
1419
1419
  payload['returnRateLimits'] = returnRateLimits
1420
- test = self.safe_value(params, 'test', False)
1420
+ test = self.safe_bool(params, 'test', False)
1421
1421
  params = self.omit(params, 'test')
1422
1422
  message = {
1423
1423
  'id': messageHash,
ccxt/pro/bitget.py CHANGED
@@ -847,7 +847,7 @@ class bitget(ccxt.async_support.bitget):
847
847
  await self.load_markets()
848
848
  market = None
849
849
  marketId = None
850
- isStop = self.safe_value(params, 'stop', False)
850
+ isStop = self.safe_bool(params, 'stop', False)
851
851
  params = self.omit(params, 'stop')
852
852
  messageHash = 'triggerOrder' if (isStop) else 'order'
853
853
  subscriptionHash = 'order:trades'
ccxt/pro/bitmart.py CHANGED
@@ -144,7 +144,7 @@ class bitmart(ccxt.async_support.bitmart):
144
144
  if subscribeHash in client.subscriptions:
145
145
  return
146
146
  options = self.safe_value(self.options, 'watchBalance')
147
- snapshot = self.safe_value(options, 'fetchBalanceSnapshot', True)
147
+ snapshot = self.safe_bool(options, 'fetchBalanceSnapshot', True)
148
148
  if snapshot:
149
149
  messageHash = type + ':' + 'fetchBalanceSnapshot'
150
150
  if not (messageHash in client.futures):