ccxt 4.2.39__py2.py3-none-any.whl → 4.2.40__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.2.39'
25
+ __version__ = '4.2.40'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/bingx.py CHANGED
@@ -16,6 +16,7 @@ class ImplicitAPI:
16
16
  spot_v1_private_post_trade_order = spotV1PrivatePostTradeOrder = Entry('trade/order', ['spot', 'v1', 'private'], 'POST', {'cost': 3})
17
17
  spot_v1_private_post_trade_cancel = spotV1PrivatePostTradeCancel = Entry('trade/cancel', ['spot', 'v1', 'private'], 'POST', {'cost': 3})
18
18
  spot_v1_private_post_trade_batchorders = spotV1PrivatePostTradeBatchOrders = Entry('trade/batchOrders', ['spot', 'v1', 'private'], 'POST', {'cost': 3})
19
+ spot_v1_private_post_trade_order_cancelreplace = spotV1PrivatePostTradeOrderCancelReplace = Entry('trade/order/cancelReplace', ['spot', 'v1', 'private'], 'POST', {'cost': 3})
19
20
  spot_v1_private_post_trade_cancelorders = spotV1PrivatePostTradeCancelOrders = Entry('trade/cancelOrders', ['spot', 'v1', 'private'], 'POST', {'cost': 3})
20
21
  spot_v1_private_post_trade_cancelopenorders = spotV1PrivatePostTradeCancelOpenOrders = Entry('trade/cancelOpenOrders', ['spot', 'v1', 'private'], 'POST', {'cost': 3})
21
22
  spot_v3_private_get_get_asset_transfer = spotV3PrivateGetGetAssetTransfer = Entry('get/asset/transfer', ['spot', 'v3', 'private'], 'GET', {'cost': 3})
@@ -23,8 +24,11 @@ class ImplicitAPI:
23
24
  spot_v3_private_get_capital_deposit_hisrec = spotV3PrivateGetCapitalDepositHisrec = Entry('capital/deposit/hisrec', ['spot', 'v3', 'private'], 'GET', {'cost': 3})
24
25
  spot_v3_private_get_capital_withdraw_history = spotV3PrivateGetCapitalWithdrawHistory = Entry('capital/withdraw/history', ['spot', 'v3', 'private'], 'GET', {'cost': 3})
25
26
  spot_v3_private_post_post_asset_transfer = spotV3PrivatePostPostAssetTransfer = Entry('post/asset/transfer', ['spot', 'v3', 'private'], 'POST', {'cost': 3})
27
+ swap_v1_public_get_ticker_price = swapV1PublicGetTickerPrice = Entry('ticker/price', ['swap', 'v1', 'public'], 'GET', {'cost': 1})
26
28
  swap_v1_private_get_positionside_dual = swapV1PrivateGetPositionSideDual = Entry('positionSide/dual', ['swap', 'v1', 'private'], 'GET', {'cost': 1})
27
29
  swap_v1_private_get_market_markpriceklines = swapV1PrivateGetMarketMarkPriceKlines = Entry('market/markPriceKlines', ['swap', 'v1', 'private'], 'GET', {'cost': 1})
30
+ swap_v1_private_get_trade_batchcancelreplace = swapV1PrivateGetTradeBatchCancelReplace = Entry('trade/batchCancelReplace', ['swap', 'v1', 'private'], 'GET', {'cost': 1})
31
+ swap_v1_private_post_trade_cancelreplace = swapV1PrivatePostTradeCancelReplace = Entry('trade/cancelReplace', ['swap', 'v1', 'private'], 'POST', {'cost': 1})
28
32
  swap_v1_private_post_positionside_dual = swapV1PrivatePostPositionSideDual = Entry('positionSide/dual', ['swap', 'v1', 'private'], 'POST', {'cost': 1})
29
33
  swap_v2_public_get_server_time = swapV2PublicGetServerTime = Entry('server/time', ['swap', 'v2', 'public'], 'GET', {'cost': 3})
30
34
  swap_v2_public_get_quote_contracts = swapV2PublicGetQuoteContracts = Entry('quote/contracts', ['swap', 'v2', 'public'], 'GET', {'cost': 1})
@@ -47,6 +47,7 @@ class ImplicitAPI:
47
47
  private_get_users_self_trailing_volume = privateGetUsersSelfTrailingVolume = Entry('users/self/trailing-volume', 'private', 'GET', {})
48
48
  private_get_withdrawals_fee_estimate = privateGetWithdrawalsFeeEstimate = Entry('withdrawals/fee-estimate', 'private', 'GET', {})
49
49
  private_get_conversions_conversion_id = privateGetConversionsConversionId = Entry('conversions/{conversion_id}', 'private', 'GET', {})
50
+ private_get_conversions_fees = privateGetConversionsFees = Entry('conversions/fees', 'private', 'GET', {})
50
51
  private_post_conversions = privatePostConversions = Entry('conversions', 'private', 'POST', {})
51
52
  private_post_deposits_coinbase_account = privatePostDepositsCoinbaseAccount = Entry('deposits/coinbase-account', 'private', 'POST', {})
52
53
  private_post_deposits_payment_method = privatePostDepositsPaymentMethod = Entry('deposits/payment-method', 'private', 'POST', {})
ccxt/ascendex.py CHANGED
@@ -165,7 +165,7 @@ class ascendex(Exchange, ImplicitAPI):
165
165
  'get': {
166
166
  'info': 1,
167
167
  'wallet/transactions': 1,
168
- 'wallet/deposit/address': 1, # not documented
168
+ 'wallet/deposit/address': 1,
169
169
  'data/balance/snapshot': 1,
170
170
  'data/balance/history': 1,
171
171
  },
@@ -284,11 +284,14 @@ class ascendex(Exchange, ImplicitAPI):
284
284
  'fillResponseFromRequest': True,
285
285
  },
286
286
  'networks': {
287
- 'BSC': 'BEP20(BSC)',
287
+ 'BSC': 'BEP20 ' + '(BSC)',
288
288
  'ARB': 'arbitrum',
289
289
  'SOL': 'Solana',
290
290
  'AVAX': 'avalanche C chain',
291
291
  'OMNI': 'Omni',
292
+ 'TRC': 'TRC20',
293
+ 'TRX': 'TRC20',
294
+ 'ERC': 'ERC20',
292
295
  },
293
296
  'networksById': {
294
297
  'BEP20(BSC)': 'BSC',
@@ -296,6 +299,16 @@ class ascendex(Exchange, ImplicitAPI):
296
299
  'Solana': 'SOL',
297
300
  'avalanche C chain': 'AVAX',
298
301
  'Omni': 'OMNI',
302
+ 'TRC20': 'TRC20',
303
+ 'ERC20': 'ERC20',
304
+ 'GO20': 'GO20',
305
+ 'BEP2': 'BEP2',
306
+ 'Bitcoin': 'BTC',
307
+ 'Bitcoin ABC': 'BCH',
308
+ 'Litecoin': 'LTC',
309
+ 'Matic Network': 'MATIC',
310
+ 'xDai': 'STAKE',
311
+ 'Akash': 'AKT',
299
312
  },
300
313
  },
301
314
  'exceptions': {
@@ -2253,8 +2266,8 @@ class ascendex(Exchange, ImplicitAPI):
2253
2266
  tag = self.safe_string(depositAddress, tagId)
2254
2267
  self.check_address(address)
2255
2268
  code = None if (currency is None) else currency['code']
2256
- chainName = self.safe_string(depositAddress, 'chainName')
2257
- network = self.safe_network(chainName)
2269
+ chainName = self.safe_string(depositAddress, 'blockchain')
2270
+ network = self.network_id_to_code(chainName, code)
2258
2271
  return {
2259
2272
  'currency': code,
2260
2273
  'address': address,
@@ -2264,35 +2277,26 @@ class ascendex(Exchange, ImplicitAPI):
2264
2277
  }
2265
2278
 
2266
2279
  def safe_network(self, networkId):
2267
- networksById = {
2268
- 'TRC20': 'TRC20',
2269
- 'ERC20': 'ERC20',
2270
- 'GO20': 'GO20',
2271
- 'BEP2': 'BEP2',
2272
- 'BEP20(BSC)': 'BEP20',
2273
- 'Bitcoin': 'BTC',
2274
- 'Bitcoin ABC': 'BCH',
2275
- 'Litecoin': 'LTC',
2276
- 'Matic Network': 'MATIC',
2277
- 'Solana': 'SOL',
2278
- 'xDai': 'STAKE',
2279
- 'Akash': 'AKT',
2280
- }
2280
+ networksById = self.safe_dict(self.options, 'networksById')
2281
2281
  return self.safe_string(networksById, networkId, networkId)
2282
2282
 
2283
2283
  def fetch_deposit_address(self, code: str, params={}):
2284
2284
  """
2285
2285
  fetch the deposit address for a currency associated with self account
2286
+ :see: https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
2286
2287
  :param str code: unified currency code
2287
2288
  :param dict [params]: extra parameters specific to the exchange API endpoint
2289
+ :param str [params.network]: unified network code for deposit chain
2288
2290
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2289
2291
  """
2290
2292
  self.load_markets()
2291
2293
  currency = self.currency(code)
2292
- chainName = self.safe_string(params, 'chainName')
2293
- params = self.omit(params, 'chainName')
2294
+ networkCode = self.safe_string_2(params, 'network', 'chainName')
2295
+ networkId = self.network_code_to_id(networkCode)
2296
+ params = self.omit(params, ['chainName'])
2294
2297
  request = {
2295
2298
  'asset': currency['id'],
2299
+ 'blockchain': networkId,
2296
2300
  }
2297
2301
  response = self.v1PrivateGetWalletDepositAddress(self.extend(request, params))
2298
2302
  #
@@ -2328,20 +2332,20 @@ class ascendex(Exchange, ImplicitAPI):
2328
2332
  # }
2329
2333
  # }
2330
2334
  #
2331
- data = self.safe_value(response, 'data', {})
2332
- addresses = self.safe_value(data, 'address', [])
2335
+ data = self.safe_dict(response, 'data', {})
2336
+ addresses = self.safe_list(data, 'address', [])
2333
2337
  numAddresses = len(addresses)
2334
2338
  address = None
2335
2339
  if numAddresses > 1:
2336
2340
  addressesByChainName = self.index_by(addresses, 'chainName')
2337
- if chainName is None:
2341
+ if networkId is None:
2338
2342
  chainNames = list(addressesByChainName.keys())
2339
2343
  chains = ', '.join(chainNames)
2340
2344
  raise ArgumentsRequired(self.id + ' fetchDepositAddress() returned more than one address, a chainName parameter is required, one of ' + chains)
2341
- address = self.safe_value(addressesByChainName, chainName, {})
2345
+ address = self.safe_dict(addressesByChainName, networkId, {})
2342
2346
  else:
2343
2347
  # first address
2344
- address = self.safe_value(addresses, 0, {})
2348
+ address = self.safe_dict(addresses, 0, {})
2345
2349
  result = self.parse_deposit_address(address, currency)
2346
2350
  return self.extend(result, {
2347
2351
  'info': response,
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.39'
7
+ __version__ = '4.2.40'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -165,7 +165,7 @@ class ascendex(Exchange, ImplicitAPI):
165
165
  'get': {
166
166
  'info': 1,
167
167
  'wallet/transactions': 1,
168
- 'wallet/deposit/address': 1, # not documented
168
+ 'wallet/deposit/address': 1,
169
169
  'data/balance/snapshot': 1,
170
170
  'data/balance/history': 1,
171
171
  },
@@ -284,11 +284,14 @@ class ascendex(Exchange, ImplicitAPI):
284
284
  'fillResponseFromRequest': True,
285
285
  },
286
286
  'networks': {
287
- 'BSC': 'BEP20(BSC)',
287
+ 'BSC': 'BEP20 ' + '(BSC)',
288
288
  'ARB': 'arbitrum',
289
289
  'SOL': 'Solana',
290
290
  'AVAX': 'avalanche C chain',
291
291
  'OMNI': 'Omni',
292
+ 'TRC': 'TRC20',
293
+ 'TRX': 'TRC20',
294
+ 'ERC': 'ERC20',
292
295
  },
293
296
  'networksById': {
294
297
  'BEP20(BSC)': 'BSC',
@@ -296,6 +299,16 @@ class ascendex(Exchange, ImplicitAPI):
296
299
  'Solana': 'SOL',
297
300
  'avalanche C chain': 'AVAX',
298
301
  'Omni': 'OMNI',
302
+ 'TRC20': 'TRC20',
303
+ 'ERC20': 'ERC20',
304
+ 'GO20': 'GO20',
305
+ 'BEP2': 'BEP2',
306
+ 'Bitcoin': 'BTC',
307
+ 'Bitcoin ABC': 'BCH',
308
+ 'Litecoin': 'LTC',
309
+ 'Matic Network': 'MATIC',
310
+ 'xDai': 'STAKE',
311
+ 'Akash': 'AKT',
299
312
  },
300
313
  },
301
314
  'exceptions': {
@@ -2253,8 +2266,8 @@ class ascendex(Exchange, ImplicitAPI):
2253
2266
  tag = self.safe_string(depositAddress, tagId)
2254
2267
  self.check_address(address)
2255
2268
  code = None if (currency is None) else currency['code']
2256
- chainName = self.safe_string(depositAddress, 'chainName')
2257
- network = self.safe_network(chainName)
2269
+ chainName = self.safe_string(depositAddress, 'blockchain')
2270
+ network = self.network_id_to_code(chainName, code)
2258
2271
  return {
2259
2272
  'currency': code,
2260
2273
  'address': address,
@@ -2264,35 +2277,26 @@ class ascendex(Exchange, ImplicitAPI):
2264
2277
  }
2265
2278
 
2266
2279
  def safe_network(self, networkId):
2267
- networksById = {
2268
- 'TRC20': 'TRC20',
2269
- 'ERC20': 'ERC20',
2270
- 'GO20': 'GO20',
2271
- 'BEP2': 'BEP2',
2272
- 'BEP20(BSC)': 'BEP20',
2273
- 'Bitcoin': 'BTC',
2274
- 'Bitcoin ABC': 'BCH',
2275
- 'Litecoin': 'LTC',
2276
- 'Matic Network': 'MATIC',
2277
- 'Solana': 'SOL',
2278
- 'xDai': 'STAKE',
2279
- 'Akash': 'AKT',
2280
- }
2280
+ networksById = self.safe_dict(self.options, 'networksById')
2281
2281
  return self.safe_string(networksById, networkId, networkId)
2282
2282
 
2283
2283
  async def fetch_deposit_address(self, code: str, params={}):
2284
2284
  """
2285
2285
  fetch the deposit address for a currency associated with self account
2286
+ :see: https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses
2286
2287
  :param str code: unified currency code
2287
2288
  :param dict [params]: extra parameters specific to the exchange API endpoint
2289
+ :param str [params.network]: unified network code for deposit chain
2288
2290
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2289
2291
  """
2290
2292
  await self.load_markets()
2291
2293
  currency = self.currency(code)
2292
- chainName = self.safe_string(params, 'chainName')
2293
- params = self.omit(params, 'chainName')
2294
+ networkCode = self.safe_string_2(params, 'network', 'chainName')
2295
+ networkId = self.network_code_to_id(networkCode)
2296
+ params = self.omit(params, ['chainName'])
2294
2297
  request = {
2295
2298
  'asset': currency['id'],
2299
+ 'blockchain': networkId,
2296
2300
  }
2297
2301
  response = await self.v1PrivateGetWalletDepositAddress(self.extend(request, params))
2298
2302
  #
@@ -2328,20 +2332,20 @@ class ascendex(Exchange, ImplicitAPI):
2328
2332
  # }
2329
2333
  # }
2330
2334
  #
2331
- data = self.safe_value(response, 'data', {})
2332
- addresses = self.safe_value(data, 'address', [])
2335
+ data = self.safe_dict(response, 'data', {})
2336
+ addresses = self.safe_list(data, 'address', [])
2333
2337
  numAddresses = len(addresses)
2334
2338
  address = None
2335
2339
  if numAddresses > 1:
2336
2340
  addressesByChainName = self.index_by(addresses, 'chainName')
2337
- if chainName is None:
2341
+ if networkId is None:
2338
2342
  chainNames = list(addressesByChainName.keys())
2339
2343
  chains = ', '.join(chainNames)
2340
2344
  raise ArgumentsRequired(self.id + ' fetchDepositAddress() returned more than one address, a chainName parameter is required, one of ' + chains)
2341
- address = self.safe_value(addressesByChainName, chainName, {})
2345
+ address = self.safe_dict(addressesByChainName, networkId, {})
2342
2346
  else:
2343
2347
  # first address
2344
- address = self.safe_value(addresses, 0, {})
2348
+ address = self.safe_dict(addresses, 0, {})
2345
2349
  result = self.parse_deposit_address(address, currency)
2346
2350
  return self.extend(result, {
2347
2351
  'info': response,
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.2.39'
5
+ __version__ = '4.2.40'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -879,13 +879,13 @@ class Exchange(BaseExchange):
879
879
  raise NotSupported(self.id + ' fetchStatus() is not supported yet')
880
880
 
881
881
  async def fetch_funding_fee(self, code: str, params={}):
882
- warnOnFetchFundingFee = self.safe_value(self.options, 'warnOnFetchFundingFee', True)
882
+ warnOnFetchFundingFee = self.safe_bool(self.options, 'warnOnFetchFundingFee', True)
883
883
  if warnOnFetchFundingFee:
884
884
  raise NotSupported(self.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = False to suppress self warning')
885
885
  return await self.fetch_transaction_fee(code, params)
886
886
 
887
887
  async def fetch_funding_fees(self, codes: List[str] = None, params={}):
888
- warnOnFetchFundingFees = self.safe_value(self.options, 'warnOnFetchFundingFees', True)
888
+ warnOnFetchFundingFees = self.safe_bool(self.options, 'warnOnFetchFundingFees', True)
889
889
  if warnOnFetchFundingFees:
890
890
  raise NotSupported(self.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = False to suppress self warning')
891
891
  return await self.fetch_transaction_fees(codes, params)
@@ -922,7 +922,7 @@ class Exchange(BaseExchange):
922
922
  if not self.has['fetchBorrowRates']:
923
923
  raise NotSupported(self.id + ' fetchIsolatedBorrowRate() is not supported yet')
924
924
  borrowRates = await self.fetchIsolatedBorrowRates(params)
925
- rate = self.safe_value(borrowRates, symbol)
925
+ rate = self.safe_dict(borrowRates, symbol)
926
926
  if rate is None:
927
927
  raise ExchangeError(self.id + ' fetchIsolatedBorrowRate() could not find the borrow rate for market symbol ' + symbol)
928
928
  return rate
@@ -933,7 +933,7 @@ class Exchange(BaseExchange):
933
933
  market = self.market(symbol)
934
934
  symbol = market['symbol']
935
935
  tickers = await self.fetch_tickers([symbol], params)
936
- ticker = self.safe_value(tickers, symbol)
936
+ ticker = self.safe_dict(tickers, symbol)
937
937
  if ticker is None:
938
938
  raise NullResponse(self.id + ' fetchTickers() could not find a ticker for ' + symbol)
939
939
  else:
@@ -966,7 +966,7 @@ class Exchange(BaseExchange):
966
966
  return order['status']
967
967
 
968
968
  async def fetch_unified_order(self, order, params={}):
969
- return await self.fetch_order(self.safe_value(order, 'id'), self.safe_value(order, 'symbol'), params)
969
+ return await self.fetch_order(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
970
970
 
971
971
  async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
972
972
  raise NotSupported(self.id + ' createOrder() is not supported yet')
@@ -1191,7 +1191,7 @@ class Exchange(BaseExchange):
1191
1191
  raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
1192
1192
 
1193
1193
  async def cancel_unified_order(self, order, params={}):
1194
- return self.cancelOrder(self.safe_value(order, 'id'), self.safe_value(order, 'symbol'), params)
1194
+ return self.cancelOrder(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
1195
1195
 
1196
1196
  async def fetch_orders(self, symbol: str = None, since: Int = None, limit: Int = None, params={}):
1197
1197
  if self.has['fetchOpenOrders'] and self.has['fetchClosedOrders']: