ccxt 4.4.75__py2.py3-none-any.whl → 4.4.78__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 (111) hide show
  1. ccxt/__init__.py +3 -3
  2. ccxt/abstract/apex.py +31 -0
  3. ccxt/abstract/myokx.py +4 -0
  4. ccxt/abstract/okx.py +4 -0
  5. ccxt/abstract/upbit.py +51 -37
  6. ccxt/abstract/xt.py +3 -0
  7. ccxt/apex.py +1884 -0
  8. ccxt/ascendex.py +2 -2
  9. ccxt/async_support/__init__.py +3 -3
  10. ccxt/async_support/apex.py +1884 -0
  11. ccxt/async_support/ascendex.py +2 -2
  12. ccxt/async_support/base/exchange.py +2 -2
  13. ccxt/async_support/binance.py +39 -217
  14. ccxt/async_support/bingx.py +1 -1
  15. ccxt/async_support/bitfinex.py +2 -2
  16. ccxt/async_support/bitflyer.py +2 -2
  17. ccxt/async_support/bitget.py +135 -65
  18. ccxt/async_support/bitmart.py +2 -2
  19. ccxt/async_support/bitmex.py +6 -6
  20. ccxt/async_support/bitrue.py +48 -0
  21. ccxt/async_support/cex.py +1 -1
  22. ccxt/async_support/coinbase.py +29 -4
  23. ccxt/async_support/coincatch.py +66 -0
  24. ccxt/async_support/coinex.py +3 -1
  25. ccxt/async_support/coinlist.py +85 -2
  26. ccxt/async_support/cryptocom.py +2 -2
  27. ccxt/async_support/defx.py +1 -1
  28. ccxt/async_support/delta.py +1 -1
  29. ccxt/async_support/deribit.py +2 -2
  30. ccxt/async_support/derive.py +2 -2
  31. ccxt/async_support/digifinex.py +2 -2
  32. ccxt/async_support/gate.py +1 -1
  33. ccxt/async_support/hitbtc.py +5 -2
  34. ccxt/async_support/htx.py +2 -2
  35. ccxt/async_support/hyperliquid.py +13 -6
  36. ccxt/async_support/kraken.py +2 -2
  37. ccxt/async_support/krakenfutures.py +2 -2
  38. ccxt/async_support/kucoinfutures.py +2 -2
  39. ccxt/async_support/mexc.py +50 -52
  40. ccxt/async_support/okx.py +21 -9
  41. ccxt/async_support/oxfun.py +2 -2
  42. ccxt/async_support/paradex.py +5 -10
  43. ccxt/async_support/phemex.py +4 -3
  44. ccxt/async_support/poloniex.py +3 -3
  45. ccxt/async_support/probit.py +1 -0
  46. ccxt/async_support/tradeogre.py +2 -1
  47. ccxt/async_support/upbit.py +265 -89
  48. ccxt/async_support/vertex.py +2 -2
  49. ccxt/async_support/whitebit.py +1 -0
  50. ccxt/async_support/woo.py +5 -3
  51. ccxt/async_support/woofipro.py +2 -2
  52. ccxt/async_support/xt.py +115 -5
  53. ccxt/base/exchange.py +76 -3
  54. ccxt/binance.py +39 -217
  55. ccxt/bingx.py +1 -1
  56. ccxt/bitfinex.py +2 -2
  57. ccxt/bitflyer.py +2 -2
  58. ccxt/bitget.py +135 -65
  59. ccxt/bitmart.py +2 -2
  60. ccxt/bitmex.py +6 -6
  61. ccxt/bitrue.py +48 -0
  62. ccxt/cex.py +1 -1
  63. ccxt/coinbase.py +29 -4
  64. ccxt/coincatch.py +66 -0
  65. ccxt/coinex.py +3 -1
  66. ccxt/coinlist.py +85 -2
  67. ccxt/cryptocom.py +2 -2
  68. ccxt/defx.py +1 -1
  69. ccxt/delta.py +1 -1
  70. ccxt/deribit.py +2 -2
  71. ccxt/derive.py +2 -2
  72. ccxt/digifinex.py +2 -2
  73. ccxt/gate.py +1 -1
  74. ccxt/hitbtc.py +5 -2
  75. ccxt/htx.py +2 -2
  76. ccxt/hyperliquid.py +13 -6
  77. ccxt/kraken.py +2 -2
  78. ccxt/krakenfutures.py +2 -2
  79. ccxt/kucoinfutures.py +2 -2
  80. ccxt/mexc.py +50 -52
  81. ccxt/okx.py +21 -9
  82. ccxt/oxfun.py +2 -2
  83. ccxt/paradex.py +5 -10
  84. ccxt/phemex.py +4 -3
  85. ccxt/poloniex.py +3 -3
  86. ccxt/pro/__init__.py +5 -1
  87. ccxt/pro/apex.py +984 -0
  88. ccxt/pro/coinbase.py +4 -6
  89. ccxt/pro/gate.py +22 -2
  90. ccxt/pro/hollaex.py +2 -2
  91. ccxt/pro/hyperliquid.py +1 -1
  92. ccxt/pro/p2b.py +2 -2
  93. ccxt/pro/tradeogre.py +272 -0
  94. ccxt/probit.py +1 -0
  95. ccxt/test/tests_async.py +27 -0
  96. ccxt/test/tests_sync.py +27 -0
  97. ccxt/tradeogre.py +2 -1
  98. ccxt/upbit.py +265 -89
  99. ccxt/vertex.py +2 -2
  100. ccxt/whitebit.py +1 -0
  101. ccxt/woo.py +5 -3
  102. ccxt/woofipro.py +2 -2
  103. ccxt/xt.py +115 -5
  104. {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/METADATA +4 -4
  105. {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/RECORD +108 -106
  106. ccxt/abstract/ace.py +0 -15
  107. ccxt/ace.py +0 -1152
  108. ccxt/async_support/ace.py +0 -1152
  109. {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/LICENSE.txt +0 -0
  110. {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/WHEEL +0 -0
  111. {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/top_level.txt +0 -0
ccxt/xt.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.xt import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Any, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderSide, OrderType, Str, Tickers, FundingRate, Transaction, TransferEntry
9
+ from ccxt.base.types import Any, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderSide, OrderType, Position, Str, Tickers, FundingRate, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -58,7 +58,7 @@ class xt(Exchange, ImplicitAPI):
58
58
  'createOrder': True,
59
59
  'createPostOnlyOrder': False,
60
60
  'createReduceOnlyOrder': True,
61
- 'editOrder': False,
61
+ 'editOrder': True,
62
62
  'fetchAccounts': False,
63
63
  'fetchBalance': True,
64
64
  'fetchBidsAsks': True,
@@ -245,6 +245,9 @@ class xt(Exchange, ImplicitAPI):
245
245
  'open-order': 1,
246
246
  'order/{orderId}': 1,
247
247
  },
248
+ 'put': {
249
+ 'order/{orderId}': 1,
250
+ },
248
251
  },
249
252
  'linear': {
250
253
  'get': {
@@ -279,6 +282,7 @@ class xt(Exchange, ImplicitAPI):
279
282
  'future/trade/v1/order/cancel-all': 1,
280
283
  'future/trade/v1/order/create': 1,
281
284
  'future/trade/v1/order/create-batch': 1,
285
+ 'future/trade/v1/order/update': 1,
282
286
  'future/user/v1/account/open': 1,
283
287
  'future/user/v1/position/adjust-leverage': 1,
284
288
  'future/user/v1/position/auto-margin': 1,
@@ -322,6 +326,7 @@ class xt(Exchange, ImplicitAPI):
322
326
  'future/trade/v1/order/cancel-all': 1,
323
327
  'future/trade/v1/order/create': 1,
324
328
  'future/trade/v1/order/create-batch': 1,
329
+ 'future/trade/v1/order/update': 1,
325
330
  'future/user/v1/account/open': 1,
326
331
  'future/user/v1/position/adjust-leverage': 1,
327
332
  'future/user/v1/position/auto-margin': 1,
@@ -956,6 +961,12 @@ class xt(Exchange, ImplicitAPI):
956
961
  },
957
962
  },
958
963
  }
964
+ typeRaw = self.safe_string(entry, 'type')
965
+ type: Str = None
966
+ if typeRaw == 'FT':
967
+ type = 'crypto'
968
+ else:
969
+ type = 'other'
959
970
  result[code] = {
960
971
  'info': entry,
961
972
  'id': currencyId,
@@ -967,6 +978,7 @@ class xt(Exchange, ImplicitAPI):
967
978
  'deposit': deposit,
968
979
  'withdraw': withdraw,
969
980
  'networks': networks,
981
+ 'type': type,
970
982
  'limits': {
971
983
  'amount': {
972
984
  'min': None,
@@ -3337,7 +3349,7 @@ class xt(Exchange, ImplicitAPI):
3337
3349
  # "cancelId": "208322474307982720"
3338
3350
  # }
3339
3351
  #
3340
- # swap and future: createOrder, cancelOrder
3352
+ # swap and future: createOrder, cancelOrder, editOrder
3341
3353
  #
3342
3354
  # {
3343
3355
  # "returnCode": 0,
@@ -3442,6 +3454,14 @@ class xt(Exchange, ImplicitAPI):
3442
3454
  # "createdTime": 1681273420039
3443
3455
  # }
3444
3456
  #
3457
+ # spot editOrder
3458
+ #
3459
+ # {
3460
+ # "orderId": "484203027161892224",
3461
+ # "modifyId": "484203544105344000",
3462
+ # "clientModifyId": null
3463
+ # }
3464
+ #
3445
3465
  marketId = self.safe_string(order, 'symbol')
3446
3466
  marketType = ('result' in order) or 'contract' if ('positionSide' in order) else 'spot'
3447
3467
  market = self.safe_market(marketId, market, None, marketType)
@@ -3455,7 +3475,7 @@ class xt(Exchange, ImplicitAPI):
3455
3475
  return self.safe_order({
3456
3476
  'info': order,
3457
3477
  'id': self.safe_string_n(order, ['orderId', 'result', 'cancelId', 'entrustId', 'profitId']),
3458
- 'clientOrderId': self.safe_string(order, 'clientOrderId'),
3478
+ 'clientOrderId': self.safe_string_2(order, 'clientOrderId', 'clientModifyId'),
3459
3479
  'timestamp': timestamp,
3460
3480
  'datetime': self.iso8601(timestamp),
3461
3481
  'lastTradeTimestamp': lastUpdatedTimestamp,
@@ -4473,7 +4493,7 @@ class xt(Exchange, ImplicitAPI):
4473
4493
  return self.parse_position(entry, marketInner)
4474
4494
  return None
4475
4495
 
4476
- def fetch_positions(self, symbols: List[str] = None, params={}):
4496
+ def fetch_positions(self, symbols: List[str] = None, params={}) -> List[Position]:
4477
4497
  """
4478
4498
  fetch all open positions
4479
4499
 
@@ -4678,6 +4698,94 @@ class xt(Exchange, ImplicitAPI):
4678
4698
  #
4679
4699
  return response # unify return type
4680
4700
 
4701
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
4702
+ """
4703
+ cancels an order and places a new order
4704
+
4705
+ https://doc.xt.com/#orderorderUpdate
4706
+ https://doc.xt.com/#futures_orderupdate
4707
+ https://doc.xt.com/#futures_entrustupdateProfit
4708
+
4709
+ :param str id: order id
4710
+ :param str symbol: unified symbol of the market to create an order in
4711
+ :param str type: 'market' or 'limit'
4712
+ :param str side: 'buy' or 'sell'
4713
+ :param float amount: how much of the currency you want to trade in units of the base currency
4714
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
4715
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4716
+ :param float [params.stopLoss]: price to set a stop-loss on an open position
4717
+ :param float [params.takeProfit]: price to set a take-profit on an open position
4718
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4719
+ """
4720
+ if amount is None:
4721
+ raise ArgumentsRequired(self.id + ' editOrder() requires an amount argument')
4722
+ self.load_markets()
4723
+ market = self.market(symbol)
4724
+ request = {}
4725
+ stopLoss = self.safe_number_2(params, 'stopLoss', 'triggerStopPrice')
4726
+ takeProfit = self.safe_number_2(params, 'takeProfit', 'triggerProfitPrice')
4727
+ params = self.omit(params, ['stopLoss', 'takeProfit'])
4728
+ isStopLoss = (stopLoss is not None)
4729
+ isTakeProfit = (takeProfit is not None)
4730
+ if isStopLoss or isTakeProfit:
4731
+ request['profitId'] = id
4732
+ else:
4733
+ request['orderId'] = id
4734
+ request['price'] = self.price_to_precision(symbol, price)
4735
+ response = None
4736
+ if market['swap']:
4737
+ if isStopLoss:
4738
+ request['triggerStopPrice'] = self.price_to_precision(symbol, stopLoss)
4739
+ elif takeProfit is not None:
4740
+ request['triggerProfitPrice'] = self.price_to_precision(symbol, takeProfit)
4741
+ else:
4742
+ request['origQty'] = self.amount_to_precision(symbol, amount)
4743
+ subType = None
4744
+ subType, params = self.handle_sub_type_and_params('editOrder', market, params)
4745
+ if subType == 'inverse':
4746
+ if isStopLoss or isTakeProfit:
4747
+ response = self.privateInversePostFutureTradeV1EntrustUpdateProfitStop(self.extend(request, params))
4748
+ else:
4749
+ response = self.privateInversePostFutureTradeV1OrderUpdate(self.extend(request, params))
4750
+ #
4751
+ # {
4752
+ # "returnCode": 0,
4753
+ # "msgInfo": "success",
4754
+ # "error": null,
4755
+ # "result": "483869474947826752"
4756
+ # }
4757
+ #
4758
+ else:
4759
+ if isStopLoss or isTakeProfit:
4760
+ response = self.privateLinearPostFutureTradeV1EntrustUpdateProfitStop(self.extend(request, params))
4761
+ else:
4762
+ response = self.privateLinearPostFutureTradeV1OrderUpdate(self.extend(request, params))
4763
+ #
4764
+ # {
4765
+ # "returnCode": 0,
4766
+ # "msgInfo": "success",
4767
+ # "error": null,
4768
+ # "result": "483869474947826752"
4769
+ # }
4770
+ #
4771
+ else:
4772
+ request['quantity'] = self.amount_to_precision(symbol, amount)
4773
+ response = self.privateSpotPutOrderOrderId(self.extend(request, params))
4774
+ #
4775
+ # {
4776
+ # "rc": 0,
4777
+ # "mc": "SUCCESS",
4778
+ # "ma": [],
4779
+ # "result": {
4780
+ # "orderId": "484203027161892224",
4781
+ # "modifyId": "484203544105344000",
4782
+ # "clientModifyId": null
4783
+ # }
4784
+ # }
4785
+ #
4786
+ result = response if (market['swap']) else self.safe_dict(response, 'result', {})
4787
+ return self.parse_order(result, market)
4788
+
4681
4789
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4682
4790
  #
4683
4791
  # spot: error
@@ -4775,6 +4883,8 @@ class xt(Exchange, ImplicitAPI):
4775
4883
  else:
4776
4884
  body['media'] = id
4777
4885
  isUndefinedBody = ((method == 'GET') or (path == 'order/{orderId}') or (path == 'ws-token'))
4886
+ if (method == 'PUT') and (endpoint == 'spot'):
4887
+ isUndefinedBody = False
4778
4888
  body = None if isUndefinedBody else self.json(body)
4779
4889
  payloadString = None
4780
4890
  if (endpoint == 'spot') or (endpoint == 'user'):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ccxt
3
- Version: 4.4.75
3
+ Version: 4.4.78
4
4
  Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
5
5
  Home-page: https://ccxt.com
6
6
  Author: Igor Kroitor
@@ -275,13 +275,13 @@ console.log(version, Object.keys(exchanges));
275
275
 
276
276
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
277
277
 
278
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.75/dist/ccxt.browser.min.js
279
- * unpkg: https://unpkg.com/ccxt@4.4.75/dist/ccxt.browser.min.js
278
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.4.78/dist/ccxt.browser.min.js
279
+ * unpkg: https://unpkg.com/ccxt@4.4.78/dist/ccxt.browser.min.js
280
280
 
281
281
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
282
282
 
283
283
  ```HTML
284
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.75/dist/ccxt.browser.min.js"></script>
284
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.4.78/dist/ccxt.browser.min.js"></script>
285
285
  ```
286
286
 
287
287
  Creates a global `ccxt` object: