ccxt 4.5.48 → 4.5.50

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 (60) hide show
  1. package/README.md +7 -5
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/weex.js +11 -0
  5. package/dist/cjs/src/base/Exchange.js +48 -13
  6. package/dist/cjs/src/bitget.js +1 -0
  7. package/dist/cjs/src/btcbox.js +1 -1
  8. package/dist/cjs/src/bullish.js +2 -1
  9. package/dist/cjs/src/gate.js +0 -1
  10. package/dist/cjs/src/hibachi.js +1 -1
  11. package/dist/cjs/src/kraken.js +1 -0
  12. package/dist/cjs/src/krakenfutures.js +10 -1
  13. package/dist/cjs/src/kucoin.js +5 -1
  14. package/dist/cjs/src/lighter.js +312 -144
  15. package/dist/cjs/src/mexc.js +7 -12
  16. package/dist/cjs/src/okx.js +46 -1
  17. package/dist/cjs/src/paradex.js +5 -2
  18. package/dist/cjs/src/pro/binance.js +1 -1
  19. package/dist/cjs/src/pro/cex.js +1 -1
  20. package/dist/cjs/src/pro/coinbase.js +1 -1
  21. package/dist/cjs/src/pro/hyperliquid.js +361 -1
  22. package/dist/cjs/src/pro/lighter.js +339 -18
  23. package/dist/cjs/src/pro/weex.js +1906 -0
  24. package/dist/cjs/src/weex.js +3823 -0
  25. package/js/ccxt.d.ts +8 -2
  26. package/js/ccxt.js +6 -2
  27. package/js/src/abstract/myokx.d.ts +34 -0
  28. package/js/src/abstract/okx.d.ts +34 -0
  29. package/js/src/abstract/okxus.d.ts +34 -0
  30. package/js/src/abstract/weex.d.ts +83 -0
  31. package/js/src/abstract/weex.js +11 -0
  32. package/js/src/base/Exchange.d.ts +5 -1
  33. package/js/src/base/Exchange.js +48 -13
  34. package/js/src/bitget.js +1 -0
  35. package/js/src/btcbox.js +1 -1
  36. package/js/src/bullish.js +2 -1
  37. package/js/src/gate.js +0 -1
  38. package/js/src/hibachi.js +1 -1
  39. package/js/src/kraken.js +1 -0
  40. package/js/src/krakenfutures.js +10 -1
  41. package/js/src/kucoin.d.ts +4 -0
  42. package/js/src/kucoin.js +5 -1
  43. package/js/src/lighter.d.ts +12 -2
  44. package/js/src/lighter.js +313 -145
  45. package/js/src/mexc.d.ts +2 -0
  46. package/js/src/mexc.js +7 -12
  47. package/js/src/okx.js +46 -1
  48. package/js/src/paradex.js +5 -2
  49. package/js/src/pro/binance.js +1 -1
  50. package/js/src/pro/cex.js +1 -1
  51. package/js/src/pro/coinbase.js +1 -1
  52. package/js/src/pro/hyperliquid.d.ts +48 -1
  53. package/js/src/pro/hyperliquid.js +362 -2
  54. package/js/src/pro/lighter.d.ts +37 -2
  55. package/js/src/pro/lighter.js +339 -18
  56. package/js/src/pro/weex.d.ts +330 -0
  57. package/js/src/pro/weex.js +1905 -0
  58. package/js/src/weex.d.ts +675 -0
  59. package/js/src/weex.js +3822 -0
  60. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -110,6 +110,7 @@ var tokocrypto = require('./src/tokocrypto.js');
110
110
  var toobit = require('./src/toobit.js');
111
111
  var upbit = require('./src/upbit.js');
112
112
  var wavesexchange = require('./src/wavesexchange.js');
113
+ var weex = require('./src/weex.js');
113
114
  var whitebit = require('./src/whitebit.js');
114
115
  var woo = require('./src/woo.js');
115
116
  var woofipro = require('./src/woofipro.js');
@@ -193,6 +194,7 @@ var phemex$1 = require('./src/pro/phemex.js');
193
194
  var poloniex$1 = require('./src/pro/poloniex.js');
194
195
  var toobit$1 = require('./src/pro/toobit.js');
195
196
  var upbit$1 = require('./src/pro/upbit.js');
197
+ var weex$1 = require('./src/pro/weex.js');
196
198
  var whitebit$1 = require('./src/pro/whitebit.js');
197
199
  var woo$1 = require('./src/pro/woo.js');
198
200
  var woofipro$1 = require('./src/pro/woofipro.js');
@@ -200,7 +202,7 @@ var xt$1 = require('./src/pro/xt.js');
200
202
 
201
203
  //-----------------------------------------------------------------------------
202
204
  // this is updated by vss.js when building
203
- const version = '4.5.48';
205
+ const version = '4.5.50';
204
206
  Exchange["default"].ccxtVersion = version;
205
207
  const exchanges = {
206
208
  'aftermath': aftermath["default"],
@@ -305,6 +307,7 @@ const exchanges = {
305
307
  'toobit': toobit["default"],
306
308
  'upbit': upbit["default"],
307
309
  'wavesexchange': wavesexchange["default"],
310
+ 'weex': weex["default"],
308
311
  'whitebit': whitebit["default"],
309
312
  'woo': woo["default"],
310
313
  'woofipro': woofipro["default"],
@@ -390,6 +393,7 @@ const pro = {
390
393
  'poloniex': poloniex$1["default"],
391
394
  'toobit': toobit$1["default"],
392
395
  'upbit': upbit$1["default"],
396
+ 'weex': weex$1["default"],
393
397
  'whitebit': whitebit$1["default"],
394
398
  'woo': woo$1["default"],
395
399
  'woofipro': woofipro$1["default"],
@@ -548,6 +552,7 @@ exports.tokocrypto = tokocrypto["default"];
548
552
  exports.toobit = toobit["default"];
549
553
  exports.upbit = upbit["default"];
550
554
  exports.wavesexchange = wavesexchange["default"];
555
+ exports.weex = weex["default"];
551
556
  exports.whitebit = whitebit["default"];
552
557
  exports.woo = woo["default"];
553
558
  exports.woofipro = woofipro["default"];
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Exchange$1 = require('../base/Exchange.js');
6
+
7
+ // ----------------------------------------------------------------------------
8
+ class Exchange extends Exchange$1["default"] {
9
+ }
10
+
11
+ exports["default"] = Exchange;
@@ -1610,7 +1610,7 @@ class Exchange {
1610
1610
  unlockId() {
1611
1611
  return undefined; // c# stub
1612
1612
  }
1613
- async loadLighterLibrary(libraryPath, chainId, privateKey, apiKeyIndex, accountIndex) {
1613
+ async loadLighterLibrary(libraryPath, chainId, privateKey, apiKeyIndex, accountIndex, createClient = false) {
1614
1614
  // wasmExecPathExample: '/opt/homebrew/opt/go/libexec/lib/wasm/wasm_exec.js';
1615
1615
  // libraryPath eg: '/Users/cjg/Git/lighter-go/lighter.wasm';
1616
1616
  if (libraryPath === undefined || libraryPath === '') {
@@ -1630,11 +1630,16 @@ class Exchange {
1630
1630
  const bytes = new Uint8Array(readFile(libraryPath, null)); // it should point to lighter.wasm
1631
1631
  const { instance } = await WebAssembly.instantiate(bytes, go.importObject);
1632
1632
  go.run(instance);
1633
- // createCLient
1633
+ if (createClient) {
1634
+ this.lighterCreateClient(undefined, chainId, privateKey, apiKeyIndex, accountIndex);
1635
+ }
1636
+ return {}; // empty object we will read it from globalThis
1637
+ }
1638
+ lighterCreateClient(signer, chainId, privateKey, apiKeyIndex, accountIndex) {
1634
1639
  const url = this.implodeHostname(this.urls['api']['public']);
1635
1640
  const res = globalThis.CreateClient(url, privateKey, chainId, apiKeyIndex, accountIndex);
1636
1641
  this.checkLighterSignedError(res);
1637
- return {}; // empty object we will read it from globalThis
1642
+ return signer;
1638
1643
  }
1639
1644
  // eslint-disable-next-line no-unused-vars
1640
1645
  lighterSignCreateGroupedOrders(signer, request) {
@@ -1655,13 +1660,15 @@ class Exchange {
1655
1660
  'OrderExpiry': order['order_expiry'],
1656
1661
  });
1657
1662
  }
1658
- const res = globalThis.SignCreateGroupedOrders(request['grouping_type'], ordersArr, orders.length, request['nonce'], request['api_key_index'], request['account_index']);
1663
+ const res = globalThis.SignCreateGroupedOrders(request['grouping_type'], ordersArr, orders.length, 0, // skip nonce
1664
+ request['nonce'], request['api_key_index'], request['account_index']);
1659
1665
  this.checkLighterSignedError(res);
1660
1666
  return [res.txType, res.txInfo];
1661
1667
  }
1662
1668
  // eslint-disable-next-line no-unused-vars
1663
1669
  lighterSignCreateOrder(signer, request) {
1664
- const res = (globalThis.SignCreateOrder(parseInt(request['market_index']), request['client_order_index'], request['base_amount'], request['avg_execution_price'], request['is_ask'], request['order_type'], request['time_in_force'], request['reduce_only'], request['trigger_price'], request['order_expiry'], request['nonce'], request['api_key_index'], request['account_index']));
1670
+ const res = (globalThis.SignCreateOrder(parseInt(request['market_index']), request['client_order_index'], request['base_amount'], request['avg_execution_price'], request['is_ask'], request['order_type'], request['time_in_force'], request['reduce_only'], request['trigger_price'], request['order_expiry'], request['integrator_account_index'], request['integrator_taker_fee'], request['integrator_maker_fee'], 0, // skip nonce
1671
+ request['nonce'], request['api_key_index'], request['account_index']));
1665
1672
  this.checkLighterSignedError(res);
1666
1673
  return [res.txType, res.txInfo];
1667
1674
  }
@@ -1671,38 +1678,45 @@ class Exchange {
1671
1678
  }
1672
1679
  }
1673
1680
  lighterSignCancelOrder(signer, request) {
1674
- const res = (globalThis.SignCancelOrder(request['market_index'], request['order_index'], request['nonce'], request['api_key_index'], request['account_index']));
1681
+ const res = (globalThis.SignCancelOrder(request['market_index'], request['order_index'], 0, // skip nonce
1682
+ request['nonce'], request['api_key_index'], request['account_index']));
1675
1683
  this.checkLighterSignedError(res);
1676
1684
  return [res.txType, res.txInfo];
1677
1685
  }
1678
1686
  lighterSignWithdraw(signer, request) {
1679
- const res = (globalThis.SignWithdraw(request['asset_index'], request['route_type'], request['amount'], request['nonce'], request['api_key_index'], request['account_index']));
1687
+ const res = (globalThis.SignWithdraw(request['asset_index'], request['route_type'], request['amount'], 0, // skip nonce
1688
+ request['nonce'], request['api_key_index'], request['account_index']));
1680
1689
  this.checkLighterSignedError(res);
1681
1690
  return [res.txType, res.txInfo];
1682
1691
  }
1683
1692
  // eslint-disable-next-line no-unused-vars
1684
1693
  lighterSignCreateSubAccount(signer, request) {
1685
- const res = (globalThis.SignCreateSubAccount(request['nonce'], request['api_key_index'], request['account_index']));
1694
+ const res = (globalThis.SignCreateSubAccount(0, // skip nonce
1695
+ request['nonce'], request['api_key_index'], request['account_index']));
1686
1696
  this.checkLighterSignedError(res);
1687
1697
  return [res.txType, res.txInfo];
1688
1698
  }
1689
1699
  lighterSignCancelAllOrders(signer, request) {
1690
- const res = (globalThis.SignCancelAllOrders(request['time_in_force'], request['time'], request['nonce'], request['api_key_index'], request['account_index']));
1700
+ const res = (globalThis.SignCancelAllOrders(request['time_in_force'], request['time'], 0, // skip nonce
1701
+ request['nonce'], request['api_key_index'], request['account_index']));
1691
1702
  this.checkLighterSignedError(res);
1692
1703
  return [res.txType, res.txInfo];
1693
1704
  }
1694
1705
  lighterSignModifyOrder(signer, request) {
1695
- const res = (globalThis.SignModifyOrder(request['market_index'], request['index'], request['base_amount'], request['price'], request['trigger_price'], request['nonce'], request['api_key_index'], request['account_index']));
1706
+ const res = (globalThis.SignModifyOrder(request['market_index'], request['index'], request['base_amount'], request['price'], request['trigger_price'], request['integrator_account_index'], request['integrator_taker_fee'], request['integrator_maker_fee'], 0, // skip nonce
1707
+ request['nonce'], request['api_key_index'], request['account_index']));
1696
1708
  this.checkLighterSignedError(res);
1697
1709
  return [res.txType, res.txInfo];
1698
1710
  }
1699
1711
  lighterSignTransfer(signer, request) {
1700
- const res = globalThis.SignTransfer(request['to_account_index'], request['asset_index'], request['from_route_type'], request['to_route_type'], request['amount'], request['usdc_fee'], request['memo'], request['nonce'], request['api_key_index'], request['account_index']);
1712
+ const res = globalThis.SignTransfer(request['to_account_index'], request['asset_index'], request['from_route_type'], request['to_route_type'], request['amount'], request['usdc_fee'], request['memo'], 0, // skip nonce
1713
+ request['nonce'], request['api_key_index'], request['account_index']);
1701
1714
  this.checkLighterSignedError(res);
1702
1715
  return [res.txType, res.txInfo];
1703
1716
  }
1704
1717
  lighterSignUpdateLeverage(signer, request) {
1705
- const res = (globalThis.SignUpdateLeverage(request['market_index'], request['initial_margin_fraction'], request['margin_mode'], request['nonce'], request['api_key_index'], request['account_index']));
1718
+ const res = (globalThis.SignUpdateLeverage(request['market_index'], request['initial_margin_fraction'], request['margin_mode'], 0, // skip nonce
1719
+ request['nonce'], request['api_key_index'], request['account_index']));
1706
1720
  this.checkLighterSignedError(res);
1707
1721
  return [res.txType, res.txInfo];
1708
1722
  }
@@ -1712,10 +1726,31 @@ class Exchange {
1712
1726
  return res.authToken;
1713
1727
  }
1714
1728
  lighterSignUpdateMargin(signer, request) {
1715
- const res = globalThis.SignUpdateMargin(request['market_index'], request['usdc_amount'], request['direction'], request['nonce'], request['api_key_index'], request['account_index']);
1729
+ const res = globalThis.SignUpdateMargin(request['market_index'], request['usdc_amount'], request['direction'], 0, // skip nonce
1730
+ request['nonce'], request['api_key_index'], request['account_index']);
1716
1731
  this.checkLighterSignedError(res);
1717
1732
  return [res.txType, res.txInfo];
1718
1733
  }
1734
+ // eslint-disable-next-line no-unused-vars
1735
+ lighterSignApproveIntegrator(signer, request) {
1736
+ const res = globalThis.SignApproveIntegrator(request['integrator_account_index'], request['integrator_taker_fee'], request['integrator_maker_fee'], request['integrator_taker_fee'], request['integrator_maker_fee'], request['approval_expiry'], 0, // skip nonce
1737
+ request['nonce'], request['api_key_index'], request['account_index']);
1738
+ this.checkLighterSignedError(res);
1739
+ return [res.txType, res.txInfo, res.messageToSign];
1740
+ }
1741
+ // eslint-disable-next-line no-unused-vars
1742
+ lighterGenerateApiKey(signer) {
1743
+ const res = globalThis.GenerateAPIKey();
1744
+ this.checkLighterSignedError(res);
1745
+ return [res.privateKey, res.publicKey];
1746
+ }
1747
+ // eslint-disable-next-line no-unused-vars
1748
+ lighterSignChangePubkey(signer, request) {
1749
+ const res = globalThis.SignChangePubKey(Buffer.from(request['pubkey']).toString(), 0, // skip nonce
1750
+ request['nonce'], request['api_key_index'], request['account_index']);
1751
+ this.checkLighterSignedError(res);
1752
+ return [res.txType, res.txInfo, res.messageToSign];
1753
+ }
1719
1754
  /* eslint-enable */
1720
1755
  // ------------------------------------------------------------------------
1721
1756
  // ########################################################################
@@ -1393,6 +1393,7 @@ class bitget extends bitget$1["default"] {
1393
1393
  '43115': errors.OnMaintenance,
1394
1394
  '45110': errors.InvalidOrder,
1395
1395
  '40774': errors.InvalidOrder,
1396
+ '40917': errors.InvalidOrder,
1396
1397
  '45122': errors.InvalidOrder,
1397
1398
  // spot
1398
1399
  'invalid sign': errors.AuthenticationError,
@@ -624,7 +624,7 @@ class btcbox extends btcbox$1["default"] {
624
624
  //
625
625
  // {
626
626
  // "id":11,
627
- // "datetime":"2014-10-21 10:47:20",
627
+ // "datetime":"2014-10-21 10:47:21",
628
628
  // "type":"sell",
629
629
  // "price":42000,
630
630
  // "amount_original":1.2,
@@ -820,7 +820,8 @@ class bullish extends bullish$1["default"] {
820
820
  expiryDatetime = this.safeString(market, 'expiryDatetime');
821
821
  const idParts = id.split('-');
822
822
  const datePart = this.safeString(idParts, 2);
823
- symbol += '-' + datePart;
823
+ const dateYmd = datePart.slice(2);
824
+ symbol += '-' + dateYmd;
824
825
  if (type === 'future') {
825
826
  future = true;
826
827
  }
@@ -719,7 +719,6 @@ class gate extends gate$1["default"] {
719
719
  'MPH': 'MORPHER',
720
720
  'POINT': 'GATEPOINT',
721
721
  'RAI': 'RAIREFLEXINDEX',
722
- 'RED': 'RedLang',
723
722
  'SBTC': 'SUPERBITCOIN',
724
723
  'TNC': 'TRINITYNETWORKCREDIT',
725
724
  'VAI': 'VAIOT',
@@ -1738,7 +1738,7 @@ class hibachi extends hibachi$1["default"] {
1738
1738
  // "status": "pending",
1739
1739
  // "timestampSec": 1752692872,
1740
1740
  // "token": "USDT",
1741
- // "transactionHash": "0x408e48881e0ba77d8638e3fe57bc06bdec513ddaa8b672e0aefa7e22e2f18b5e",
1741
+ // "transactionHash": "0x408e48881e0ba77d8638e3fe57bc06bdec513ddaa8b672e0aefa7e22e2f18b4e",
1742
1742
  // "transactionType": "deposit"
1743
1743
  // },
1744
1744
  // {
@@ -561,6 +561,7 @@ class kraken extends kraken$1["default"] {
561
561
  'EFunding:No funding method': errors.BadRequest,
562
562
  'EFunding:Unknown asset': errors.BadSymbol,
563
563
  'EService:Market in post_only mode': errors.OnMaintenance,
564
+ 'EService:Market in cancel_only mode': errors.OnMaintenance,
564
565
  'EGeneral:Too many requests': errors.DDoSProtection,
565
566
  'ETrade:User Locked': errors.AccountSuspended, // {"error":["ETrade:User Locked"]}
566
567
  },
@@ -1569,7 +1569,7 @@ class krakenfutures extends krakenfutures$1["default"] {
1569
1569
  request['count'] = limit;
1570
1570
  }
1571
1571
  if (since !== undefined) {
1572
- request['from'] = since;
1572
+ request['since'] = since;
1573
1573
  }
1574
1574
  const isTrigger = this.safeBool2(params, 'trigger', 'stop', false);
1575
1575
  let response = undefined;
@@ -1586,6 +1586,7 @@ class krakenfutures extends krakenfutures$1["default"] {
1586
1586
  const order = allOrders[i];
1587
1587
  const event = this.safeDict(order, 'event', {});
1588
1588
  const orderPlaced = this.safeDict2(event, 'OrderPlaced', 'OrderTriggerActivated');
1589
+ const orderUpdated = this.safeDict(event, 'OrderUpdated');
1589
1590
  if (orderPlaced !== undefined) {
1590
1591
  const innerOrder = this.safeDict(orderPlaced, 'order', {});
1591
1592
  const filled = this.safeString(innerOrder, 'filled');
@@ -1594,6 +1595,14 @@ class krakenfutures extends krakenfutures$1["default"] {
1594
1595
  closedOrders.push(innerOrder);
1595
1596
  }
1596
1597
  }
1598
+ else if (orderUpdated !== undefined) {
1599
+ const reason = this.safeString(orderUpdated, 'reason');
1600
+ if (reason === 'full_fill') {
1601
+ const newOrder = this.safeDict(orderUpdated, 'newOrder', {});
1602
+ newOrder['status'] = 'closed';
1603
+ closedOrders.push(newOrder);
1604
+ }
1605
+ }
1597
1606
  }
1598
1607
  return this.parseOrders(closedOrders, market, since, limit);
1599
1608
  }
@@ -9967,6 +9967,8 @@ class kucoin extends kucoin$1["default"] {
9967
9967
  * @param {string} symbol unified market symbol of the market the position is held in
9968
9968
  * @param {object} [params] extra parameters specific to the exchange API endpoint
9969
9969
  * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
9970
+ * @param {integer} [params.pageSize] *uta only* page size for the uta endpoint (default 50, max 200)
9971
+ * @param {integer} [params.pageNumber] *uta only* page number for the uta endpoint (default 1)
9970
9972
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/?id=position-structure}
9971
9973
  */
9972
9974
  async fetchPosition(symbol, params = {}) {
@@ -10067,6 +10069,8 @@ class kucoin extends kucoin$1["default"] {
10067
10069
  * @param {string[]|undefined} symbols list of unified market symbols
10068
10070
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10069
10071
  * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
10072
+ * @param {integer} [params.pageSize] *uta only* page size for the uta endpoint (default 50, max 200)
10073
+ * @param {integer} [params.pageNumber] *uta only* page number for the uta endpoint (default 1)
10070
10074
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/?id=position-structure}
10071
10075
  */
10072
10076
  async fetchPositions(symbols = undefined, params = {}) {
@@ -10075,7 +10079,7 @@ class kucoin extends kucoin$1["default"] {
10075
10079
  [uta, params] = this.handleOptionAndParams(params, 'fetchPositions', 'uta', uta);
10076
10080
  let response = undefined;
10077
10081
  if (uta) {
10078
- response = await this.utaPrivateGetAccountModePositionOpenList(this.extend(params, { 'accountMode': 'unified' }));
10082
+ response = await this.utaPrivateGetAccountModePositionOpenList(this.extend({ 'accountMode': 'unified', 'limit': 200 }, params));
10079
10083
  }
10080
10084
  else {
10081
10085
  response = await this.futuresPrivateGetPositions(params);