ccxt 4.4.34__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 (46) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +1 -0
  3. ccxt/abstract/bitpanda.py +0 -12
  4. ccxt/abstract/bitrue.py +3 -3
  5. ccxt/abstract/okx.py +1 -0
  6. ccxt/abstract/onetrading.py +0 -12
  7. ccxt/abstract/xt.py +5 -5
  8. ccxt/async_support/__init__.py +1 -1
  9. ccxt/async_support/base/exchange.py +1 -1
  10. ccxt/async_support/bingx.py +324 -138
  11. ccxt/async_support/bitmex.py +1 -1
  12. ccxt/async_support/bitrue.py +2 -2
  13. ccxt/async_support/btcmarkets.py +3 -3
  14. ccxt/async_support/btcturk.py +19 -19
  15. ccxt/async_support/gate.py +142 -39
  16. ccxt/async_support/hyperliquid.py +68 -11
  17. ccxt/async_support/idex.py +3 -4
  18. ccxt/async_support/kraken.py +58 -49
  19. ccxt/async_support/kucoin.py +1 -1
  20. ccxt/async_support/okx.py +1 -0
  21. ccxt/async_support/onetrading.py +47 -369
  22. ccxt/async_support/xt.py +10 -10
  23. ccxt/base/exchange.py +2 -1
  24. ccxt/bingx.py +324 -138
  25. ccxt/bitmex.py +1 -1
  26. ccxt/bitrue.py +2 -2
  27. ccxt/btcmarkets.py +3 -3
  28. ccxt/btcturk.py +19 -19
  29. ccxt/gate.py +142 -39
  30. ccxt/hyperliquid.py +68 -11
  31. ccxt/idex.py +3 -4
  32. ccxt/kraken.py +58 -49
  33. ccxt/kucoin.py +1 -1
  34. ccxt/okx.py +1 -0
  35. ccxt/onetrading.py +47 -369
  36. ccxt/pro/__init__.py +1 -1
  37. ccxt/pro/bitrue.py +13 -11
  38. ccxt/pro/probit.py +54 -66
  39. ccxt/test/tests_async.py +29 -2
  40. ccxt/test/tests_sync.py +29 -2
  41. ccxt/xt.py +10 -10
  42. {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/METADATA +4 -4
  43. {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/RECORD +46 -46
  44. {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/LICENSE.txt +0 -0
  45. {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/WHEEL +0 -0
  46. {ccxt-4.4.34.dist-info → ccxt-4.4.35.dist-info}/top_level.txt +0 -0
@@ -19,7 +19,6 @@ from ccxt.base.errors import DDoSProtection
19
19
  from ccxt.base.errors import ExchangeNotAvailable
20
20
  from ccxt.base.decimal_to_precision import ROUND
21
21
  from ccxt.base.decimal_to_precision import TRUNCATE
22
- from ccxt.base.decimal_to_precision import DECIMAL_PLACES
23
22
  from ccxt.base.decimal_to_precision import TICK_SIZE
24
23
  from ccxt.base.decimal_to_precision import PAD_WITH_ZERO
25
24
  from ccxt.base.precise import Precise
@@ -206,10 +205,8 @@ class idex(Exchange, ImplicitAPI):
206
205
  # {"code":"INVALID_PARAMETER","message":"invalid value provided for request parameter \"price\": all quantities and prices must be below 100 billion, above 0, need to be provided, and always require 4 decimals ending with 4 zeroes"}
207
206
  #
208
207
  market = self.market(symbol)
209
- info = self.safe_value(market, 'info', {})
210
- quoteAssetPrecision = self.safe_integer(info, 'quoteAssetPrecision')
211
208
  price = self.decimal_to_precision(price, ROUND, market['precision']['price'], self.precisionMode)
212
- return self.decimal_to_precision(price, TRUNCATE, quoteAssetPrecision, DECIMAL_PLACES, PAD_WITH_ZERO)
209
+ return self.decimal_to_precision(price, TRUNCATE, market['precision']['quote'], TICK_SIZE, PAD_WITH_ZERO)
213
210
 
214
211
  async def fetch_markets(self, params={}) -> List[Market]:
215
212
  """
@@ -316,6 +313,8 @@ class idex(Exchange, ImplicitAPI):
316
313
  'precision': {
317
314
  'amount': basePrecision,
318
315
  'price': self.safe_number(entry, 'tickSize'),
316
+ 'base': basePrecision,
317
+ 'quote': quotePrecision,
319
318
  },
320
319
  'limits': {
321
320
  'leverage': {
@@ -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
  """
@@ -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
  },
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,