ccxt 4.4.33__py2.py3-none-any.whl → 4.4.35__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 (100) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bingx.py +17 -0
  3. ccxt/abstract/bitbank.py +5 -0
  4. ccxt/abstract/bitfinex2.py +1 -0
  5. ccxt/abstract/bitpanda.py +0 -12
  6. ccxt/abstract/bitrue.py +3 -3
  7. ccxt/abstract/ellipx.py +25 -0
  8. ccxt/abstract/okx.py +1 -0
  9. ccxt/abstract/onetrading.py +0 -12
  10. ccxt/abstract/xt.py +5 -5
  11. ccxt/alpaca.py +2 -0
  12. ccxt/async_support/__init__.py +3 -1
  13. ccxt/async_support/alpaca.py +2 -0
  14. ccxt/async_support/base/exchange.py +1 -1
  15. ccxt/async_support/binance.py +19 -15
  16. ccxt/async_support/bingx.py +479 -146
  17. ccxt/async_support/bitbank.py +5 -0
  18. ccxt/async_support/bitbns.py +2 -0
  19. ccxt/async_support/bitfinex2.py +1 -0
  20. ccxt/async_support/bitget.py +174 -40
  21. ccxt/async_support/bitmex.py +3 -1
  22. ccxt/async_support/bitopro.py +3 -0
  23. ccxt/async_support/bitrue.py +3 -2
  24. ccxt/async_support/btcmarkets.py +5 -3
  25. ccxt/async_support/btcturk.py +19 -19
  26. ccxt/async_support/bybit.py +13 -10
  27. ccxt/async_support/cex.py +13 -4
  28. ccxt/async_support/coinbase.py +3 -2
  29. ccxt/async_support/coinex.py +1 -0
  30. ccxt/async_support/coinone.py +7 -7
  31. ccxt/async_support/coinsph.py +7 -7
  32. ccxt/async_support/coinspot.py +39 -39
  33. ccxt/async_support/cryptocom.py +36 -34
  34. ccxt/async_support/ellipx.py +1828 -0
  35. ccxt/async_support/gate.py +143 -39
  36. ccxt/async_support/hyperliquid.py +70 -11
  37. ccxt/async_support/idex.py +3 -4
  38. ccxt/async_support/kraken.py +58 -49
  39. ccxt/async_support/krakenfutures.py +3 -1
  40. ccxt/async_support/kucoin.py +1 -1
  41. ccxt/async_support/okcoin.py +2 -0
  42. ccxt/async_support/okx.py +15 -10
  43. ccxt/async_support/onetrading.py +67 -370
  44. ccxt/async_support/paradex.py +2 -0
  45. ccxt/async_support/phemex.py +16 -0
  46. ccxt/async_support/poloniex.py +3 -1
  47. ccxt/async_support/poloniexfutures.py +3 -1
  48. ccxt/async_support/vertex.py +2 -0
  49. ccxt/async_support/woo.py +69 -69
  50. ccxt/async_support/xt.py +10 -10
  51. ccxt/base/exchange.py +28 -7
  52. ccxt/binance.py +19 -15
  53. ccxt/bingx.py +479 -146
  54. ccxt/bitbank.py +5 -0
  55. ccxt/bitbns.py +2 -0
  56. ccxt/bitfinex2.py +1 -0
  57. ccxt/bitget.py +174 -40
  58. ccxt/bitmex.py +3 -1
  59. ccxt/bitopro.py +3 -0
  60. ccxt/bitrue.py +3 -2
  61. ccxt/btcmarkets.py +5 -3
  62. ccxt/btcturk.py +19 -19
  63. ccxt/bybit.py +13 -10
  64. ccxt/cex.py +13 -4
  65. ccxt/coinbase.py +3 -2
  66. ccxt/coinex.py +1 -0
  67. ccxt/coinone.py +7 -7
  68. ccxt/coinsph.py +7 -7
  69. ccxt/coinspot.py +39 -39
  70. ccxt/cryptocom.py +36 -34
  71. ccxt/ellipx.py +1828 -0
  72. ccxt/gate.py +143 -39
  73. ccxt/hyperliquid.py +70 -11
  74. ccxt/idex.py +3 -4
  75. ccxt/kraken.py +58 -49
  76. ccxt/krakenfutures.py +3 -1
  77. ccxt/kucoin.py +1 -1
  78. ccxt/okcoin.py +2 -0
  79. ccxt/okx.py +15 -10
  80. ccxt/onetrading.py +67 -370
  81. ccxt/paradex.py +2 -0
  82. ccxt/phemex.py +16 -0
  83. ccxt/poloniex.py +3 -1
  84. ccxt/poloniexfutures.py +3 -1
  85. ccxt/pro/__init__.py +1 -1
  86. ccxt/pro/bitrue.py +13 -11
  87. ccxt/pro/idex.py +15 -0
  88. ccxt/pro/probit.py +58 -68
  89. ccxt/pro/woo.py +15 -15
  90. ccxt/test/tests_async.py +29 -2
  91. ccxt/test/tests_helpers.py +0 -2
  92. ccxt/test/tests_sync.py +29 -2
  93. ccxt/vertex.py +2 -0
  94. ccxt/woo.py +69 -69
  95. ccxt/xt.py +10 -10
  96. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/METADATA +9 -8
  97. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/RECORD +100 -97
  98. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/LICENSE.txt +0 -0
  99. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/WHEEL +0 -0
  100. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/top_level.txt +0 -0
ccxt/kraken.py CHANGED
@@ -1553,18 +1553,9 @@ class kraken(Exchange, ImplicitAPI):
1553
1553
  # editOrder
1554
1554
  #
1555
1555
  # {
1556
- # "status": "ok",
1557
- # "txid": "OAW2BO-7RWEK-PZY5UO",
1558
- # "originaltxid": "OXL6SS-UPNMC-26WBE7",
1559
- # "newuserref": 1234,
1560
- # "olduserref": 123,
1561
- # "volume": "0.00075000",
1562
- # "price": "13500.0",
1563
- # "orders_cancelled": 1,
1564
- # "descr": {
1565
- # "order": "buy 0.00075000 XBTUSDT @ limit 13500.0"
1566
- # }
1556
+ # "amend_id": "TJSMEH-AA67V-YUSQ6O"
1567
1557
  # }
1558
+ #
1568
1559
  # ws - createOrder
1569
1560
  # {
1570
1561
  # "descr": 'sell 0.00010000 XBTUSDT @ market',
@@ -1687,11 +1678,11 @@ class kraken(Exchange, ImplicitAPI):
1687
1678
  elif flags.find('fcib') >= 0:
1688
1679
  fee['currency'] = market['base']
1689
1680
  status = self.parse_order_status(self.safe_string(order, 'status'))
1690
- id = self.safe_string_2(order, 'id', 'txid')
1681
+ id = self.safe_string_n(order, ['id', 'txid', 'amend_id'])
1691
1682
  if (id is None) or (id.startswith('[')):
1692
1683
  txid = self.safe_list(order, 'txid')
1693
1684
  id = self.safe_string(txid, 0)
1694
- clientOrderId = self.safe_string_2(order, 'userref', 'newuserref')
1685
+ clientOrderId = self.safe_string(order, 'userref')
1695
1686
  rawTrades = self.safe_value(order, 'trades', [])
1696
1687
  trades = []
1697
1688
  for i in range(0, len(rawTrades)):
@@ -1706,22 +1697,26 @@ class kraken(Exchange, ImplicitAPI):
1706
1697
  takeProfitPrice = None
1707
1698
  # the dashed strings are not provided from fields(eg. fetch order)
1708
1699
  # while spaced strings from "order" sentence(when other fields not available)
1709
- if rawType.startswith('take-profit'):
1710
- takeProfitPrice = self.safe_string(description, 'price')
1711
- price = self.omit_zero(self.safe_string(description, 'price2'))
1712
- elif rawType.startswith('stop-loss'):
1713
- stopLossPrice = self.safe_string(description, 'price')
1714
- price = self.omit_zero(self.safe_string(description, 'price2'))
1715
- elif rawType == 'take profit':
1716
- takeProfitPrice = triggerPrice
1717
- elif rawType == 'stop loss':
1718
- stopLossPrice = triggerPrice
1700
+ if rawType is not None:
1701
+ if rawType.startswith('take-profit'):
1702
+ takeProfitPrice = self.safe_string(description, 'price')
1703
+ price = self.omit_zero(self.safe_string(description, 'price2'))
1704
+ elif rawType.startswith('stop-loss'):
1705
+ stopLossPrice = self.safe_string(description, 'price')
1706
+ price = self.omit_zero(self.safe_string(description, 'price2'))
1707
+ elif rawType == 'take profit':
1708
+ takeProfitPrice = triggerPrice
1709
+ elif rawType == 'stop loss':
1710
+ stopLossPrice = triggerPrice
1719
1711
  finalType = self.parse_order_type(rawType)
1720
1712
  # unlike from endpoints which provide eg: "take-profit-limit"
1721
1713
  # for "space-delimited" orders we dont have market/limit suffixes, their format is
1722
1714
  # eg: `stop loss > limit 123`, so we need to parse them manually
1723
1715
  if self.in_array(finalType, ['stop loss', 'take profit']):
1724
1716
  finalType = 'market' if (price is None) else 'limit'
1717
+ amendId = self.safe_string(order, 'amend_id')
1718
+ if amendId is not None:
1719
+ isPostOnly = None
1725
1720
  return self.safe_order({
1726
1721
  'id': id,
1727
1722
  'clientOrderId': clientOrderId,
@@ -1751,10 +1746,10 @@ class kraken(Exchange, ImplicitAPI):
1751
1746
  }, market)
1752
1747
 
1753
1748
  def order_request(self, method: str, symbol: str, type: str, request: dict, amount: Num, price: Num = None, params={}):
1754
- clientOrderId = self.safe_string_2(params, 'userref', 'clientOrderId')
1755
- params = self.omit(params, ['userref', 'clientOrderId'])
1749
+ clientOrderId = self.safe_string(params, 'clientOrderId')
1750
+ params = self.omit(params, ['clientOrderId'])
1756
1751
  if clientOrderId is not None:
1757
- request['userref'] = clientOrderId
1752
+ request['cl_ord_id'] = clientOrderId
1758
1753
  stopLossTriggerPrice = self.safe_string(params, 'stopLossPrice')
1759
1754
  takeProfitTriggerPrice = self.safe_string(params, 'takeProfitPrice')
1760
1755
  isStopLossTriggerOrder = stopLossTriggerPrice is not None
@@ -1854,21 +1849,24 @@ class kraken(Exchange, ImplicitAPI):
1854
1849
  """
1855
1850
  edit a trade order
1856
1851
 
1857
- https://docs.kraken.com/rest/#tag/Spot-Trading/operation/editOrder
1852
+ https://docs.kraken.com/api/docs/rest-api/amend-order
1858
1853
 
1859
1854
  :param str id: order id
1860
1855
  :param str symbol: unified symbol of the market to create an order in
1861
1856
  :param str type: 'market' or 'limit'
1862
1857
  :param str side: 'buy' or 'sell'
1863
- :param float amount: how much of the currency you want to trade in units of the base currency
1858
+ :param float [amount]: how much of the currency you want to trade in units of the base currency
1864
1859
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1865
1860
  :param dict [params]: extra parameters specific to the exchange API endpoint
1866
- :param float [params.stopLossPrice]: *margin only* the price that a stop loss order is triggered at
1867
- :param float [params.takeProfitPrice]: *margin only* the price that a take profit order is triggered at
1868
- :param str [params.trailingAmount]: *margin only* the quote price away from the current market price
1869
- :param str [params.trailingLimitAmount]: *margin only* the quote amount away from the trailingAmount
1870
- :param str [params.offset]: *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-'
1871
- :param str [params.trigger]: *margin only* the activation price type, 'last' or 'index', default is 'last'
1861
+ :param float [params.stopLossPrice]: the price that a stop loss order is triggered at
1862
+ :param float [params.takeProfitPrice]: the price that a take profit order is triggered at
1863
+ :param str [params.trailingAmount]: the quote amount to trail away from the current market price
1864
+ :param str [params.trailingPercent]: the percent to trail away from the current market price
1865
+ :param str [params.trailingLimitAmount]: the quote amount away from the trailingAmount
1866
+ :param str [params.trailingLimitPercent]: the percent away from the trailingAmount
1867
+ :param str [params.offset]: '+' or '-' whether you want the trailingLimitAmount value to be positive or negative
1868
+ :param boolean [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
1869
+ :param str [params.clientOrderId]: the orders client order id
1872
1870
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1873
1871
  """
1874
1872
  self.load_markets()
@@ -1877,30 +1875,41 @@ class kraken(Exchange, ImplicitAPI):
1877
1875
  raise NotSupported(self.id + ' editOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted')
1878
1876
  request: dict = {
1879
1877
  'txid': id,
1880
- 'pair': market['id'],
1881
1878
  }
1879
+ clientOrderId = self.safe_string(params, 'clientOrderId')
1880
+ if clientOrderId is not None:
1881
+ request['cl_ord_id'] = clientOrderId
1882
+ params = self.omit(params, 'clientOrderId')
1883
+ request = self.omit(request, 'txid')
1884
+ isMarket = (type == 'market')
1885
+ postOnly = None
1886
+ postOnly, params = self.handle_post_only(isMarket, False, params)
1887
+ if postOnly:
1888
+ request['post_only'] = 'true' # not using hasattr(self, boolean) case, because the urlencodedNested transforms it into 'True' string
1882
1889
  if amount is not None:
1883
- request['volume'] = self.amount_to_precision(symbol, amount)
1884
- orderRequest = self.order_request('editOrder', symbol, type, request, amount, price, params)
1885
- response = self.privatePostEditOrder(self.extend(orderRequest[0], orderRequest[1]))
1890
+ request['order_qty'] = self.amount_to_precision(symbol, amount)
1891
+ if price is not None:
1892
+ request['limit_price'] = self.price_to_precision(symbol, price)
1893
+ allTriggerPrices = self.safe_string_n(params, ['stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingLimitAmount', 'trailingLimitPercent'])
1894
+ if allTriggerPrices is not None:
1895
+ offset = self.safe_string(params, 'offset')
1896
+ params = self.omit(params, ['stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingLimitAmount', 'trailingLimitPercent', 'offset'])
1897
+ if offset is not None:
1898
+ allTriggerPrices = offset + allTriggerPrices
1899
+ request['trigger_price'] = allTriggerPrices
1900
+ else:
1901
+ request['trigger_price'] = self.price_to_precision(symbol, allTriggerPrices)
1902
+ response = self.privatePostAmendOrder(self.extend(request, params))
1886
1903
  #
1887
1904
  # {
1888
1905
  # "error": [],
1889
1906
  # "result": {
1890
- # "status": "ok",
1891
- # "txid": "OAW2BO-7RWEK-PZY5UO",
1892
- # "originaltxid": "OXL6SS-UPNMC-26WBE7",
1893
- # "volume": "0.00075000",
1894
- # "price": "13500.0",
1895
- # "orders_cancelled": 1,
1896
- # "descr": {
1897
- # "order": "buy 0.00075000 XBTUSDT @ limit 13500.0"
1898
- # }
1907
+ # "amend_id": "TJSMEH-AA67V-YUSQ6O"
1899
1908
  # }
1900
1909
  # }
1901
1910
  #
1902
- data = self.safe_dict(response, 'result', {})
1903
- return self.parse_order(data, market)
1911
+ result = self.safe_dict(response, 'result', {})
1912
+ return self.parse_order(result, market)
1904
1913
 
1905
1914
  def fetch_order(self, id: str, symbol: Str = None, params={}):
1906
1915
  """
ccxt/krakenfutures.py CHANGED
@@ -51,6 +51,8 @@ class krakenfutures(Exchange, ImplicitAPI):
51
51
  'cancelOrders': True,
52
52
  'createMarketOrder': False,
53
53
  'createOrder': True,
54
+ 'createStopOrder': True,
55
+ 'createTriggerOrder': True,
54
56
  'editOrder': True,
55
57
  'fetchBalance': True,
56
58
  'fetchBorrowRateHistories': False,
@@ -216,7 +218,7 @@ class krakenfutures(Exchange, ImplicitAPI):
216
218
  'invalidAmount': BadRequest,
217
219
  'insufficientFunds': InsufficientFunds,
218
220
  'Bad Request': BadRequest, # The URL contains invalid characters.(Please encode the json URL parameter)
219
- 'Unavailable': InsufficientFunds, # Insufficient funds in Futures account [withdraw]
221
+ 'Unavailable': ExchangeNotAvailable, # https://github.com/ccxt/ccxt/issues/24338
220
222
  'invalidUnit': BadRequest,
221
223
  'Json Parse Error': ExchangeError,
222
224
  'nonceBelowThreshold': InvalidNonce,
ccxt/kucoin.py CHANGED
@@ -1199,7 +1199,7 @@ class kucoin(Exchange, ImplicitAPI):
1199
1199
  'type': 'spot',
1200
1200
  'spot': True,
1201
1201
  'margin': isMarginable,
1202
- 'marginMode': {
1202
+ 'marginModes': {
1203
1203
  'cross': hasCrossMargin,
1204
1204
  'isolated': hasIsolatedMargin,
1205
1205
  },
ccxt/okcoin.py CHANGED
@@ -56,6 +56,8 @@ class okcoin(Exchange, ImplicitAPI):
56
56
  'createMarketOrderWithCost': False,
57
57
  'createMarketSellOrderWithCost': False,
58
58
  'createOrder': True,
59
+ 'createStopOrder': True,
60
+ 'createTriggerOrder': True,
59
61
  'fetchBalance': True,
60
62
  'fetchBorrowInterest': False,
61
63
  'fetchBorrowRate': False,
ccxt/okx.py CHANGED
@@ -351,6 +351,7 @@ class okx(Exchange, ImplicitAPI):
351
351
  'asset/convert/history': 5 / 3,
352
352
  'asset/monthly-statement': 2,
353
353
  # account
354
+ 'account/instruments': 1,
354
355
  'account/balance': 2,
355
356
  'account/positions': 2,
356
357
  'account/positions-history': 100,
@@ -1204,6 +1205,7 @@ class okx(Exchange, ImplicitAPI):
1204
1205
  'default': {
1205
1206
  'sandbox': True,
1206
1207
  'createOrder': {
1208
+ 'marginMode': True,
1207
1209
  'triggerPrice': True,
1208
1210
  'triggerPriceType': {
1209
1211
  'last': True,
@@ -1213,7 +1215,6 @@ class okx(Exchange, ImplicitAPI):
1213
1215
  'triggerDirection': False,
1214
1216
  'stopLossPrice': True,
1215
1217
  'takeProfitPrice': True,
1216
- 'marginMode': True,
1217
1218
  'attachedStopLossTakeProfit': {
1218
1219
  'triggerPriceType': {
1219
1220
  'last': True,
@@ -1241,6 +1242,7 @@ class okx(Exchange, ImplicitAPI):
1241
1242
  'max': 20,
1242
1243
  },
1243
1244
  'fetchMyTrades': {
1245
+ 'marginMode': False,
1244
1246
  'daysBack': 90,
1245
1247
  'limit': 100,
1246
1248
  'untilDays': 10000,
@@ -1251,18 +1253,18 @@ class okx(Exchange, ImplicitAPI):
1251
1253
  'trailing': True,
1252
1254
  },
1253
1255
  'fetchOpenOrders': {
1254
- 'limit': 100,
1255
1256
  'marginMode': False,
1257
+ 'limit': 100,
1256
1258
  'trigger': True,
1257
1259
  'trailing': True,
1258
1260
  },
1259
1261
  'fetchOrders': None, # not supported
1260
1262
  'fetchClosedOrders': {
1263
+ 'marginMode': False,
1261
1264
  'limit': 100,
1262
1265
  'daysBackClosed': 90, # 3 months
1263
1266
  'daysBackCanceled': 1 / 12, # 2 hour
1264
1267
  'untilDays': None,
1265
- 'marginMode': False,
1266
1268
  'trigger': True,
1267
1269
  'trailing': True,
1268
1270
  },
@@ -1817,7 +1819,7 @@ class okx(Exchange, ImplicitAPI):
1817
1819
  'active': active,
1818
1820
  'deposit': canDeposit,
1819
1821
  'withdraw': canWithdraw,
1820
- 'fee': self.safe_number(chain, 'minFee'),
1822
+ 'fee': self.safe_number(chain, 'fee'),
1821
1823
  'precision': self.parse_number(precision),
1822
1824
  'limits': {
1823
1825
  'withdraw': {
@@ -6175,7 +6177,7 @@ class okx(Exchange, ImplicitAPI):
6175
6177
  :param str symbol: unified market symbol
6176
6178
  :param dict [params]: extra parameters specific to the exchange API endpoint
6177
6179
  :param str [params.marginMode]: 'cross' or 'isolated'
6178
- :param str [params.posSide]: 'long' or 'short' for isolated margin long/short mode on futures and swap markets
6180
+ :param str [params.posSide]: 'long' or 'short' or 'net' for isolated margin long/short mode on futures and swap markets, default is 'net'
6179
6181
  :returns dict: response from the exchange
6180
6182
  """
6181
6183
  if symbol is None:
@@ -6197,12 +6199,11 @@ class okx(Exchange, ImplicitAPI):
6197
6199
  'mgnMode': marginMode,
6198
6200
  'instId': market['id'],
6199
6201
  }
6200
- posSide = self.safe_string(params, 'posSide')
6202
+ posSide = self.safe_string(params, 'posSide', 'net')
6201
6203
  if marginMode == 'isolated':
6202
- if posSide is None:
6203
- raise ArgumentsRequired(self.id + ' setLeverage() requires a posSide argument for isolated margin')
6204
6204
  if posSide != 'long' and posSide != 'short' and posSide != 'net':
6205
6205
  raise BadRequest(self.id + ' setLeverage() requires the posSide argument to be either "long", "short" or "net"')
6206
+ request['posSide'] = posSide
6206
6207
  response = self.privatePostAccountSetLeverage(self.extend(request, params))
6207
6208
  #
6208
6209
  # {
@@ -7105,7 +7106,11 @@ class okx(Exchange, ImplicitAPI):
7105
7106
  :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
7106
7107
  """
7107
7108
  self.load_markets()
7108
- response = self.privateGetAssetCurrencies(params)
7109
+ request = {}
7110
+ if codes is not None:
7111
+ ids = self.currency_ids(codes)
7112
+ request['ccy'] = ','.join(ids)
7113
+ response = self.privateGetAssetCurrencies(self.extend(request, params))
7109
7114
  #
7110
7115
  # {
7111
7116
  # "code": "0",
@@ -7190,7 +7195,7 @@ class okx(Exchange, ImplicitAPI):
7190
7195
  continue
7191
7196
  chainSplit = chain.split('-')
7192
7197
  networkId = self.safe_value(chainSplit, 1)
7193
- withdrawFee = self.safe_number(feeInfo, 'minFee')
7198
+ withdrawFee = self.safe_number(feeInfo, 'fee')
7194
7199
  withdrawResult: dict = {
7195
7200
  'fee': withdrawFee,
7196
7201
  'percentage': False if (withdrawFee is not None) else None,