ccxt 4.5.48 → 4.5.49

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 (43) hide show
  1. package/README.md +6 -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/btcbox.js +1 -1
  6. package/dist/cjs/src/bullish.js +2 -1
  7. package/dist/cjs/src/kraken.js +1 -0
  8. package/dist/cjs/src/krakenfutures.js +10 -1
  9. package/dist/cjs/src/kucoin.js +5 -1
  10. package/dist/cjs/src/lighter.js +6 -3
  11. package/dist/cjs/src/mexc.js +7 -12
  12. package/dist/cjs/src/paradex.js +5 -2
  13. package/dist/cjs/src/pro/binance.js +1 -1
  14. package/dist/cjs/src/pro/cex.js +1 -1
  15. package/dist/cjs/src/pro/coinbase.js +1 -1
  16. package/dist/cjs/src/pro/lighter.js +338 -18
  17. package/dist/cjs/src/pro/weex.js +1906 -0
  18. package/dist/cjs/src/weex.js +3823 -0
  19. package/js/ccxt.d.ts +8 -2
  20. package/js/ccxt.js +6 -2
  21. package/js/src/abstract/weex.d.ts +83 -0
  22. package/js/src/abstract/weex.js +11 -0
  23. package/js/src/btcbox.js +1 -1
  24. package/js/src/bullish.js +2 -1
  25. package/js/src/kraken.js +1 -0
  26. package/js/src/krakenfutures.js +10 -1
  27. package/js/src/kucoin.d.ts +4 -0
  28. package/js/src/kucoin.js +5 -1
  29. package/js/src/lighter.d.ts +1 -0
  30. package/js/src/lighter.js +6 -3
  31. package/js/src/mexc.d.ts +2 -0
  32. package/js/src/mexc.js +7 -12
  33. package/js/src/paradex.js +5 -2
  34. package/js/src/pro/binance.js +1 -1
  35. package/js/src/pro/cex.js +1 -1
  36. package/js/src/pro/coinbase.js +1 -1
  37. package/js/src/pro/lighter.d.ts +37 -2
  38. package/js/src/pro/lighter.js +338 -18
  39. package/js/src/pro/weex.d.ts +330 -0
  40. package/js/src/pro/weex.js +1905 -0
  41. package/js/src/weex.d.ts +675 -0
  42. package/js/src/weex.js +3822 -0
  43. 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.49';
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;
@@ -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
  }
@@ -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);
@@ -1553,6 +1553,7 @@ class lighter extends lighter$1["default"] {
1553
1553
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1554
1554
  * @param {string} [params.by] fetch balance by 'index' or 'l1_address', defaults to 'index'
1555
1555
  * @param {string} [params.value] fetch balance value, account index or l1 address
1556
+ * @param {string} [params.type] 'spot', 'swap', default is 'swap'
1556
1557
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
1557
1558
  */
1558
1559
  async fetchBalance(params = {}) {
@@ -1627,9 +1628,11 @@ class lighter extends lighter$1["default"] {
1627
1628
  }
1628
1629
  }
1629
1630
  else {
1630
- const perpUSDC = this.safeString(account, 'collateral');
1631
- const perpBalance = this.safeDict(result, 'USDC(PERP)', this.account());
1632
- perpBalance['total'] = Precise["default"].stringAdd(perpBalance['total'], perpUSDC);
1631
+ const perpBalance = this.safeDict(result, 'USDC', this.account());
1632
+ const perpUSDCTotal = this.safeString(account, 'collateral');
1633
+ const perpUSDCFree = this.safeString(account, 'available_balance');
1634
+ perpBalance['total'] = Precise["default"].stringAdd(perpBalance['total'], perpUSDCTotal);
1635
+ perpBalance['free'] = Precise["default"].stringAdd(perpBalance['free'], perpUSDCFree);
1633
1636
  result['USDC'] = perpBalance;
1634
1637
  }
1635
1638
  }
@@ -479,11 +479,6 @@ class mexc extends mexc$1["default"] {
479
479
  'options': {
480
480
  'adjustForTimeDifference': false,
481
481
  'timeDifference': 0,
482
- 'unavailableContracts': {
483
- 'BTC/USDT:USDT': true,
484
- 'LTC/USDT:USDT': true,
485
- 'ETH/USDT:USDT': true,
486
- },
487
482
  'fetchMarkets': {
488
483
  'types': {
489
484
  'spot': true,
@@ -2305,6 +2300,7 @@ class mexc extends mexc$1["default"] {
2305
2300
  * @name mexc#createOrder
2306
2301
  * @description create a trade order
2307
2302
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2303
+ * @see https://www.mexc.com/api-docs/futures/account-and-trading-endpoints#place-order
2308
2304
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
2309
2305
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
2310
2306
  * @param {string} symbol unified symbol of the market to create an order in
@@ -2462,6 +2458,7 @@ class mexc extends mexc$1["default"] {
2462
2458
  * @method
2463
2459
  * @name mexc#createSwapOrder
2464
2460
  * @description create a trade order
2461
+ * @see https://www.mexc.com/api-docs/futures/account-and-trading-endpoints#place-order
2465
2462
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2466
2463
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
2467
2464
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
@@ -2487,11 +2484,6 @@ class mexc extends mexc$1["default"] {
2487
2484
  async createSwapOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2488
2485
  await this.loadMarkets();
2489
2486
  const symbol = market['symbol'];
2490
- const unavailableContracts = this.safeValue(this.options, 'unavailableContracts', {});
2491
- const isContractUnavaiable = this.safeBool(unavailableContracts, symbol, false);
2492
- if (isContractUnavaiable) {
2493
- throw new errors.NotSupported(this.id + ' createSwapOrder() does not support yet this symbol:' + symbol);
2494
- }
2495
2487
  let openType = undefined;
2496
2488
  if (marginMode !== undefined) {
2497
2489
  if (marginMode === 'cross') {
@@ -2562,14 +2554,17 @@ class mexc extends mexc$1["default"] {
2562
2554
  if (hedged) {
2563
2555
  if (reduceOnly) {
2564
2556
  params = this.omit(params, 'reduceOnly'); // hedged mode does not accept this parameter
2565
- side = (side === 'buy') ? 'sell' : 'buy';
2557
+ sideInteger = (side === 'buy') ? 4 : 2; // close short, close long
2558
+ }
2559
+ else {
2560
+ sideInteger = (side === 'buy') ? 1 : 3;
2566
2561
  }
2567
- sideInteger = (side === 'buy') ? 1 : 3;
2568
2562
  request['positionMode'] = 1;
2569
2563
  }
2570
2564
  else {
2571
2565
  if (reduceOnly) {
2572
2566
  sideInteger = (side === 'buy') ? 2 : 4;
2567
+ params = this.omit(params, 'reduceOnly');
2573
2568
  }
2574
2569
  else {
2575
2570
  sideInteger = (side === 'buy') ? 1 : 3;
@@ -544,7 +544,9 @@ class paradex extends paradex$1["default"] {
544
544
  // }
545
545
  //
546
546
  const assetKind = this.safeString(market, 'asset_kind');
547
- const isOption = (assetKind === 'PERP_OPTION');
547
+ const isOptionPerpetual = (assetKind === 'PERP_OPTION');
548
+ const isOptionDelivery = (assetKind === 'OPTION');
549
+ const isOption = isOptionPerpetual || isOptionDelivery;
548
550
  const type = (isOption) ? 'option' : 'swap';
549
551
  const isSwap = (type === 'swap');
550
552
  const marketId = this.safeString(market, 'symbol');
@@ -562,7 +564,8 @@ class paradex extends paradex$1["default"] {
562
564
  let makerFee = this.parseNumber('-0.00005');
563
565
  if (isOption) {
564
566
  const optionTypeSuffix = (optionType === 'CALL') ? 'C' : 'P';
565
- symbol = symbol + '-' + strikePrice + '-' + optionTypeSuffix;
567
+ const deliveryValue = (expiry === 0) ? '' : this.yymmdd(expiry) + '-';
568
+ symbol = symbol + '-' + deliveryValue + strikePrice + '-' + optionTypeSuffix;
566
569
  makerFee = this.parseNumber('0.0003');
567
570
  }
568
571
  else {
@@ -249,7 +249,7 @@ class binance extends binance$1["default"] {
249
249
  return baseUrl;
250
250
  }
251
251
  getFutureWsCategory(channel) {
252
- if (channel === 'depth' || channel === 'rpiDepth' || channel === 'bookTicker' || channel === 'trade' || channel === 'aggTrade') {
252
+ if (channel === 'depth' || channel === 'rpiDepth' || channel === 'bookTicker' || channel === 'trade') {
253
253
  return 'public';
254
254
  }
255
255
  return 'market';
@@ -883,7 +883,7 @@ class cex extends cex$1["default"] {
883
883
  // {
884
884
  // "e": "open-orders",
885
885
  // "data": [{
886
- // "id": "59098421630",
886
+ // "id": "59098421631",
887
887
  // "time": "1664062285425",
888
888
  // "type": "buy",
889
889
  // "price": "18920",
@@ -689,7 +689,7 @@ class coinbase extends coinbase$1["default"] {
689
689
  const currentEvent = events[i];
690
690
  const currentTrades = this.safeList(currentEvent, 'trades');
691
691
  for (let j = 0; j < currentTrades.length; j++) {
692
- const item = currentTrades[i];
692
+ const item = currentTrades[j];
693
693
  tradesArray.append(this.parseTrade(item));
694
694
  }
695
695
  }