ccxt 4.4.88__py2.py3-none-any.whl → 4.4.91__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 (101) hide show
  1. ccxt/__init__.py +1 -3
  2. ccxt/abstract/bitget.py +58 -0
  3. ccxt/abstract/bitrue.py +65 -65
  4. ccxt/abstract/cryptocom.py +2 -0
  5. ccxt/abstract/luno.py +1 -0
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/base/exchange.py +6 -3
  8. ccxt/async_support/base/ws/client.py +173 -64
  9. ccxt/async_support/base/ws/future.py +23 -50
  10. ccxt/async_support/binance.py +2 -2
  11. ccxt/async_support/bingx.py +55 -29
  12. ccxt/async_support/bitget.py +469 -147
  13. ccxt/async_support/bitmex.py +2 -1
  14. ccxt/async_support/bitrue.py +72 -66
  15. ccxt/async_support/bitvavo.py +34 -0
  16. ccxt/async_support/btcalpha.py +35 -0
  17. ccxt/async_support/btcbox.py +35 -0
  18. ccxt/async_support/btcmarkets.py +35 -0
  19. ccxt/async_support/btcturk.py +35 -0
  20. ccxt/async_support/bybit.py +9 -3
  21. ccxt/async_support/cex.py +61 -0
  22. ccxt/async_support/coinbase.py +1 -3
  23. ccxt/async_support/cryptocom.py +66 -2
  24. ccxt/async_support/cryptomus.py +1 -1
  25. ccxt/async_support/delta.py +2 -2
  26. ccxt/async_support/digifinex.py +39 -99
  27. ccxt/async_support/exmo.py +14 -7
  28. ccxt/async_support/gate.py +14 -7
  29. ccxt/async_support/hashkey.py +15 -28
  30. ccxt/async_support/hollaex.py +27 -22
  31. ccxt/async_support/hyperliquid.py +104 -53
  32. ccxt/async_support/kraken.py +54 -50
  33. ccxt/async_support/luno.py +87 -1
  34. ccxt/async_support/mexc.py +1 -0
  35. ccxt/async_support/modetrade.py +2 -2
  36. ccxt/async_support/okx.py +2 -1
  37. ccxt/async_support/paradex.py +1 -1
  38. ccxt/async_support/phemex.py +16 -8
  39. ccxt/async_support/tradeogre.py +3 -3
  40. ccxt/async_support/xt.py +1 -1
  41. ccxt/base/exchange.py +20 -8
  42. ccxt/binance.py +2 -2
  43. ccxt/bingx.py +55 -29
  44. ccxt/bitget.py +469 -147
  45. ccxt/bitmex.py +2 -1
  46. ccxt/bitrue.py +72 -66
  47. ccxt/bitvavo.py +34 -0
  48. ccxt/btcalpha.py +35 -0
  49. ccxt/btcbox.py +35 -0
  50. ccxt/btcmarkets.py +35 -0
  51. ccxt/btcturk.py +35 -0
  52. ccxt/bybit.py +9 -3
  53. ccxt/cex.py +61 -0
  54. ccxt/coinbase.py +1 -3
  55. ccxt/cryptocom.py +66 -2
  56. ccxt/cryptomus.py +1 -1
  57. ccxt/delta.py +2 -2
  58. ccxt/digifinex.py +39 -99
  59. ccxt/exmo.py +13 -7
  60. ccxt/gate.py +14 -7
  61. ccxt/hashkey.py +15 -28
  62. ccxt/hollaex.py +27 -22
  63. ccxt/hyperliquid.py +104 -53
  64. ccxt/kraken.py +53 -50
  65. ccxt/luno.py +87 -1
  66. ccxt/mexc.py +1 -0
  67. ccxt/modetrade.py +2 -2
  68. ccxt/okx.py +2 -1
  69. ccxt/paradex.py +1 -1
  70. ccxt/phemex.py +16 -8
  71. ccxt/pro/__init__.py +1 -127
  72. ccxt/pro/bitstamp.py +1 -1
  73. ccxt/pro/bybit.py +6 -136
  74. ccxt/pro/coinbase.py +2 -0
  75. ccxt/pro/cryptocom.py +27 -0
  76. ccxt/pro/kraken.py +249 -267
  77. ccxt/pro/mexc.py +0 -1
  78. ccxt/tradeogre.py +3 -3
  79. ccxt/xt.py +1 -1
  80. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/METADATA +64 -23
  81. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/RECORD +84 -101
  82. ccxt/abstract/coinlist.py +0 -57
  83. ccxt/async_support/base/ws/aiohttp_client.py +0 -147
  84. ccxt/async_support/bitcoincom.py +0 -18
  85. ccxt/async_support/bitfinex1.py +0 -1711
  86. ccxt/async_support/bitpanda.py +0 -17
  87. ccxt/async_support/coinlist.py +0 -2542
  88. ccxt/async_support/poloniexfutures.py +0 -1875
  89. ccxt/bitcoincom.py +0 -18
  90. ccxt/bitfinex1.py +0 -1710
  91. ccxt/bitpanda.py +0 -17
  92. ccxt/coinlist.py +0 -2542
  93. ccxt/poloniexfutures.py +0 -1875
  94. ccxt/pro/bitcoincom.py +0 -35
  95. ccxt/pro/bitfinex1.py +0 -635
  96. ccxt/pro/bitpanda.py +0 -16
  97. ccxt/pro/poloniexfutures.py +0 -1004
  98. ccxt/pro/wazirx.py +0 -766
  99. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/LICENSE.txt +0 -0
  100. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/WHEEL +0 -0
  101. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/top_level.txt +0 -0
ccxt/bingx.py CHANGED
@@ -513,6 +513,8 @@ class bingx(Exchange, ImplicitAPI):
513
513
  '100437': BadRequest, # {"code":100437,"msg":"The withdrawal amount is lower than the minimum limit, please re-enter.","timestamp":1689258588845}
514
514
  '101204': InsufficientFunds, # {"code":101204,"msg":"","data":{}}
515
515
  '110425': InvalidOrder, # {"code":110425,"msg":"Please ensure that the minimum nominal value of the order placed must be greater than 2u","data":{}}
516
+ 'Insufficient assets': InsufficientFunds, # {"transferErrorMsg":"Insufficient assets"}
517
+ 'illegal transferType': BadRequest, # {"transferErrorMsg":"illegal transferType"}
516
518
  },
517
519
  'broad': {},
518
520
  },
@@ -526,12 +528,14 @@ class bingx(Exchange, ImplicitAPI):
526
528
  'options': {
527
529
  'defaultType': 'spot',
528
530
  'accountsByType': {
529
- 'spot': 'FUND',
531
+ 'funding': 'FUND',
532
+ 'spot': 'SPOT',
530
533
  'swap': 'PFUTURES',
531
534
  'future': 'SFUTURES',
532
535
  },
533
536
  'accountsById': {
534
- 'FUND': 'spot',
537
+ 'FUND': 'funding',
538
+ 'SPOT': 'spot',
535
539
  'PFUTURES': 'swap',
536
540
  'SFUTURES': 'future',
537
541
  },
@@ -1529,7 +1533,7 @@ class bingx(Exchange, ImplicitAPI):
1529
1533
  # ]
1530
1534
  # }
1531
1535
  #
1532
- data = self.safe_list(response, 'data', [])
1536
+ data = self.safe_dict(response, 'data')
1533
1537
  return self.parse_funding_rate(data, market)
1534
1538
 
1535
1539
  def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
@@ -4637,12 +4641,12 @@ class bingx(Exchange, ImplicitAPI):
4637
4641
  """
4638
4642
  transfer currency internally between wallets on the same account
4639
4643
 
4640
- https://bingx-api.github.io/docs/#/spot/account-api.html#User%20Universal%20Transfer
4644
+ https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer
4641
4645
 
4642
4646
  :param str code: unified currency code
4643
4647
  :param float amount: amount to transfer
4644
- :param str fromAccount: account to transfer from
4645
- :param str toAccount: account to transfer to
4648
+ :param str fromAccount: account to transfer from(spot, swap, futures, or funding)
4649
+ :param str toAccount: account to transfer to(spot, swap, futures, or funding)
4646
4650
  :param dict [params]: extra parameters specific to the exchange API endpoint
4647
4651
  :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
4648
4652
  """
@@ -4658,9 +4662,10 @@ class bingx(Exchange, ImplicitAPI):
4658
4662
  }
4659
4663
  response = self.spotV3PrivateGetGetAssetTransfer(self.extend(request, params))
4660
4664
  #
4661
- # {
4662
- # "tranId":13526853623
4663
- # }
4665
+ # {
4666
+ # "tranId": 1933130865269936128,
4667
+ # "transferId": "1051450703949464903736"
4668
+ # }
4664
4669
  #
4665
4670
  return {
4666
4671
  'info': response,
@@ -4682,8 +4687,11 @@ class bingx(Exchange, ImplicitAPI):
4682
4687
 
4683
4688
  :param str [code]: unified currency code of the currency transferred
4684
4689
  :param int [since]: the earliest time in ms to fetch transfers for
4685
- :param int [limit]: the maximum number of transfers structures to retrieve
4690
+ :param int [limit]: the maximum number of transfers structures to retrieve(default 10, max 100)
4686
4691
  :param dict [params]: extra parameters specific to the exchange API endpoint
4692
+ :param str params.fromAccount:(mandatory) transfer from(spot, swap, futures, or funding)
4693
+ :param str params.toAccount:(mandatory) transfer to(spot, swap, futures, or funding)
4694
+ :param boolean [params.paginate]: whether to paginate the results(default False)
4687
4695
  :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/#/?id=transfer-structure>`
4688
4696
  """
4689
4697
  self.load_markets()
@@ -4697,6 +4705,12 @@ class bingx(Exchange, ImplicitAPI):
4697
4705
  toId = self.safe_string(accountsByType, toAccount, toAccount)
4698
4706
  if fromId is None or toId is None:
4699
4707
  raise ExchangeError(self.id + ' fromAccount & toAccount parameter are required')
4708
+ params = self.omit(params, ['fromAccount', 'toAccount'])
4709
+ maxLimit = 100
4710
+ paginate = False
4711
+ paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate', False)
4712
+ if paginate:
4713
+ return self.fetch_paginated_call_dynamic('fetchTransfers', None, since, limit, params, maxLimit)
4700
4714
  request: dict = {
4701
4715
  'type': fromId + '_' + toId,
4702
4716
  }
@@ -4704,18 +4718,19 @@ class bingx(Exchange, ImplicitAPI):
4704
4718
  request['startTime'] = since
4705
4719
  if limit is not None:
4706
4720
  request['size'] = limit
4721
+ request, params = self.handle_until_option('endTime', request, params)
4707
4722
  response = self.spotV3PrivateGetAssetTransfer(self.extend(request, params))
4708
4723
  #
4709
4724
  # {
4710
4725
  # "total": 3,
4711
4726
  # "rows": [
4712
4727
  # {
4713
- # "asset":"USDT",
4714
- # "amount":"-100.00000000000000000000",
4715
- # "type":"FUND_SFUTURES",
4716
- # "status":"CONFIRMED",
4717
- # "tranId":1067594500957016069,
4718
- # "timestamp":1658388859000
4728
+ # "asset": "USDT",
4729
+ # "amount": "100.00000000000000000000",
4730
+ # "type": "FUND_SFUTURES",
4731
+ # "status": "CONFIRMED",
4732
+ # "tranId": 1067594500957016069,
4733
+ # "timestamp": 1658388859000
4719
4734
  # },
4720
4735
  # ]
4721
4736
  # }
@@ -4732,7 +4747,7 @@ class bingx(Exchange, ImplicitAPI):
4732
4747
  typeId = self.safe_string(transfer, 'type')
4733
4748
  typeIdSplit = typeId.split('_')
4734
4749
  fromId = self.safe_string(typeIdSplit, 0)
4735
- toId = self.safe_string(typeId, 1)
4750
+ toId = self.safe_string(typeIdSplit, 1)
4736
4751
  fromAccount = self.safe_string(accountsById, fromId, fromId)
4737
4752
  toAccount = self.safe_string(accountsById, toId, toId)
4738
4753
  return {
@@ -4744,9 +4759,15 @@ class bingx(Exchange, ImplicitAPI):
4744
4759
  'amount': self.safe_number(transfer, 'amount'),
4745
4760
  'fromAccount': fromAccount,
4746
4761
  'toAccount': toAccount,
4747
- 'status': status,
4762
+ 'status': self.parse_transfer_status(status),
4748
4763
  }
4749
4764
 
4765
+ def parse_transfer_status(self, status: Str) -> str:
4766
+ statuses: dict = {
4767
+ 'CONFIRMED': 'ok',
4768
+ }
4769
+ return self.safe_string(statuses, status, status)
4770
+
4750
4771
  def fetch_deposit_addresses_by_network(self, code: str, params={}) -> List[DepositAddress]:
4751
4772
  """
4752
4773
  fetch the deposit addresses for a currency associated with self account
@@ -5552,11 +5573,12 @@ class bingx(Exchange, ImplicitAPI):
5552
5573
  return self.parse_transaction(data)
5553
5574
 
5554
5575
  def parse_params(self, params):
5555
- sortedParams = self.keysort(params)
5556
- keys = list(sortedParams.keys())
5576
+ # sortedParams = self.keysort(params)
5577
+ rawKeys = list(params.keys())
5578
+ keys = self.sort(rawKeys)
5557
5579
  for i in range(0, len(keys)):
5558
5580
  key = keys[i]
5559
- value = sortedParams[key]
5581
+ value = params[key]
5560
5582
  if isinstance(value, list):
5561
5583
  arrStr = '['
5562
5584
  for j in range(0, len(value)):
@@ -5565,8 +5587,8 @@ class bingx(Exchange, ImplicitAPI):
5565
5587
  arrStr += ','
5566
5588
  arrStr += str(arrayElement)
5567
5589
  arrStr += ']'
5568
- sortedParams[key] = arrStr
5569
- return sortedParams
5590
+ params[key] = arrStr
5591
+ return params
5570
5592
 
5571
5593
  def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5572
5594
  """
@@ -6166,13 +6188,14 @@ class bingx(Exchange, ImplicitAPI):
6166
6188
  }
6167
6189
 
6168
6190
  def custom_encode(self, params):
6169
- sortedParams = self.keysort(params)
6170
- keys = list(sortedParams.keys())
6191
+ # sortedParams = self.keysort(params)
6192
+ rawKeys = list(params.keys())
6193
+ keys = self.sort(rawKeys)
6171
6194
  adjustedValue = None
6172
6195
  result = None
6173
6196
  for i in range(0, len(keys)):
6174
6197
  key = keys[i]
6175
- value = sortedParams[key]
6198
+ value = params[key]
6176
6199
  if isinstance(value, list):
6177
6200
  arrStr = None
6178
6201
  for j in range(0, len(value)):
@@ -6230,7 +6253,7 @@ class bingx(Exchange, ImplicitAPI):
6230
6253
  encodeRequest = self.custom_encode(params)
6231
6254
  else:
6232
6255
  parsedParams = self.parse_params(params)
6233
- encodeRequest = self.rawencode(parsedParams)
6256
+ encodeRequest = self.rawencode(parsedParams, True)
6234
6257
  signature = self.hmac(self.encode(encodeRequest), self.encode(self.secret), hashlib.sha256)
6235
6258
  headers = {
6236
6259
  'X-BX-APIKEY': self.apiKey,
@@ -6241,7 +6264,7 @@ class bingx(Exchange, ImplicitAPI):
6241
6264
  params['signature'] = signature
6242
6265
  body = self.json(params)
6243
6266
  else:
6244
- query = self.urlencode(parsedParams)
6267
+ query = self.urlencode(parsedParams, True)
6245
6268
  url += '?' + query + '&' + 'signature=' + signature
6246
6269
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
6247
6270
 
@@ -6265,7 +6288,10 @@ class bingx(Exchange, ImplicitAPI):
6265
6288
  #
6266
6289
  code = self.safe_string(response, 'code')
6267
6290
  message = self.safe_string(response, 'msg')
6268
- if code is not None and code != '0':
6291
+ transferErrorMsg = self.safe_string(response, 'transferErrorMsg') # handling with errors from transfer endpoint
6292
+ if (transferErrorMsg is not None) or (code is not None and code != '0'):
6293
+ if transferErrorMsg is not None:
6294
+ message = transferErrorMsg
6269
6295
  feedback = self.id + ' ' + body
6270
6296
  self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
6271
6297
  self.throw_exactly_matched_exception(self.exceptions['exact'], code, feedback)