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/bitforex.py CHANGED
@@ -51,6 +51,9 @@ class bitforex(Exchange, ImplicitAPI):
51
51
  'fetchClosedOrders': True,
52
52
  'fetchCrossBorrowRate': False,
53
53
  'fetchCrossBorrowRates': False,
54
+ 'fetchDepositAddress': False,
55
+ 'fetchDepositAddresses': False,
56
+ 'fetchDepositAddressesByNetwork': False,
54
57
  'fetchFundingHistory': False,
55
58
  'fetchFundingRate': False,
56
59
  'fetchFundingRateHistory': False,
ccxt/bitget.py CHANGED
@@ -87,6 +87,7 @@ class bitget(Exchange, ImplicitAPI):
87
87
  'fetchCrossBorrowRate': True,
88
88
  'fetchCrossBorrowRates': False,
89
89
  'fetchCurrencies': True,
90
+ 'fetchDeposit': False,
90
91
  'fetchDepositAddress': True,
91
92
  'fetchDepositAddresses': False,
92
93
  'fetchDeposits': True,
@@ -116,6 +117,7 @@ class bitget(Exchange, ImplicitAPI):
116
117
  'fetchOpenOrders': True,
117
118
  'fetchOrder': True,
118
119
  'fetchOrderBook': True,
120
+ 'fetchOrderBooks': False,
119
121
  'fetchOrders': False,
120
122
  'fetchOrderTrades': False,
121
123
  'fetchPosition': True,
@@ -123,6 +125,7 @@ class bitget(Exchange, ImplicitAPI):
123
125
  'fetchPositions': True,
124
126
  'fetchPositionsRisk': False,
125
127
  'fetchPremiumIndexOHLCV': False,
128
+ 'fetchStatus': False,
126
129
  'fetchTicker': True,
127
130
  'fetchTickers': True,
128
131
  'fetchTime': True,
@@ -139,6 +142,7 @@ class bitget(Exchange, ImplicitAPI):
139
142
  'repayCrossMargin': True,
140
143
  'repayIsolatedMargin': True,
141
144
  'setLeverage': True,
145
+ 'setMargin': False,
142
146
  'setMarginMode': True,
143
147
  'setPositionMode': True,
144
148
  'signIn': False,
@@ -2188,7 +2192,7 @@ class bitget(Exchange, ImplicitAPI):
2188
2192
  'fee': None,
2189
2193
  }
2190
2194
  withdrawOptions = self.safe_value(self.options, 'withdraw', {})
2191
- fillResponseFromRequest = self.safe_value(withdrawOptions, 'fillResponseFromRequest', True)
2195
+ fillResponseFromRequest = self.safe_bool(withdrawOptions, 'fillResponseFromRequest', True)
2192
2196
  if fillResponseFromRequest:
2193
2197
  result['currency'] = code
2194
2198
  result['timestamp'] = self.milliseconds()
@@ -3015,7 +3019,7 @@ class bitget(Exchange, ImplicitAPI):
3015
3019
  marginMode, params = self.handle_margin_mode_and_params('fetchTradingFees', params)
3016
3020
  marketType, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
3017
3021
  if marketType == 'spot':
3018
- margin = self.safe_value(params, 'margin', False)
3022
+ margin = self.safe_bool(params, 'margin', False)
3019
3023
  params = self.omit(params, 'margin')
3020
3024
  if (marginMode is not None) or margin:
3021
3025
  response = self.publicMarginGetV2MarginCurrencies(params)
@@ -3966,7 +3970,7 @@ class bitget(Exchange, ImplicitAPI):
3966
3970
  if type == 'limit':
3967
3971
  request['price'] = self.price_to_precision(symbol, price)
3968
3972
  triggerType = self.safe_string(params, 'triggerType', 'mark_price')
3969
- reduceOnly = self.safe_value(params, 'reduceOnly', False)
3973
+ reduceOnly = self.safe_bool(params, 'reduceOnly', False)
3970
3974
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
3971
3975
  exchangeSpecificTifParam = self.safe_string_2(params, 'force', 'timeInForce')
3972
3976
  postOnly = None
@@ -4041,7 +4045,7 @@ class bitget(Exchange, ImplicitAPI):
4041
4045
  marginMode = 'cross'
4042
4046
  marginModeRequest = 'crossed' if (marginMode == 'cross') else 'isolated'
4043
4047
  request['marginMode'] = marginModeRequest
4044
- oneWayMode = self.safe_value(params, 'oneWayMode', False)
4048
+ oneWayMode = self.safe_bool(params, 'oneWayMode', False)
4045
4049
  params = self.omit(params, 'oneWayMode')
4046
4050
  requestSide = side
4047
4051
  if reduceOnly:
ccxt/bitmart.py CHANGED
@@ -1864,7 +1864,7 @@ class bitmart(Exchange, ImplicitAPI):
1864
1864
  marketType = None
1865
1865
  marketType, params = self.handle_market_type_and_params('fetchBalance', None, params)
1866
1866
  marginMode = self.safe_string(params, 'marginMode')
1867
- isMargin = self.safe_value(params, 'margin', False)
1867
+ isMargin = self.safe_bool(params, 'margin', False)
1868
1868
  params = self.omit(params, ['margin', 'marginMode'])
1869
1869
  if marginMode is not None or isMargin:
1870
1870
  marketType = 'margin'
@@ -2643,7 +2643,7 @@ class bitmart(Exchange, ImplicitAPI):
2643
2643
  if isStop:
2644
2644
  response = self.privateGetContractPrivateCurrentPlanOrder(self.extend(request, params))
2645
2645
  else:
2646
- trailing = self.safe_value(params, 'trailing', False)
2646
+ trailing = self.safe_bool(params, 'trailing', False)
2647
2647
  orderType = self.safe_string(params, 'orderType')
2648
2648
  params = self.omit(params, ['orderType', 'trailing'])
2649
2649
  if trailing:
@@ -2798,7 +2798,7 @@ class bitmart(Exchange, ImplicitAPI):
2798
2798
  elif type == 'swap':
2799
2799
  if symbol is None:
2800
2800
  raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
2801
- trailing = self.safe_value(params, 'trailing', False)
2801
+ trailing = self.safe_bool(params, 'trailing', False)
2802
2802
  orderType = self.safe_string(params, 'orderType')
2803
2803
  params = self.omit(params, ['orderType', 'trailing'])
2804
2804
  if trailing:
ccxt/bitmex.py CHANGED
@@ -349,8 +349,8 @@ class bitmex(Exchange, ImplicitAPI):
349
349
  network = self.network_id_to_code(networkId)
350
350
  withdrawalFeeRaw = self.safe_string(chain, 'withdrawalFee')
351
351
  withdrawalFee = self.parse_number(Precise.string_mul(withdrawalFeeRaw, precisionString))
352
- isDepositEnabled = self.safe_value(chain, 'depositEnabled', False)
353
- isWithdrawEnabled = self.safe_value(chain, 'withdrawalEnabled', False)
352
+ isDepositEnabled = self.safe_bool(chain, 'depositEnabled', False)
353
+ isWithdrawEnabled = self.safe_bool(chain, 'withdrawalEnabled', False)
354
354
  active = (isDepositEnabled and isWithdrawEnabled)
355
355
  if isDepositEnabled:
356
356
  depositEnabled = True
@@ -1637,7 +1637,7 @@ class bitmex(Exchange, ImplicitAPI):
1637
1637
  defaultSubType = self.safe_string(self.options, 'defaultSubType', 'linear')
1638
1638
  isInverse = (defaultSubType == 'inverse')
1639
1639
  else:
1640
- isInverse = self.safe_value(market, 'inverse', False)
1640
+ isInverse = self.safe_bool(market, 'inverse', False)
1641
1641
  if isInverse:
1642
1642
  cost = self.convert_from_raw_quantity(symbol, qty)
1643
1643
  else:
@@ -2277,7 +2277,7 @@ class bitmex(Exchange, ImplicitAPI):
2277
2277
  item = response[i]
2278
2278
  marketId = self.safe_string(item, 'symbol')
2279
2279
  market = self.safe_market(marketId)
2280
- swap = self.safe_value(market, 'swap', False)
2280
+ swap = self.safe_bool(market, 'swap', False)
2281
2281
  if swap:
2282
2282
  filteredResponse.append(item)
2283
2283
  symbols = self.market_symbols(symbols)
ccxt/bitrue.py CHANGED
@@ -2963,7 +2963,7 @@ class bitrue(Exchange, ImplicitAPI):
2963
2963
  return None # fallback to default error handler
2964
2964
  # check success value for wapi endpoints
2965
2965
  # response in format {'msg': 'The coin does not exist.', 'success': True/false}
2966
- success = self.safe_value(response, 'success', True)
2966
+ success = self.safe_bool(response, 'success', True)
2967
2967
  if not success:
2968
2968
  messageInner = self.safe_string(response, 'msg')
2969
2969
  parsedMessage = None
ccxt/bitso.py CHANGED
@@ -1634,7 +1634,7 @@ class bitso(Exchange, ImplicitAPI):
1634
1634
  #
1635
1635
  # {"success":false,"error":{"code":104,"message":"Cannot perform request - nonce must be higher than 1520307203724237"}}
1636
1636
  #
1637
- success = self.safe_value(response, 'success', False)
1637
+ success = self.safe_bool(response, 'success', False)
1638
1638
  if isinstance(success, str):
1639
1639
  if (success == 'true') or (success == '1'):
1640
1640
  success = True
ccxt/bitteam.py CHANGED
@@ -360,7 +360,7 @@ class bitteam(Exchange, ImplicitAPI):
360
360
  created = self.parse8601(timeStart)
361
361
  minCost = None
362
362
  currenciesValuedInUsd = self.safe_value(self.options, 'currenciesValuedInUsd', {})
363
- quoteInUsd = self.safe_value(currenciesValuedInUsd, quote, False)
363
+ quoteInUsd = self.safe_bool(currenciesValuedInUsd, quote, False)
364
364
  if quoteInUsd:
365
365
  settings = self.safe_value(market, 'settings', {})
366
366
  minCost = self.safe_number(settings, 'limit_usd')
@@ -544,7 +544,7 @@ class bitteam(Exchange, ImplicitAPI):
544
544
  id = self.safe_string(currency, 'symbol')
545
545
  numericId = self.safe_integer(currency, 'id')
546
546
  code = self.safe_currency_code(id)
547
- active = self.safe_value(currency, 'active', False)
547
+ active = self.safe_bool(currency, 'active', False)
548
548
  precision = self.safe_integer(currency, 'precision')
549
549
  txLimits = self.safe_value(currency, 'txLimits', {})
550
550
  minWithdraw = self.safe_string(txLimits, 'minWithdraw')
ccxt/btcalpha.py CHANGED
@@ -655,7 +655,7 @@ class btcalpha(Exchange, ImplicitAPI):
655
655
  marketId = self.safe_string(order, 'pair')
656
656
  market = self.safe_market(marketId, market, '_')
657
657
  symbol = market['symbol']
658
- success = self.safe_value(order, 'success', False)
658
+ success = self.safe_bool(order, 'success', False)
659
659
  timestamp = None
660
660
  if success:
661
661
  timestamp = self.safe_timestamp(order, 'date')
ccxt/bybit.py CHANGED
@@ -310,8 +310,6 @@ class bybit(Exchange, ImplicitAPI):
310
310
  # account
311
311
  'v5/account/wallet-balance': 1,
312
312
  'v5/account/borrow-history': 1,
313
- 'v5/account/set-collateral-switch': 5,
314
- 'v5/account/set-collateral-switch-batch': 5,
315
313
  'v5/account/collateral-info': 1,
316
314
  'v5/asset/coin-greeks': 1,
317
315
  'v5/account/fee-rate': 10, # 5/s = 1000 / (20 * 10)
@@ -504,6 +502,8 @@ class bybit(Exchange, ImplicitAPI):
504
502
  'v5/lending/purchase': 5,
505
503
  'v5/lending/redeem': 5,
506
504
  'v5/lending/redeem-cancel': 5,
505
+ 'v5/account/set-collateral-switch': 5,
506
+ 'v5/account/set-collateral-switch-batch': 5,
507
507
  },
508
508
  },
509
509
  },
@@ -3291,7 +3291,7 @@ class bybit(Exchange, ImplicitAPI):
3291
3291
  result = self.fetch_orders(symbol, None, None, self.extend(request, params))
3292
3292
  length = len(result)
3293
3293
  if length == 0:
3294
- isTrigger = self.safe_value_n(params, ['trigger', 'stop'], False)
3294
+ isTrigger = self.safe_bool_n(params, ['trigger', 'stop'], False)
3295
3295
  extra = '' if isTrigger else 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = True'
3296
3296
  raise OrderNotFound('Order ' + str(id) + ' was not found.' + extra)
3297
3297
  if length > 1:
ccxt/coinbase.py CHANGED
@@ -214,6 +214,13 @@ class coinbase(Exchange, ImplicitAPI):
214
214
  'brokerage/best_bid_ask',
215
215
  'brokerage/convert/trade/{trade_id}',
216
216
  'brokerage/time',
217
+ 'brokerage/cfm/balance_summary',
218
+ 'brokerage/cfm/positions',
219
+ 'brokerage/cfm/positions/{product_id}',
220
+ 'brokerage/cfm/sweeps',
221
+ 'brokerage/intx/portfolio/{portfolio_uuid}',
222
+ 'brokerage/intx/positions/{portfolio_uuid}',
223
+ 'brokerage/intx/positions/{portfolio_uuid}/{symbol}',
217
224
  ],
218
225
  'post': [
219
226
  'brokerage/orders',
@@ -224,12 +231,15 @@ class coinbase(Exchange, ImplicitAPI):
224
231
  'brokerage/portfolios/move_funds',
225
232
  'brokerage/convert/quote',
226
233
  'brokerage/convert/trade/{trade_id}',
234
+ 'brokerage/cfm/sweeps/schedule',
235
+ 'brokerage/intx/allocate',
227
236
  ],
228
237
  'put': [
229
238
  'brokerage/portfolios/{portfolio_uuid}',
230
239
  ],
231
240
  'delete': [
232
241
  'brokerage/portfolios/{portfolio_uuid}',
242
+ 'brokerage/cfm/sweeps',
233
243
  ],
234
244
  },
235
245
  },
@@ -1322,7 +1332,10 @@ class coinbase(Exchange, ImplicitAPI):
1322
1332
  def fetch_tickers_v3(self, symbols: Strings = None, params={}):
1323
1333
  self.load_markets()
1324
1334
  symbols = self.market_symbols(symbols)
1325
- response = self.v3PrivateGetBrokerageProducts(params)
1335
+ request = {}
1336
+ if symbols is not None:
1337
+ request['product_ids'] = self.market_ids(symbols)
1338
+ response = self.v3PrivateGetBrokerageProducts(self.extend(request, params))
1326
1339
  #
1327
1340
  # {
1328
1341
  # "products": [
@@ -1624,7 +1637,7 @@ class coinbase(Exchange, ImplicitAPI):
1624
1637
  'limit': 250,
1625
1638
  }
1626
1639
  response = None
1627
- isV3 = self.safe_value(params, 'v3', False)
1640
+ isV3 = self.safe_bool(params, 'v3', False)
1628
1641
  params = self.omit(params, 'v3')
1629
1642
  method = self.safe_string(self.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts')
1630
1643
  if (isV3) or (method == 'v3PrivateGetBrokerageAccounts'):
@@ -3023,8 +3036,10 @@ class coinbase(Exchange, ImplicitAPI):
3023
3036
  """
3024
3037
  self.load_markets()
3025
3038
  symbols = self.market_symbols(symbols)
3026
- # the 'product_ids' param isn't working properly and returns {"pricebooks":[]} when defined
3027
- response = self.v3PrivateGetBrokerageBestBidAsk(params)
3039
+ request = {}
3040
+ if symbols is not None:
3041
+ request['product_ids'] = self.market_ids(symbols)
3042
+ response = self.v3PrivateGetBrokerageBestBidAsk(self.extend(request, params))
3028
3043
  #
3029
3044
  # {
3030
3045
  # "pricebooks": [
@@ -3147,7 +3162,7 @@ class coinbase(Exchange, ImplicitAPI):
3147
3162
  savedPath = fullPath
3148
3163
  if method == 'GET':
3149
3164
  if query:
3150
- fullPath += '?' + self.urlencode(query)
3165
+ fullPath += '?' + self.urlencode_with_array_repeat(query)
3151
3166
  url = self.urls['api']['rest'] + fullPath
3152
3167
  if signed:
3153
3168
  authorization = self.safe_string(self.headers, 'Authorization')
ccxt/coincheck.py CHANGED
@@ -784,7 +784,7 @@ class coincheck(Exchange, ImplicitAPI):
784
784
  # {"success":false,"error":"disabled API Key"}'
785
785
  # {"success":false,"error":"invalid authentication"}
786
786
  #
787
- success = self.safe_value(response, 'success', True)
787
+ success = self.safe_bool(response, 'success', True)
788
788
  if not success:
789
789
  error = self.safe_string(response, 'error')
790
790
  feedback = self.id + ' ' + self.json(response)
ccxt/coinex.py CHANGED
@@ -3106,7 +3106,7 @@ class coinex(Exchange, ImplicitAPI):
3106
3106
  data = self.safe_value(response, 'data', {})
3107
3107
  depositAddress = self.parse_deposit_address(data, currency)
3108
3108
  options = self.safe_value(self.options, 'fetchDepositAddress', {})
3109
- fillResponseFromRequest = self.safe_value(options, 'fillResponseFromRequest', True)
3109
+ fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
3110
3110
  if fillResponseFromRequest:
3111
3111
  depositAddress['network'] = self.safe_network_code(network, currency)
3112
3112
  return depositAddress
@@ -4997,7 +4997,7 @@ class coinex(Exchange, ImplicitAPI):
4997
4997
  :returns Array: the marginMode in lowercase
4998
4998
  """
4999
4999
  defaultType = self.safe_string(self.options, 'defaultType')
5000
- isMargin = self.safe_value(params, 'margin', False)
5000
+ isMargin = self.safe_bool(params, 'margin', False)
5001
5001
  marginMode = None
5002
5002
  marginMode, params = super(coinex, self).handle_margin_mode_and_params(methodName, params, defaultValue)
5003
5003
  if marginMode is None:
ccxt/coinlist.py CHANGED
@@ -372,7 +372,7 @@ class coinlist(Exchange, ImplicitAPI):
372
372
  currency = currencies[i]
373
373
  id = self.safe_string(currency, 'asset')
374
374
  code = self.safe_currency_code(id)
375
- isTransferable = self.safe_value(currency, 'is_transferable', False)
375
+ isTransferable = self.safe_bool(currency, 'is_transferable', False)
376
376
  withdrawEnabled = isTransferable
377
377
  depositEnabled = isTransferable
378
378
  active = isTransferable
ccxt/coinmate.py CHANGED
@@ -530,7 +530,7 @@ class coinmate(Exchange, ImplicitAPI):
530
530
  #
531
531
  data = self.safe_value(response, 'data')
532
532
  transaction = self.parse_transaction(data, currency)
533
- fillResponseFromRequest = self.safe_value(withdrawOptions, 'fillResponseFromRequest', True)
533
+ fillResponseFromRequest = self.safe_bool(withdrawOptions, 'fillResponseFromRequest', True)
534
534
  if fillResponseFromRequest:
535
535
  transaction['amount'] = amount
536
536
  transaction['currency'] = code
ccxt/coinmetro.py CHANGED
@@ -380,7 +380,7 @@ class coinmetro(Exchange, ImplicitAPI):
380
380
  quote = self.safe_currency_code(quoteId)
381
381
  basePrecisionAndLimits = self.parse_market_precision_and_limits(baseId)
382
382
  quotePrecisionAndLimits = self.parse_market_precision_and_limits(quoteId)
383
- margin = self.safe_value(market, 'margin', False)
383
+ margin = self.safe_bool(market, 'margin', False)
384
384
  tradingFees = self.safe_value(self.fees, 'trading', {})
385
385
  return self.safe_market_structure({
386
386
  'id': id,
@@ -1272,7 +1272,7 @@ class coinmetro(Exchange, ImplicitAPI):
1272
1272
  }
1273
1273
  marginMode = None
1274
1274
  params, params = self.handle_margin_mode_and_params('cancelOrder', params)
1275
- isMargin = self.safe_value(params, 'margin', False)
1275
+ isMargin = self.safe_bool(params, 'margin', False)
1276
1276
  params = self.omit(params, 'margin')
1277
1277
  response = None
1278
1278
  if isMargin or (marginMode is not None):
ccxt/coinsph.py CHANGED
@@ -1478,7 +1478,7 @@ class coinsph(Exchange, ImplicitAPI):
1478
1478
  :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1479
1479
  """
1480
1480
  options = self.safe_value(self.options, 'withdraw')
1481
- warning = self.safe_value(options, 'warning', True)
1481
+ warning = self.safe_bool(options, 'warning', True)
1482
1482
  if warning:
1483
1483
  raise InvalidAddress(self.id + " withdraw() makes a withdrawals only to coins_ph account, add .options['withdraw']['warning'] = False to make a withdrawal to your coins_ph account")
1484
1484
  networkCode = self.safe_string(params, 'network')
ccxt/cryptocom.py CHANGED
@@ -1018,7 +1018,7 @@ class cryptocom(Exchange, ImplicitAPI):
1018
1018
  request['time_in_force'] = 'FILL_OR_KILL'
1019
1019
  else:
1020
1020
  request['time_in_force'] = timeInForce
1021
- postOnly = self.safe_value(params, 'postOnly', False)
1021
+ postOnly = self.safe_bool(params, 'postOnly', False)
1022
1022
  if (postOnly) or (timeInForce == 'PO'):
1023
1023
  request['exec_inst'] = ['POST_ONLY']
1024
1024
  request['time_in_force'] = 'GOOD_TILL_CANCEL'
@@ -1204,7 +1204,7 @@ class cryptocom(Exchange, ImplicitAPI):
1204
1204
  request['time_in_force'] = 'FILL_OR_KILL'
1205
1205
  else:
1206
1206
  request['time_in_force'] = timeInForce
1207
- postOnly = self.safe_value(params, 'postOnly', False)
1207
+ postOnly = self.safe_bool(params, 'postOnly', False)
1208
1208
  if (postOnly) or (timeInForce == 'PO'):
1209
1209
  request['exec_inst'] = ['POST_ONLY']
1210
1210
  request['time_in_force'] = 'GOOD_TILL_CANCEL'
@@ -2091,7 +2091,7 @@ class cryptocom(Exchange, ImplicitAPI):
2091
2091
  :returns Array: the marginMode in lowercase
2092
2092
  """
2093
2093
  defaultType = self.safe_string(self.options, 'defaultType')
2094
- isMargin = self.safe_value(params, 'margin', False)
2094
+ isMargin = self.safe_bool(params, 'margin', False)
2095
2095
  params = self.omit(params, 'margin')
2096
2096
  marginMode = None
2097
2097
  marginMode, params = self.handle_margin_mode_and_params(methodName, params)
ccxt/deribit.py CHANGED
@@ -1301,6 +1301,7 @@ class deribit(Exchange, ImplicitAPI):
1301
1301
  request['start_timestamp'] = now - (limit - 1) * duration * 1000
1302
1302
  request['end_timestamp'] = now
1303
1303
  else:
1304
+ since = max(since - 1, 0)
1304
1305
  request['start_timestamp'] = since
1305
1306
  if limit is None:
1306
1307
  request['end_timestamp'] = now
ccxt/digifinex.py CHANGED
@@ -1132,9 +1132,11 @@ class digifinex(Exchange, ImplicitAPI):
1132
1132
  # "timestamp": 1663221614998
1133
1133
  # }
1134
1134
  #
1135
+ indexPrice = self.safe_number(ticker, 'index_price')
1136
+ marketType = 'contract' if (indexPrice is not None) else 'spot'
1135
1137
  marketId = self.safe_string_upper_2(ticker, 'symbol', 'instrument_id')
1136
- symbol = self.safe_symbol(marketId, market)
1137
- market = self.safe_market(marketId)
1138
+ symbol = self.safe_symbol(marketId, market, None, marketType)
1139
+ market = self.safe_market(marketId, market, None, marketType)
1138
1140
  timestamp = self.safe_timestamp(ticker, 'date')
1139
1141
  if market['swap']:
1140
1142
  timestamp = self.safe_integer(ticker, 'timestamp')
@@ -1661,7 +1663,7 @@ class digifinex(Exchange, ImplicitAPI):
1661
1663
  postOnly = self.is_post_only(isMarketOrder, False, params)
1662
1664
  postOnlyParsed = None
1663
1665
  if swap:
1664
- reduceOnly = self.safe_value(params, 'reduceOnly', False)
1666
+ reduceOnly = self.safe_bool(params, 'reduceOnly', False)
1665
1667
  timeInForce = self.safe_string(params, 'timeInForce')
1666
1668
  orderType = None
1667
1669
  if side == 'buy':
@@ -3653,7 +3655,7 @@ class digifinex(Exchange, ImplicitAPI):
3653
3655
  :returns Array: the marginMode in lowercase
3654
3656
  """
3655
3657
  defaultType = self.safe_string(self.options, 'defaultType')
3656
- isMargin = self.safe_value(params, 'margin', False)
3658
+ isMargin = self.safe_bool(params, 'margin', False)
3657
3659
  marginMode = None
3658
3660
  marginMode, params = super(digifinex, self).handle_margin_mode_and_params(methodName, params, defaultValue)
3659
3661
  if marginMode is not None:
ccxt/exmo.py CHANGED
@@ -259,7 +259,7 @@ class exmo(Exchange, ImplicitAPI):
259
259
  #
260
260
  margin = self.parse_margin_modification(response, market)
261
261
  options = self.safe_value(self.options, 'margin', {})
262
- fillResponseFromRequest = self.safe_value(options, 'fillResponseFromRequest', True)
262
+ fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
263
263
  if fillResponseFromRequest:
264
264
  margin['type'] = type
265
265
  margin['amount'] = amount
@@ -2412,7 +2412,7 @@ class exmo(Exchange, ImplicitAPI):
2412
2412
  # {"result":false,"error":"Error 50052: Insufficient funds"}
2413
2413
  # {"s":"error","errmsg":"strconv.ParseInt: parsing \"\": invalid syntax"}
2414
2414
  #
2415
- success = self.safe_value(response, 'result', False)
2415
+ success = self.safe_bool(response, 'result', False)
2416
2416
  if isinstance(success, str):
2417
2417
  if (success == 'true') or (success == '1'):
2418
2418
  success = True
ccxt/gate.py CHANGED
@@ -1562,9 +1562,9 @@ class gate(Exchange, ImplicitAPI):
1562
1562
  networkId = self.safe_string(entry, 'chain')
1563
1563
  networkCode = self.network_id_to_code(networkId, code)
1564
1564
  delisted = self.safe_value(entry, 'delisted')
1565
- withdrawDisabled = self.safe_value(entry, 'withdraw_disabled', False)
1566
- depositDisabled = self.safe_value(entry, 'deposit_disabled', False)
1567
- tradeDisabled = self.safe_value(entry, 'trade_disabled', False)
1565
+ withdrawDisabled = self.safe_bool(entry, 'withdraw_disabled', False)
1566
+ depositDisabled = self.safe_bool(entry, 'deposit_disabled', False)
1567
+ tradeDisabled = self.safe_bool(entry, 'trade_disabled', False)
1568
1568
  withdrawEnabled = not withdrawDisabled
1569
1569
  depositEnabled = not depositDisabled
1570
1570
  tradeEnabled = not tradeDisabled
@@ -3805,7 +3805,7 @@ class gate(Exchange, ImplicitAPI):
3805
3805
  if timeInForce is not None:
3806
3806
  request['time_in_force'] = timeInForce
3807
3807
  clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
3808
- textIsRequired = self.safe_value(params, 'textIsRequired', False)
3808
+ textIsRequired = self.safe_bool(params, 'textIsRequired', False)
3809
3809
  if clientOrderId is not None:
3810
3810
  # user-defined, must follow the rules if not empty
3811
3811
  # prefixed with t-
@@ -4146,7 +4146,7 @@ class gate(Exchange, ImplicitAPI):
4146
4146
  # "message": "Not enough balance"
4147
4147
  # }
4148
4148
  #
4149
- succeeded = self.safe_value(order, 'succeeded', True)
4149
+ succeeded = self.safe_bool(order, 'succeeded', True)
4150
4150
  if not succeeded:
4151
4151
  # cancelOrders response
4152
4152
  return self.safe_order({
ccxt/gemini.py CHANGED
@@ -512,7 +512,7 @@ class gemini(Exchange, ImplicitAPI):
512
512
  'post_only': True,
513
513
  'limit_only': True,
514
514
  }
515
- return self.safe_value(statuses, status, True)
515
+ return self.safe_bool(statuses, status, True)
516
516
 
517
517
  def fetch_usdt_markets(self, params={}):
518
518
  # these markets can't be scrapped and fetchMarketsFrom api does an extra call
@@ -548,7 +548,7 @@ class gemini(Exchange, ImplicitAPI):
548
548
  }
549
549
  result[marketId] = self.parse_market(market)
550
550
  options = self.safe_value(self.options, 'fetchMarketsFromAPI', {})
551
- fetchDetailsForAllSymbols = self.safe_value(options, 'fetchDetailsForAllSymbols', False)
551
+ fetchDetailsForAllSymbols = self.safe_bool(options, 'fetchDetailsForAllSymbols', False)
552
552
  fetchDetailsForMarketIds = self.safe_value(options, 'fetchDetailsForMarketIds', [])
553
553
  promises = []
554
554
  marketIds = []
@@ -1313,7 +1313,7 @@ class gemini(Exchange, ImplicitAPI):
1313
1313
  request['options'] = ['fill-or-kill']
1314
1314
  elif timeInForce == 'PO':
1315
1315
  request['options'] = ['maker-or-cancel']
1316
- postOnly = self.safe_value(params, 'postOnly', False)
1316
+ postOnly = self.safe_bool(params, 'postOnly', False)
1317
1317
  params = self.omit(params, 'postOnly')
1318
1318
  if postOnly:
1319
1319
  request['options'] = ['maker-or-cancel']
ccxt/hitbtc.py CHANGED
@@ -704,7 +704,7 @@ class hitbtc(Exchange, ImplicitAPI):
704
704
  expiry = self.safe_integer(market, 'expiry')
705
705
  contract = (marketType == 'futures')
706
706
  spot = (marketType == 'spot')
707
- marginTrading = self.safe_value(market, 'margin_trading', False)
707
+ marginTrading = self.safe_bool(market, 'margin_trading', False)
708
708
  margin = spot and marginTrading
709
709
  future = (expiry is not None)
710
710
  swap = (contract and not future)
@@ -833,9 +833,9 @@ class hitbtc(Exchange, ImplicitAPI):
833
833
  entry = response[currencyId]
834
834
  name = self.safe_string(entry, 'full_name')
835
835
  precision = self.safe_number(entry, 'precision_transfer')
836
- payinEnabled = self.safe_value(entry, 'payin_enabled', False)
837
- payoutEnabled = self.safe_value(entry, 'payout_enabled', False)
838
- transferEnabled = self.safe_value(entry, 'transfer_enabled', False)
836
+ payinEnabled = self.safe_bool(entry, 'payin_enabled', False)
837
+ payoutEnabled = self.safe_bool(entry, 'payout_enabled', False)
838
+ transferEnabled = self.safe_bool(entry, 'transfer_enabled', False)
839
839
  active = payinEnabled and payoutEnabled and transferEnabled
840
840
  rawNetworks = self.safe_value(entry, 'networks', [])
841
841
  networks = {}
@@ -848,8 +848,8 @@ class hitbtc(Exchange, ImplicitAPI):
848
848
  network = self.safe_network(networkId)
849
849
  fee = self.safe_number(rawNetwork, 'payout_fee')
850
850
  networkPrecision = self.safe_number(rawNetwork, 'precision_payout')
851
- payinEnabledNetwork = self.safe_value(entry, 'payin_enabled', False)
852
- payoutEnabledNetwork = self.safe_value(entry, 'payout_enabled', False)
851
+ payinEnabledNetwork = self.safe_bool(entry, 'payin_enabled', False)
852
+ payoutEnabledNetwork = self.safe_bool(entry, 'payout_enabled', False)
853
853
  activeNetwork = payinEnabledNetwork and payoutEnabledNetwork
854
854
  if payinEnabledNetwork and not depositEnabled:
855
855
  depositEnabled = True
@@ -2511,7 +2511,7 @@ class hitbtc(Exchange, ImplicitAPI):
2511
2511
  request['currency'] = parsedNetwork
2512
2512
  params = self.omit(params, 'network')
2513
2513
  withdrawOptions = self.safe_value(self.options, 'withdraw', {})
2514
- includeFee = self.safe_value(withdrawOptions, 'includeFee', False)
2514
+ includeFee = self.safe_bool(withdrawOptions, 'includeFee', False)
2515
2515
  if includeFee:
2516
2516
  request['include_fee'] = True
2517
2517
  response = self.privatePostWalletCryptoWithdraw(self.extend(request, params))
@@ -2995,7 +2995,7 @@ class hitbtc(Exchange, ImplicitAPI):
2995
2995
  self.load_markets()
2996
2996
  market = self.market(symbol)
2997
2997
  leverage = self.safe_string(params, 'leverage')
2998
- if market['type'] == 'swap':
2998
+ if market['swap']:
2999
2999
  if leverage is None:
3000
3000
  raise ArgumentsRequired(self.id + ' modifyMarginHelper() requires a leverage parameter for swap markets')
3001
3001
  if amount != 0:
@@ -3014,17 +3014,13 @@ class hitbtc(Exchange, ImplicitAPI):
3014
3014
  marginMode = None
3015
3015
  marketType, params = self.handle_market_type_and_params('modifyMarginHelper', market, params)
3016
3016
  marginMode, params = self.handle_margin_mode_and_params('modifyMarginHelper', params)
3017
- params = self.omit(params, ['marginMode', 'margin'])
3018
3017
  response = None
3019
- if marginMode is not None:
3018
+ if marketType == 'swap':
3019
+ response = self.privatePutFuturesAccountIsolatedSymbol(self.extend(request, params))
3020
+ elif (marketType == 'margin') or (marketType == 'spot') or (marginMode == 'isolated'):
3020
3021
  response = self.privatePutMarginAccountIsolatedSymbol(self.extend(request, params))
3021
3022
  else:
3022
- if marketType == 'swap':
3023
- response = self.privatePutFuturesAccountIsolatedSymbol(self.extend(request, params))
3024
- elif marketType == 'margin':
3025
- response = self.privatePutMarginAccountIsolatedSymbol(self.extend(request, params))
3026
- else:
3027
- raise NotSupported(self.id + ' modifyMarginHelper() not support self market type')
3023
+ raise NotSupported(self.id + ' modifyMarginHelper() not support self market type')
3028
3024
  #
3029
3025
  # {
3030
3026
  # "symbol": "BTCUSDT_PERP",
@@ -3309,7 +3305,7 @@ class hitbtc(Exchange, ImplicitAPI):
3309
3305
  :returns Array: the marginMode in lowercase
3310
3306
  """
3311
3307
  defaultType = self.safe_string(self.options, 'defaultType')
3312
- isMargin = self.safe_value(params, 'margin', False)
3308
+ isMargin = self.safe_bool(params, 'margin', False)
3313
3309
  marginMode = None
3314
3310
  marginMode, params = super(hitbtc, self).handle_margin_mode_and_params(methodName, params, defaultValue)
3315
3311
  if marginMode is None:
ccxt/hollaex.py CHANGED
@@ -1053,7 +1053,7 @@ class hollaex(Exchange, ImplicitAPI):
1053
1053
  filled = self.safe_string(order, 'filled')
1054
1054
  status = self.parse_order_status(self.safe_string(order, 'status'))
1055
1055
  meta = self.safe_value(order, 'meta', {})
1056
- postOnly = self.safe_value(meta, 'post_only', False)
1056
+ postOnly = self.safe_bool(meta, 'post_only', False)
1057
1057
  return self.safe_order({
1058
1058
  'id': id,
1059
1059
  'clientOrderId': None,
@@ -1105,7 +1105,7 @@ class hollaex(Exchange, ImplicitAPI):
1105
1105
  }
1106
1106
  stopPrice = self.safe_number_n(params, ['triggerPrice', 'stopPrice', 'stop'])
1107
1107
  meta = self.safe_value(params, 'meta', {})
1108
- exchangeSpecificParam = self.safe_value(meta, 'post_only', False)
1108
+ exchangeSpecificParam = self.safe_bool(meta, 'post_only', False)
1109
1109
  isMarketOrder = type == 'market'
1110
1110
  postOnly = self.is_post_only(isMarketOrder, exchangeSpecificParam, params)
1111
1111
  if not isMarketOrder: