ccxt 4.5.44 → 4.5.45

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 (81) hide show
  1. package/README.md +9 -12
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -12
  4. package/dist/cjs/src/abstract/kucoinfutures.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +36 -3
  6. package/dist/cjs/src/base/functions/encode.js +2 -2
  7. package/dist/cjs/src/base/functions/generic.js +8 -2
  8. package/dist/cjs/src/bitrue.js +1 -1
  9. package/dist/cjs/src/bitteam.js +1 -1
  10. package/dist/cjs/src/btcbox.js +1 -1
  11. package/dist/cjs/src/cex.js +1 -0
  12. package/dist/cjs/src/gate.js +227 -168
  13. package/dist/cjs/src/grvt.js +3 -2
  14. package/dist/cjs/src/hyperliquid.js +16 -5
  15. package/dist/cjs/src/kraken.js +2 -2
  16. package/dist/cjs/src/krakenfutures.js +1 -5
  17. package/dist/cjs/src/kucoin.js +4729 -970
  18. package/dist/cjs/src/kucoinfutures.js +14 -3434
  19. package/dist/cjs/src/lbank.js +1 -1
  20. package/dist/cjs/src/poloniex.js +1 -1
  21. package/dist/cjs/src/pro/gate.js +37 -1
  22. package/dist/cjs/src/pro/kucoin.js +819 -178
  23. package/dist/cjs/src/pro/kucoinfutures.js +95 -1261
  24. package/dist/cjs/src/pro/mexc.js +10 -5
  25. package/dist/cjs/src/pro/okx.js +84 -39
  26. package/js/ccxt.d.ts +2 -14
  27. package/js/ccxt.js +2 -10
  28. package/js/src/abstract/kucoin.d.ts +46 -3
  29. package/js/src/abstract/kucoinfutures.d.ts +27 -12
  30. package/js/src/base/Exchange.d.ts +12 -1
  31. package/js/src/base/Exchange.js +36 -3
  32. package/js/src/base/functions/encode.js +2 -2
  33. package/js/src/base/functions/generic.js +9 -3
  34. package/js/src/bitrue.js +1 -1
  35. package/js/src/bitteam.js +1 -1
  36. package/js/src/btcbox.js +1 -1
  37. package/js/src/cex.js +2 -1
  38. package/js/src/gate.d.ts +125 -119
  39. package/js/src/gate.js +227 -168
  40. package/js/src/grvt.js +3 -2
  41. package/js/src/hyperliquid.d.ts +3 -1
  42. package/js/src/hyperliquid.js +16 -5
  43. package/js/src/kraken.js +2 -2
  44. package/js/src/krakenfutures.js +1 -5
  45. package/js/src/kucoin.d.ts +696 -100
  46. package/js/src/kucoin.js +4730 -971
  47. package/js/src/kucoinfutures.d.ts +4 -522
  48. package/js/src/kucoinfutures.js +14 -3434
  49. package/js/src/lbank.js +1 -1
  50. package/js/src/poloniex.js +1 -1
  51. package/js/src/pro/gate.d.ts +30 -1
  52. package/js/src/pro/gate.js +37 -1
  53. package/js/src/pro/kucoin.d.ts +70 -30
  54. package/js/src/pro/kucoin.js +821 -180
  55. package/js/src/pro/kucoinfutures.d.ts +17 -195
  56. package/js/src/pro/kucoinfutures.js +96 -1262
  57. package/js/src/pro/mexc.js +10 -5
  58. package/js/src/pro/okx.d.ts +1 -0
  59. package/js/src/pro/okx.js +84 -39
  60. package/package.json +1 -1
  61. package/dist/cjs/src/abstract/alp.js +0 -11
  62. package/dist/cjs/src/abstract/defx.js +0 -11
  63. package/dist/cjs/src/abstract/timex.js +0 -11
  64. package/dist/cjs/src/alp.js +0 -1059
  65. package/dist/cjs/src/defx.js +0 -2142
  66. package/dist/cjs/src/pro/defx.js +0 -866
  67. package/dist/cjs/src/timex.js +0 -1793
  68. package/js/src/abstract/alp.d.ts +0 -21
  69. package/js/src/abstract/alp.js +0 -5
  70. package/js/src/abstract/defx.d.ts +0 -72
  71. package/js/src/abstract/defx.js +0 -5
  72. package/js/src/abstract/timex.d.ts +0 -65
  73. package/js/src/abstract/timex.js +0 -5
  74. package/js/src/alp.d.ts +0 -209
  75. package/js/src/alp.js +0 -1052
  76. package/js/src/defx.d.ts +0 -348
  77. package/js/src/defx.js +0 -2135
  78. package/js/src/pro/defx.d.ts +0 -236
  79. package/js/src/pro/defx.js +0 -859
  80. package/js/src/timex.d.ts +0 -247
  81. package/js/src/timex.js +0 -1786
@@ -1423,7 +1423,7 @@ export default class mexc extends mexcRest {
1423
1423
  //
1424
1424
  const timestamp = this.safeInteger(order, 'createTime');
1425
1425
  const side = this.safeString(order, 'tradeType');
1426
- const status = this.safeString(order, 'status');
1426
+ const status = this.safeString2(order, 'status', 'state');
1427
1427
  const type = this.safeString(order, 'orderType');
1428
1428
  let fee = undefined;
1429
1429
  const feeCurrency = this.safeString(order, 'N');
@@ -1445,8 +1445,8 @@ export default class mexc extends mexcRest {
1445
1445
  'timeInForce': this.parseWsTimeInForce(type),
1446
1446
  'side': (side === '1') ? 'buy' : 'sell',
1447
1447
  'price': this.safeString(order, 'price'),
1448
- 'stopPrice': undefined,
1449
- 'triggerPrice': undefined,
1448
+ 'stopPrice': this.safeString2(order, 'triggerPrice', 'P'),
1449
+ 'triggerPrice': this.safeString2(order, 'triggerPrice', 'P'),
1450
1450
  'average': this.safeString(order, 'avgPrice'),
1451
1451
  'amount': this.safeString(order, 'quantity'),
1452
1452
  'cost': this.safeString(order, 'amount'),
@@ -1459,6 +1459,7 @@ export default class mexc extends mexcRest {
1459
1459
  }
1460
1460
  parseWsOrderStatus(status, market = undefined) {
1461
1461
  const statuses = {
1462
+ '0': 'open',
1462
1463
  '1': 'open',
1463
1464
  '2': 'closed',
1464
1465
  '3': 'open',
@@ -1478,7 +1479,9 @@ export default class mexc extends mexcRest {
1478
1479
  '3': undefined,
1479
1480
  '4': undefined,
1480
1481
  '5': 'market',
1481
- '100': 'limit', // STOP_LIMIT
1482
+ '100': 'limit',
1483
+ '101': 'limit',
1484
+ '102': 'limit', // OCO_LIMIT
1482
1485
  };
1483
1486
  return this.safeString(types, type);
1484
1487
  }
@@ -1489,7 +1492,9 @@ export default class mexc extends mexcRest {
1489
1492
  '3': 'IOC',
1490
1493
  '4': 'FOK',
1491
1494
  '5': 'GTC',
1492
- '100': 'GTC', // STOP_LIMIT
1495
+ '100': 'GTC',
1496
+ '101': 'GTC',
1497
+ '102': 'GTC', // OCO_LIMIT
1493
1498
  };
1494
1499
  return this.safeString(timeInForceIds, timeInForce);
1495
1500
  }
@@ -280,6 +280,7 @@ export default class okx extends okxRest {
280
280
  /**
281
281
  * @method
282
282
  * @name okx#watchBalance
283
+ * @see https://www.okx.com/docs-v5/en/#trading-account-websocket-account-channel
283
284
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
284
285
  * @param {object} [params] extra parameters specific to the exchange API endpoint
285
286
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
package/js/src/pro/okx.js CHANGED
@@ -1531,6 +1531,7 @@ export default class okx extends okxRest {
1531
1531
  /**
1532
1532
  * @method
1533
1533
  * @name okx#watchBalance
1534
+ * @see https://www.okx.com/docs-v5/en/#trading-account-websocket-account-channel
1534
1535
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
1535
1536
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1536
1537
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
@@ -1546,55 +1547,99 @@ export default class okx extends okxRest {
1546
1547
  handleBalance(client, message) {
1547
1548
  //
1548
1549
  // {
1549
- // "arg": { channel: "account" },
1550
- // "data": [
1550
+ // arg: {
1551
+ // channel: 'account',
1552
+ // uid: '158635852459810816'
1553
+ // },
1554
+ // eventType: 'snapshot',
1555
+ // curPage: 1,
1556
+ // lastPage: true,
1557
+ // data: [
1551
1558
  // {
1552
- // "adjEq": '',
1553
- // "details": [
1559
+ // adjEq: '100942.13298468884',
1560
+ // availEq: '98461.99074635761',
1561
+ // borrowFroz: '409.3702076072169',
1562
+ // delta: '',
1563
+ // deltaLever: '',
1564
+ // deltaNeutralStatus: '',
1565
+ // details: [
1554
1566
  // {
1555
- // "availBal": '',
1556
- // "availEq": "8.21009913",
1557
- // "cashBal": "8.21009913",
1558
- // "ccy": "USDT",
1559
- // "coinUsdPrice": "0.99994",
1560
- // "crossLiab": '',
1561
- // "disEq": "8.2096065240522",
1562
- // "eq": "8.21009913",
1563
- // "eqUsd": "8.2096065240522",
1564
- // "frozenBal": "0",
1565
- // "interest": '',
1566
- // "isoEq": "0",
1567
- // "isoLiab": '',
1568
- // "liab": '',
1569
- // "maxLoan": '',
1570
- // "mgnRatio": '',
1571
- // "notionalLever": "0",
1572
- // "ordFrozen": "0",
1573
- // "twap": "0",
1574
- // "uTime": "1621927314996",
1575
- // "upl": "0"
1576
- // },
1567
+ // accAvgPx: '',
1568
+ // autoLendAmt: '0',
1569
+ // autoLendMtAmt: '0',
1570
+ // autoLendStatus: 'unsupported',
1571
+ // autoStakingStatus: 'unsupported',
1572
+ // availBal: '2900',
1573
+ // availEq: '2900',
1574
+ // borrowFroz: '0',
1575
+ // cashBal: '2900',
1576
+ // ccy: 'TUSD',
1577
+ // clSpotInUseAmt: '',
1578
+ // coinUsdPrice: '200.026',
1579
+ // colBorrAutoConversion: '0',
1580
+ // colRes: '0',
1581
+ // collateralEnabled: false,
1582
+ // collateralRestrict: false,
1583
+ // crossLiab: '0',
1584
+ // disEq: '0',
1585
+ // eq: '2900',
1586
+ // eqUsd: '580075.4',
1587
+ // fixedBal: '0',
1588
+ // frozenBal: '0',
1589
+ // frpType: '0',
1590
+ // imr: '',
1591
+ // interest: '0',
1592
+ // isoEq: '0',
1593
+ // isoLiab: '0',
1594
+ // isoUpl: '0',
1595
+ // liab: '0',
1596
+ // maxLoan: '0',
1597
+ // maxSpotInUseAmt: '',
1598
+ // mgnRatio: '',
1599
+ // mmr: '',
1600
+ // notionalLever: '',
1601
+ // openAvgPx: '',
1602
+ // ordFrozen: '0',
1603
+ // rewardBal: '',
1604
+ // smtSyncEq: '0',
1605
+ // spotBal: '',
1606
+ // spotCopyTradingEq: '0',
1607
+ // spotInUseAmt: '',
1608
+ // spotIsoBal: '0',
1609
+ // spotUpl: '',
1610
+ // spotUplRatio: '',
1611
+ // stgyEq: '0',
1612
+ // totalPnl: '',
1613
+ // totalPnlRatio: '',
1614
+ // twap: '0',
1615
+ // uTime: '1752243427083',
1616
+ // upl: '0',
1617
+ // uplLiab: '0'
1618
+ // }
1577
1619
  // ],
1578
- // "imr": '',
1579
- // "isoEq": "0",
1580
- // "mgnRatio": '',
1581
- // "mmr": '',
1582
- // "notionalUsd": '',
1583
- // "ordFroz": '',
1584
- // "totalEq": "22.1930992296832",
1585
- // "uTime": "1626692120916"
1620
+ // imr: '2480.1422383312265',
1621
+ // isoEq: '0',
1622
+ // mgnRatio: '1814.5924297007082',
1623
+ // mmr: '52.196024182958055',
1624
+ // notionalUsd: '4634.0971302081125',
1625
+ // notionalUsdForBorrow: '2046.8510380360844',
1626
+ // notionalUsdForFutures: '101.11322817202809',
1627
+ // notionalUsdForOption: '0',
1628
+ // notionalUsdForSwap: '2486.1328640000006',
1629
+ // ordFroz: '1208.3566666666668',
1630
+ // totalEq: '711018.8951315446',
1631
+ // uTime: '1773837554158',
1632
+ // upl: '9.244336372701904'
1586
1633
  // }
1587
1634
  // ]
1588
1635
  // }
1589
1636
  //
1590
1637
  const arg = this.safeValue(message, 'arg', {});
1591
1638
  const channel = this.safeString(arg, 'channel');
1592
- const type = 'spot';
1593
1639
  const balance = this.parseTradingBalance(message);
1594
- const oldBalance = this.safeValue(this.balance, type, {});
1595
- const newBalance = this.deepExtend(oldBalance, balance);
1596
- this.balance[type] = this.safeBalance(newBalance);
1597
- client.resolve(this.balance[type], channel);
1640
+ const newBalance = this.deepExtend(this.balance, balance);
1641
+ this.balance = this.safeBalance(newBalance);
1642
+ client.resolve(this.balance, channel);
1598
1643
  }
1599
1644
  orderToTrade(order, market = undefined) {
1600
1645
  const info = this.safeValue(order, 'info', {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.5.44",
3
+ "version": "4.5.45",
4
4
  "description": "A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",
@@ -1,11 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;