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
@@ -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
  await 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 = await 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 = await 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
  async def fetch_order(self, id: str, symbol: Str = None, params={}):
1906
1915
  """
@@ -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,
@@ -1200,7 +1200,7 @@ class kucoin(Exchange, ImplicitAPI):
1200
1200
  'type': 'spot',
1201
1201
  'spot': True,
1202
1202
  'margin': isMarginable,
1203
- 'marginMode': {
1203
+ 'marginModes': {
1204
1204
  'cross': hasCrossMargin,
1205
1205
  'isolated': hasIsolatedMargin,
1206
1206
  },
@@ -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/async_support/okx.py CHANGED
@@ -352,6 +352,7 @@ class okx(Exchange, ImplicitAPI):
352
352
  'asset/convert/history': 5 / 3,
353
353
  'asset/monthly-statement': 2,
354
354
  # account
355
+ 'account/instruments': 1,
355
356
  'account/balance': 2,
356
357
  'account/positions': 2,
357
358
  'account/positions-history': 100,
@@ -1205,6 +1206,7 @@ class okx(Exchange, ImplicitAPI):
1205
1206
  'default': {
1206
1207
  'sandbox': True,
1207
1208
  'createOrder': {
1209
+ 'marginMode': True,
1208
1210
  'triggerPrice': True,
1209
1211
  'triggerPriceType': {
1210
1212
  'last': True,
@@ -1214,7 +1216,6 @@ class okx(Exchange, ImplicitAPI):
1214
1216
  'triggerDirection': False,
1215
1217
  'stopLossPrice': True,
1216
1218
  'takeProfitPrice': True,
1217
- 'marginMode': True,
1218
1219
  'attachedStopLossTakeProfit': {
1219
1220
  'triggerPriceType': {
1220
1221
  'last': True,
@@ -1242,6 +1243,7 @@ class okx(Exchange, ImplicitAPI):
1242
1243
  'max': 20,
1243
1244
  },
1244
1245
  'fetchMyTrades': {
1246
+ 'marginMode': False,
1245
1247
  'daysBack': 90,
1246
1248
  'limit': 100,
1247
1249
  'untilDays': 10000,
@@ -1252,18 +1254,18 @@ class okx(Exchange, ImplicitAPI):
1252
1254
  'trailing': True,
1253
1255
  },
1254
1256
  'fetchOpenOrders': {
1255
- 'limit': 100,
1256
1257
  'marginMode': False,
1258
+ 'limit': 100,
1257
1259
  'trigger': True,
1258
1260
  'trailing': True,
1259
1261
  },
1260
1262
  'fetchOrders': None, # not supported
1261
1263
  'fetchClosedOrders': {
1264
+ 'marginMode': False,
1262
1265
  'limit': 100,
1263
1266
  'daysBackClosed': 90, # 3 months
1264
1267
  'daysBackCanceled': 1 / 12, # 2 hour
1265
1268
  'untilDays': None,
1266
- 'marginMode': False,
1267
1269
  'trigger': True,
1268
1270
  'trailing': True,
1269
1271
  },
@@ -1818,7 +1820,7 @@ class okx(Exchange, ImplicitAPI):
1818
1820
  'active': active,
1819
1821
  'deposit': canDeposit,
1820
1822
  'withdraw': canWithdraw,
1821
- 'fee': self.safe_number(chain, 'minFee'),
1823
+ 'fee': self.safe_number(chain, 'fee'),
1822
1824
  'precision': self.parse_number(precision),
1823
1825
  'limits': {
1824
1826
  'withdraw': {
@@ -6176,7 +6178,7 @@ class okx(Exchange, ImplicitAPI):
6176
6178
  :param str symbol: unified market symbol
6177
6179
  :param dict [params]: extra parameters specific to the exchange API endpoint
6178
6180
  :param str [params.marginMode]: 'cross' or 'isolated'
6179
- :param str [params.posSide]: 'long' or 'short' for isolated margin long/short mode on futures and swap markets
6181
+ :param str [params.posSide]: 'long' or 'short' or 'net' for isolated margin long/short mode on futures and swap markets, default is 'net'
6180
6182
  :returns dict: response from the exchange
6181
6183
  """
6182
6184
  if symbol is None:
@@ -6198,12 +6200,11 @@ class okx(Exchange, ImplicitAPI):
6198
6200
  'mgnMode': marginMode,
6199
6201
  'instId': market['id'],
6200
6202
  }
6201
- posSide = self.safe_string(params, 'posSide')
6203
+ posSide = self.safe_string(params, 'posSide', 'net')
6202
6204
  if marginMode == 'isolated':
6203
- if posSide is None:
6204
- raise ArgumentsRequired(self.id + ' setLeverage() requires a posSide argument for isolated margin')
6205
6205
  if posSide != 'long' and posSide != 'short' and posSide != 'net':
6206
6206
  raise BadRequest(self.id + ' setLeverage() requires the posSide argument to be either "long", "short" or "net"')
6207
+ request['posSide'] = posSide
6207
6208
  response = await self.privatePostAccountSetLeverage(self.extend(request, params))
6208
6209
  #
6209
6210
  # {
@@ -7106,7 +7107,11 @@ class okx(Exchange, ImplicitAPI):
7106
7107
  :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
7107
7108
  """
7108
7109
  await self.load_markets()
7109
- response = await self.privateGetAssetCurrencies(params)
7110
+ request = {}
7111
+ if codes is not None:
7112
+ ids = self.currency_ids(codes)
7113
+ request['ccy'] = ','.join(ids)
7114
+ response = await self.privateGetAssetCurrencies(self.extend(request, params))
7110
7115
  #
7111
7116
  # {
7112
7117
  # "code": "0",
@@ -7191,7 +7196,7 @@ class okx(Exchange, ImplicitAPI):
7191
7196
  continue
7192
7197
  chainSplit = chain.split('-')
7193
7198
  networkId = self.safe_value(chainSplit, 1)
7194
- withdrawFee = self.safe_number(feeInfo, 'minFee')
7199
+ withdrawFee = self.safe_number(feeInfo, 'fee')
7195
7200
  withdrawResult: dict = {
7196
7201
  'fee': withdrawFee,
7197
7202
  'percentage': False if (withdrawFee is not None) else None,