ccxt 4.4.40 → 4.4.41

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. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +20 -3
  5. package/dist/cjs/src/binance.js +24 -24
  6. package/dist/cjs/src/bingx.js +3 -1
  7. package/dist/cjs/src/bitfinex.js +1 -1
  8. package/dist/cjs/src/bitget.js +1 -0
  9. package/dist/cjs/src/bitmart.js +254 -1
  10. package/dist/cjs/src/bybit.js +8 -8
  11. package/dist/cjs/src/exmo.js +62 -4
  12. package/dist/cjs/src/gate.js +1 -1
  13. package/dist/cjs/src/htx.js +1 -1
  14. package/dist/cjs/src/hyperliquid.js +65 -1
  15. package/dist/cjs/src/kraken.js +129 -26
  16. package/dist/cjs/src/kucoin.js +6 -1
  17. package/dist/cjs/src/mexc.js +3 -3
  18. package/dist/cjs/src/okx.js +6 -1
  19. package/dist/cjs/src/xt.js +5 -2
  20. package/js/ccxt.d.ts +3 -3
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/bitmart.d.ts +2 -0
  23. package/js/src/abstract/okx.d.ts +5 -0
  24. package/js/src/base/Exchange.d.ts +6 -3
  25. package/js/src/base/Exchange.js +20 -3
  26. package/js/src/base/types.d.ts +2 -0
  27. package/js/src/binance.js +24 -24
  28. package/js/src/bingx.js +3 -1
  29. package/js/src/bitfinex.js +1 -1
  30. package/js/src/bitget.js +1 -0
  31. package/js/src/bitmart.d.ts +52 -1
  32. package/js/src/bitmart.js +254 -1
  33. package/js/src/bybit.js +8 -8
  34. package/js/src/exmo.d.ts +35 -0
  35. package/js/src/exmo.js +62 -4
  36. package/js/src/gate.js +1 -1
  37. package/js/src/htx.js +1 -1
  38. package/js/src/hyperliquid.d.ts +20 -1
  39. package/js/src/hyperliquid.js +65 -1
  40. package/js/src/kraken.d.ts +13 -7
  41. package/js/src/kraken.js +129 -26
  42. package/js/src/kucoin.js +6 -1
  43. package/js/src/mexc.js +3 -3
  44. package/js/src/okx.js +6 -1
  45. package/js/src/xt.js +5 -2
  46. package/package.json +2 -2
@@ -31,6 +31,9 @@ class exmo extends exmo$1 {
31
31
  'cancelOrder': true,
32
32
  'cancelOrders': false,
33
33
  'createDepositAddress': false,
34
+ 'createMarketBuyOrder': true,
35
+ 'createMarketBuyOrderWithCost': true,
36
+ 'createMarketOrderWithCost': true,
34
37
  'createOrder': true,
35
38
  'createStopLimitOrder': true,
36
39
  'createStopMarketOrder': true,
@@ -1406,6 +1409,52 @@ class exmo extends exmo$1 {
1406
1409
  }
1407
1410
  return this.filterBySinceLimit(result, since, limit);
1408
1411
  }
1412
+ /**
1413
+ * @method
1414
+ * @name exmo#createMarketOrderWithCost
1415
+ * @description create a market order by providing the symbol, side and cost
1416
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1417
+ * @param {string} symbol unified symbol of the market to create an order in
1418
+ * @param {string} side 'buy' or 'sell'
1419
+ * @param {float} cost how much you want to trade in units of the quote currency
1420
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1421
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1422
+ */
1423
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
1424
+ await this.loadMarkets();
1425
+ params = this.extend(params, { 'cost': cost });
1426
+ return await this.createOrder(symbol, 'market', side, cost, undefined, params);
1427
+ }
1428
+ /**
1429
+ * @method
1430
+ * @name exmo#createMarketBuyOrderWithCost
1431
+ * @description create a market buy order by providing the symbol and cost
1432
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1433
+ * @param {string} symbol unified symbol of the market to create an order in
1434
+ * @param {float} cost how much you want to trade in units of the quote currency
1435
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1436
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1437
+ */
1438
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1439
+ await this.loadMarkets();
1440
+ params = this.extend(params, { 'cost': cost });
1441
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1442
+ }
1443
+ /**
1444
+ * @method
1445
+ * @name exmo#createMarketSellOrderWithCost
1446
+ * @description create a market sell order by providing the symbol and cost
1447
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd
1448
+ * @param {string} symbol unified symbol of the market to create an order in
1449
+ * @param {float} cost how much you want to trade in units of the quote currency
1450
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1451
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1452
+ */
1453
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
1454
+ await this.loadMarkets();
1455
+ params = this.extend(params, { 'cost': cost });
1456
+ return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
1457
+ }
1409
1458
  /**
1410
1459
  * @method
1411
1460
  * @name exmo#createOrder
@@ -1422,6 +1471,7 @@ class exmo extends exmo$1 {
1422
1471
  * @param {float} [params.stopPrice] the price at which a trigger order is triggered at
1423
1472
  * @param {string} [params.timeInForce] *spot only* 'fok', 'ioc' or 'post_only'
1424
1473
  * @param {boolean} [params.postOnly] *spot only* true for post only orders
1474
+ * @param {float} [params.cost] *spot only* *market orders only* the cost of the order in the quote currency for market orders
1425
1475
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1426
1476
  */
1427
1477
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1434,11 +1484,12 @@ class exmo extends exmo$1 {
1434
1484
  throw new errors.BadRequest(this.id + ' only supports isolated margin');
1435
1485
  }
1436
1486
  const isSpot = (marginMode !== 'isolated');
1437
- const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1487
+ const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1488
+ const cost = this.safeString(params, 'cost');
1438
1489
  const request = {
1439
1490
  'pair': market['id'],
1440
1491
  // 'leverage': 2,
1441
- 'quantity': this.amountToPrecision(market['symbol'], amount),
1492
+ // 'quantity': this.amountToPrecision (market['symbol'], amount),
1442
1493
  // spot - buy, sell, market_buy, market_sell, market_buy_total, market_sell_total
1443
1494
  // margin - limit_buy, limit_sell, market_buy, market_sell, stop_buy, stop_sell, stop_limit_buy, stop_limit_sell, trailing_stop_buy, trailing_stop_sell
1444
1495
  // 'stop_price': this.priceToPrecision (symbol, stopPrice),
@@ -1447,6 +1498,12 @@ class exmo extends exmo$1 {
1447
1498
  // 'client_id': 123, // optional, must be a positive integer
1448
1499
  // 'comment': '', // up to 50 latin symbols, whitespaces, underscores
1449
1500
  };
1501
+ if (cost === undefined) {
1502
+ request['quantity'] = this.amountToPrecision(market['symbol'], amount);
1503
+ }
1504
+ else {
1505
+ request['quantity'] = this.costToPrecision(market['symbol'], cost);
1506
+ }
1450
1507
  let clientOrderId = this.safeValue2(params, 'client_id', 'clientOrderId');
1451
1508
  if (clientOrderId !== undefined) {
1452
1509
  clientOrderId = this.safeInteger2(params, 'client_id', 'clientOrderId');
@@ -1461,7 +1518,7 @@ class exmo extends exmo$1 {
1461
1518
  if (!isSpot && (leverage === undefined)) {
1462
1519
  throw new errors.ArgumentsRequired(this.id + ' createOrder requires an extra param params["leverage"] for margin orders');
1463
1520
  }
1464
- params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId']);
1521
+ params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId', 'cost']);
1465
1522
  if (price !== undefined) {
1466
1523
  request['price'] = this.priceToPrecision(market['symbol'], price);
1467
1524
  }
@@ -1487,7 +1544,8 @@ class exmo extends exmo$1 {
1487
1544
  request['type'] = side;
1488
1545
  }
1489
1546
  else if (type === 'market') {
1490
- request['type'] = 'market_' + side;
1547
+ const marketSuffix = (cost !== undefined) ? '_total' : '';
1548
+ request['type'] = 'market_' + side + marketSuffix;
1491
1549
  }
1492
1550
  if (isPostOnly) {
1493
1551
  request['exec_type'] = 'post_only';
@@ -6896,7 +6896,7 @@ class gate extends gate$1 {
6896
6896
  // ...
6897
6897
  // ]
6898
6898
  //
6899
- return this.parseOpenInterests(response, market, since, limit);
6899
+ return this.parseOpenInterestsHistory(response, market, since, limit);
6900
6900
  }
6901
6901
  parseOpenInterest(interest, market = undefined) {
6902
6902
  //
@@ -8640,7 +8640,7 @@ class htx extends htx$1 {
8640
8640
  //
8641
8641
  const data = this.safeValue(response, 'data');
8642
8642
  const tick = this.safeList(data, 'tick');
8643
- return this.parseOpenInterests(tick, market, since, limit);
8643
+ return this.parseOpenInterestsHistory(tick, market, since, limit);
8644
8644
  }
8645
8645
  /**
8646
8646
  * @method
@@ -85,8 +85,9 @@ class hyperliquid extends hyperliquid$1 {
85
85
  'fetchMyLiquidations': false,
86
86
  'fetchMyTrades': true,
87
87
  'fetchOHLCV': true,
88
- 'fetchOpenInterest': false,
88
+ 'fetchOpenInterest': true,
89
89
  'fetchOpenInterestHistory': false,
90
+ 'fetchOpenInterests': true,
90
91
  'fetchOpenOrders': true,
91
92
  'fetchOrder': true,
92
93
  'fetchOrderBook': true,
@@ -3252,6 +3253,69 @@ class hyperliquid extends hyperliquid$1 {
3252
3253
  const withdrawals = this.filterByArray(records, 'type', ['withdraw'], false);
3253
3254
  return this.parseTransactions(withdrawals, undefined, since, limit);
3254
3255
  }
3256
+ /**
3257
+ * @method
3258
+ * @name hyperliquid#fetchOpenInterests
3259
+ * @description Retrieves the open interest for a list of symbols
3260
+ * @param {string[]} [symbols] Unified CCXT market symbol
3261
+ * @param {object} [params] exchange specific parameters
3262
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
3263
+ */
3264
+ async fetchOpenInterests(symbols = undefined, params = {}) {
3265
+ await this.loadMarkets();
3266
+ symbols = this.marketSymbols(symbols);
3267
+ const swapMarkets = await this.fetchSwapMarkets();
3268
+ const result = this.parseOpenInterests(swapMarkets);
3269
+ return this.filterByArray(result, 'symbol', symbols);
3270
+ }
3271
+ /**
3272
+ * @method
3273
+ * @name hyperliquid#fetchOpenInterest
3274
+ * @description retrieves the open interest of a contract trading pair
3275
+ * @param {string} symbol unified CCXT market symbol
3276
+ * @param {object} [params] exchange specific parameters
3277
+ * @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
3278
+ */
3279
+ async fetchOpenInterest(symbol, params = {}) {
3280
+ symbol = this.symbol(symbol);
3281
+ await this.loadMarkets();
3282
+ const ois = await this.fetchOpenInterests([symbol], params);
3283
+ return ois[symbol];
3284
+ }
3285
+ parseOpenInterest(interest, market = undefined) {
3286
+ //
3287
+ // {
3288
+ // szDecimals: '2',
3289
+ // name: 'HYPE',
3290
+ // maxLeverage: '3',
3291
+ // funding: '0.00014735',
3292
+ // openInterest: '14677900.74',
3293
+ // prevDayPx: '26.145',
3294
+ // dayNtlVlm: '299643445.12560016',
3295
+ // premium: '0.00081613',
3296
+ // oraclePx: '27.569',
3297
+ // markPx: '27.63',
3298
+ // midPx: '27.599',
3299
+ // impactPxs: [ '27.5915', '27.6319' ],
3300
+ // dayBaseVlm: '10790652.83',
3301
+ // baseId: 159
3302
+ // }
3303
+ //
3304
+ interest = this.safeDict(interest, 'info', {});
3305
+ const coin = this.safeString(interest, 'name');
3306
+ let marketId = undefined;
3307
+ if (coin !== undefined) {
3308
+ marketId = this.coinToMarketId(coin);
3309
+ }
3310
+ return this.safeOpenInterest({
3311
+ 'symbol': this.safeSymbol(marketId),
3312
+ 'openInterestAmount': this.safeNumber(interest, 'openInterest'),
3313
+ 'openInterestValue': undefined,
3314
+ 'timestamp': undefined,
3315
+ 'datetime': undefined,
3316
+ 'info': interest,
3317
+ }, market);
3318
+ }
3255
3319
  extractTypeFromDelta(data = []) {
3256
3320
  const records = [];
3257
3321
  for (let i = 0; i < data.length; i++) {
@@ -1652,6 +1652,37 @@ class kraken extends kraken$1 {
1652
1652
  // }
1653
1653
  // }
1654
1654
  //
1655
+ // fetchOpenOrders
1656
+ //
1657
+ // {
1658
+ // "refid": null,
1659
+ // "userref": null,
1660
+ // "cl_ord_id": "1234",
1661
+ // "status": "open",
1662
+ // "opentm": 1733815269.370054,
1663
+ // "starttm": 0,
1664
+ // "expiretm": 0,
1665
+ // "descr": {
1666
+ // "pair": "XBTUSD",
1667
+ // "type": "buy",
1668
+ // "ordertype": "limit",
1669
+ // "price": "70000.0",
1670
+ // "price2": "0",
1671
+ // "leverage": "none",
1672
+ // "order": "buy 0.00010000 XBTUSD @ limit 70000.0",
1673
+ // "close": ""
1674
+ // },
1675
+ // "vol": "0.00010000",
1676
+ // "vol_exec": "0.00000000",
1677
+ // "cost": "0.00000",
1678
+ // "fee": "0.00000",
1679
+ // "price": "0.00000",
1680
+ // "stopprice": "0.00000",
1681
+ // "limitprice": "0.00000",
1682
+ // "misc": "",
1683
+ // "oflags": "fciq"
1684
+ // }
1685
+ //
1655
1686
  const description = this.safeDict(order, 'descr', {});
1656
1687
  const orderDescriptionObj = this.safeDict(order, 'descr'); // can be null
1657
1688
  let orderDescription = undefined;
@@ -1742,7 +1773,8 @@ class kraken extends kraken$1 {
1742
1773
  const txid = this.safeList(order, 'txid');
1743
1774
  id = this.safeString(txid, 0);
1744
1775
  }
1745
- const clientOrderId = this.safeString(order, 'userref');
1776
+ const userref = this.safeString(order, 'userref');
1777
+ const clientOrderId = this.safeString(order, 'cl_ord_id', userref);
1746
1778
  const rawTrades = this.safeValue(order, 'trades', []);
1747
1779
  const trades = [];
1748
1780
  for (let i = 0; i < rawTrades.length; i++) {
@@ -1977,10 +2009,10 @@ class kraken extends kraken$1 {
1977
2009
  let request = {
1978
2010
  'txid': id,
1979
2011
  };
1980
- const clientOrderId = this.safeString(params, 'clientOrderId');
2012
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'cl_ord_id');
1981
2013
  if (clientOrderId !== undefined) {
1982
2014
  request['cl_ord_id'] = clientOrderId;
1983
- params = this.omit(params, 'clientOrderId');
2015
+ params = this.omit(params, ['clientOrderId', 'cl_ord_id']);
1984
2016
  request = this.omit(request, 'txid');
1985
2017
  }
1986
2018
  const isMarket = (type === 'market');
@@ -2271,20 +2303,28 @@ class kraken extends kraken$1 {
2271
2303
  * @method
2272
2304
  * @name kraken#cancelOrder
2273
2305
  * @description cancels an open order
2274
- * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrder
2306
+ * @see https://docs.kraken.com/api/docs/rest-api/cancel-order
2275
2307
  * @param {string} id order id
2276
- * @param {string} symbol unified symbol of the market the order was made in
2308
+ * @param {string} [symbol] unified symbol of the market the order was made in
2277
2309
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2278
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2310
+ * @param {string} [params.clientOrderId] the orders client order id
2311
+ * @param {int} [params.userref] the orders user reference id
2312
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2279
2313
  */
2280
2314
  async cancelOrder(id, symbol = undefined, params = {}) {
2281
2315
  await this.loadMarkets();
2282
2316
  let response = undefined;
2283
- const clientOrderId = this.safeValue2(params, 'userref', 'clientOrderId', id);
2284
- const request = {
2285
- 'txid': clientOrderId, // order id or userref
2317
+ const requestId = this.safeValue(params, 'userref', id); // string or integer
2318
+ params = this.omit(params, 'userref');
2319
+ let request = {
2320
+ 'txid': requestId, // order id or userref
2286
2321
  };
2287
- params = this.omit(params, ['userref', 'clientOrderId']);
2322
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'cl_ord_id');
2323
+ if (clientOrderId !== undefined) {
2324
+ request['cl_ord_id'] = clientOrderId;
2325
+ params = this.omit(params, ['clientOrderId', 'cl_ord_id']);
2326
+ request = this.omit(request, 'txid');
2327
+ }
2288
2328
  try {
2289
2329
  response = await this.privatePostCancelOrder(this.extend(request, params));
2290
2330
  //
@@ -2396,11 +2436,13 @@ class kraken extends kraken$1 {
2396
2436
  * @method
2397
2437
  * @name kraken#fetchOpenOrders
2398
2438
  * @description fetch all unfilled currently open orders
2399
- * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
2400
- * @param {string} symbol unified market symbol
2439
+ * @see https://docs.kraken.com/api/docs/rest-api/get-open-orders
2440
+ * @param {string} [symbol] unified market symbol
2401
2441
  * @param {int} [since] the earliest time in ms to fetch open orders for
2402
2442
  * @param {int} [limit] the maximum number of open orders structures to retrieve
2403
2443
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2444
+ * @param {string} [params.clientOrderId] the orders client order id
2445
+ * @param {int} [params.userref] the orders user reference id
2404
2446
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2405
2447
  */
2406
2448
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2409,31 +2451,81 @@ class kraken extends kraken$1 {
2409
2451
  if (since !== undefined) {
2410
2452
  request['start'] = this.parseToInt(since / 1000);
2411
2453
  }
2412
- let query = params;
2413
- const clientOrderId = this.safeValue2(params, 'userref', 'clientOrderId');
2454
+ const userref = this.safeInteger(params, 'userref');
2455
+ if (userref !== undefined) {
2456
+ request['userref'] = userref;
2457
+ params = this.omit(params, 'userref');
2458
+ }
2459
+ const clientOrderId = this.safeString(params, 'clientOrderId');
2414
2460
  if (clientOrderId !== undefined) {
2415
- request['userref'] = clientOrderId;
2416
- query = this.omit(params, ['userref', 'clientOrderId']);
2461
+ request['cl_ord_id'] = clientOrderId;
2462
+ params = this.omit(params, 'clientOrderId');
2417
2463
  }
2418
- const response = await this.privatePostOpenOrders(this.extend(request, query));
2464
+ const response = await this.privatePostOpenOrders(this.extend(request, params));
2465
+ //
2466
+ // {
2467
+ // "error": [],
2468
+ // "result": {
2469
+ // "open": {
2470
+ // "O45M52-BFD5S-YXKQOU": {
2471
+ // "refid": null,
2472
+ // "userref": null,
2473
+ // "cl_ord_id": "1234",
2474
+ // "status": "open",
2475
+ // "opentm": 1733815269.370054,
2476
+ // "starttm": 0,
2477
+ // "expiretm": 0,
2478
+ // "descr": {
2479
+ // "pair": "XBTUSD",
2480
+ // "type": "buy",
2481
+ // "ordertype": "limit",
2482
+ // "price": "70000.0",
2483
+ // "price2": "0",
2484
+ // "leverage": "none",
2485
+ // "order": "buy 0.00010000 XBTUSD @ limit 70000.0",
2486
+ // "close": ""
2487
+ // },
2488
+ // "vol": "0.00010000",
2489
+ // "vol_exec": "0.00000000",
2490
+ // "cost": "0.00000",
2491
+ // "fee": "0.00000",
2492
+ // "price": "0.00000",
2493
+ // "stopprice": "0.00000",
2494
+ // "limitprice": "0.00000",
2495
+ // "misc": "",
2496
+ // "oflags": "fciq"
2497
+ // }
2498
+ // }
2499
+ // }
2500
+ // }
2501
+ //
2419
2502
  let market = undefined;
2420
2503
  if (symbol !== undefined) {
2421
2504
  market = this.market(symbol);
2422
2505
  }
2423
2506
  const result = this.safeDict(response, 'result', {});
2424
- const orders = this.safeDict(result, 'open', {});
2507
+ const open = this.safeDict(result, 'open', {});
2508
+ const orders = [];
2509
+ const orderIds = Object.keys(open);
2510
+ for (let i = 0; i < orderIds.length; i++) {
2511
+ const id = orderIds[i];
2512
+ const item = open[id];
2513
+ orders.push(this.extend({ 'id': id }, item));
2514
+ }
2425
2515
  return this.parseOrders(orders, market, since, limit);
2426
2516
  }
2427
2517
  /**
2428
2518
  * @method
2429
2519
  * @name kraken#fetchClosedOrders
2430
2520
  * @description fetches information on multiple closed orders made by the user
2431
- * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
2432
- * @param {string} symbol unified market symbol of the market orders were made in
2521
+ * @see https://docs.kraken.com/api/docs/rest-api/get-closed-orders
2522
+ * @param {string} [symbol] unified market symbol of the market orders were made in
2433
2523
  * @param {int} [since] the earliest time in ms to fetch orders for
2434
2524
  * @param {int} [limit] the maximum number of order structures to retrieve
2435
2525
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2436
2526
  * @param {int} [params.until] timestamp in ms of the latest entry
2527
+ * @param {string} [params.clientOrderId] the orders client order id
2528
+ * @param {int} [params.userref] the orders user reference id
2437
2529
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2438
2530
  */
2439
2531
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2442,14 +2534,18 @@ class kraken extends kraken$1 {
2442
2534
  if (since !== undefined) {
2443
2535
  request['start'] = this.parseToInt(since / 1000);
2444
2536
  }
2445
- let query = params;
2446
- const clientOrderId = this.safeValue2(params, 'userref', 'clientOrderId');
2537
+ const userref = this.safeInteger(params, 'userref');
2538
+ if (userref !== undefined) {
2539
+ request['userref'] = userref;
2540
+ params = this.omit(params, 'userref');
2541
+ }
2542
+ const clientOrderId = this.safeString(params, 'clientOrderId');
2447
2543
  if (clientOrderId !== undefined) {
2448
- request['userref'] = clientOrderId;
2449
- query = this.omit(params, ['userref', 'clientOrderId']);
2544
+ request['cl_ord_id'] = clientOrderId;
2545
+ params = this.omit(params, 'clientOrderId');
2450
2546
  }
2451
2547
  [request, params] = this.handleUntilOption('end', request, params);
2452
- const response = await this.privatePostClosedOrders(this.extend(request, query));
2548
+ const response = await this.privatePostClosedOrders(this.extend(request, params));
2453
2549
  //
2454
2550
  // {
2455
2551
  // "error":[],
@@ -2494,7 +2590,14 @@ class kraken extends kraken$1 {
2494
2590
  market = this.market(symbol);
2495
2591
  }
2496
2592
  const result = this.safeDict(response, 'result', {});
2497
- const orders = this.safeDict(result, 'closed', {});
2593
+ const closed = this.safeDict(result, 'closed', {});
2594
+ const orders = [];
2595
+ const orderIds = Object.keys(closed);
2596
+ for (let i = 0; i < orderIds.length; i++) {
2597
+ const id = orderIds[i];
2598
+ const item = closed[id];
2599
+ orders.push(this.extend({ 'id': id }, item));
2600
+ }
2498
2601
  return this.parseOrders(orders, market, since, limit);
2499
2602
  }
2500
2603
  parseTransactionStatus(status) {
@@ -640,6 +640,8 @@ class kucoin extends kucoin$1 {
640
640
  'version': 'v1',
641
641
  'symbolSeparator': '-',
642
642
  'fetchMyTradesMethod': 'private_get_fills',
643
+ 'timeDifference': 0,
644
+ 'adjustForTimeDifference': false,
643
645
  'fetchCurrencies': {
644
646
  'webApiEnable': true,
645
647
  'webApiRetries': 1,
@@ -1056,7 +1058,7 @@ class kucoin extends kucoin$1 {
1056
1058
  });
1057
1059
  }
1058
1060
  nonce() {
1059
- return this.milliseconds();
1061
+ return this.milliseconds() - this.options['timeDifference'];
1060
1062
  }
1061
1063
  /**
1062
1064
  * @method
@@ -1297,6 +1299,9 @@ class kucoin extends kucoin$1 {
1297
1299
  'info': market,
1298
1300
  });
1299
1301
  }
1302
+ if (this.options['adjustForTimeDifference']) {
1303
+ await this.loadTimeDifference();
1304
+ }
1300
1305
  return result;
1301
1306
  }
1302
1307
  /**
@@ -675,7 +675,7 @@ class mexc extends mexc$1 {
675
675
  'broker': 'CCXT',
676
676
  },
677
677
  'features': {
678
- 'def': {
678
+ 'default': {
679
679
  'sandbox': false,
680
680
  'createOrder': {
681
681
  'marginMode': true,
@@ -743,10 +743,10 @@ class mexc extends mexc$1 {
743
743
  },
744
744
  },
745
745
  'spot': {
746
- 'extends': 'def',
746
+ 'extends': 'default',
747
747
  },
748
748
  'forDerivs': {
749
- 'extends': 'def',
749
+ 'extends': 'default',
750
750
  'createOrder': {
751
751
  'triggerPrice': true,
752
752
  'triggerPriceType': {
@@ -259,6 +259,7 @@ class okx extends okx$1 {
259
259
  'tradingBot/public/rsi-back-testing': 1,
260
260
  'asset/exchange-list': 5 / 3,
261
261
  'finance/staking-defi/eth/apy-history': 5 / 3,
262
+ 'finance/staking-defi/sol/apy-history': 5 / 3,
262
263
  'finance/savings/lending-rate-summary': 5 / 3,
263
264
  'finance/savings/lending-rate-history': 5 / 3,
264
265
  'finance/fixed-loan/lending-offers': 10 / 3,
@@ -397,6 +398,8 @@ class okx extends okx$1 {
397
398
  'finance/staking-defi/eth/balance': 5 / 3,
398
399
  'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
399
400
  'finance/staking-defi/eth/product-info': 3,
401
+ 'finance/staking-defi/sol/balance': 5 / 3,
402
+ 'finance/staking-defi/sol/purchase-redeem-history': 5 / 3,
400
403
  // copytrading
401
404
  'copytrading/current-subpositions': 1,
402
405
  'copytrading/subpositions-history': 1,
@@ -531,6 +534,8 @@ class okx extends okx$1 {
531
534
  // eth staking
532
535
  'finance/staking-defi/eth/purchase': 5,
533
536
  'finance/staking-defi/eth/redeem': 5,
537
+ 'finance/staking-defi/sol/purchase': 5,
538
+ 'finance/staking-defi/sol/redeem': 5,
534
539
  // copytrading
535
540
  'copytrading/algo-order': 1,
536
541
  'copytrading/close-subposition': 1,
@@ -7395,7 +7400,7 @@ class okx extends okx$1 {
7395
7400
  // }
7396
7401
  //
7397
7402
  const data = this.safeList(response, 'data', []);
7398
- return this.parseOpenInterests(data, undefined, since, limit);
7403
+ return this.parseOpenInterestsHistory(data, undefined, since, limit);
7399
7404
  }
7400
7405
  parseOpenInterest(interest, market = undefined) {
7401
7406
  //
@@ -4380,7 +4380,10 @@ class xt extends xt$1 {
4380
4380
  const marketId = this.safeString(contract, 'symbol');
4381
4381
  const symbol = this.safeSymbol(marketId, market, '_', 'swap');
4382
4382
  const timestamp = this.safeInteger(contract, 'nextCollectionTime');
4383
- const interval = this.safeString(contract, 'collectionInternal');
4383
+ let interval = this.safeString(contract, 'collectionInternal');
4384
+ if (interval !== undefined) {
4385
+ interval = interval + 'h';
4386
+ }
4384
4387
  return {
4385
4388
  'info': contract,
4386
4389
  'symbol': symbol,
@@ -4399,7 +4402,7 @@ class xt extends xt$1 {
4399
4402
  'previousFundingRate': undefined,
4400
4403
  'previousFundingTimestamp': undefined,
4401
4404
  'previousFundingDatetime': undefined,
4402
- 'interval': interval + 'h',
4405
+ 'interval': interval,
4403
4406
  };
4404
4407
  }
4405
4408
  /**
package/js/ccxt.d.ts CHANGED
@@ -2,9 +2,9 @@ import { Exchange } from './src/base/Exchange.js';
2
2
  import { Precise } from './src/base/Precise.js';
3
3
  import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
- import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio } from './src/base/types.js';
5
+ import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OpenInterests } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.39";
7
+ declare const version = "4.4.40";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -573,5 +573,5 @@ declare const ccxt: {
573
573
  zaif: typeof zaif;
574
574
  zonda: typeof zonda;
575
575
  } & typeof functions & typeof errors;
576
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitcoincom, bitfinex, bitfinex1, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, defx, delta, deribit, digifinex, ellipx, exmo, fmfwio, gate, gateio, gemini, hashkey, hitbtc, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, vertex, wavesexchange, wazirx, whitebit, woo, woofipro, xt, yobit, zaif, zonda, };
576
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitcoincom, bitfinex, bitfinex1, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, defx, delta, deribit, digifinex, ellipx, exmo, fmfwio, gate, gateio, gemini, hashkey, hitbtc, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, vertex, wavesexchange, wazirx, whitebit, woo, woofipro, xt, yobit, zaif, zonda, };
577
577
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.40';
41
+ const version = '4.4.41';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -24,6 +24,7 @@ interface Exchange {
24
24
  publicGetContractPublicDepth(params?: {}): Promise<implicitReturnType>;
25
25
  publicGetContractPublicOpenInterest(params?: {}): Promise<implicitReturnType>;
26
26
  publicGetContractPublicFundingRate(params?: {}): Promise<implicitReturnType>;
27
+ publicGetContractPublicFundingRateHistory(params?: {}): Promise<implicitReturnType>;
27
28
  publicGetContractPublicKline(params?: {}): Promise<implicitReturnType>;
28
29
  publicGetAccountV1Currencies(params?: {}): Promise<implicitReturnType>;
29
30
  privateGetAccountSubAccountV1TransferList(params?: {}): Promise<implicitReturnType>;
@@ -63,6 +64,7 @@ interface Exchange {
63
64
  privateGetContractPrivatePositionRisk(params?: {}): Promise<implicitReturnType>;
64
65
  privateGetContractPrivateAffilateRebateList(params?: {}): Promise<implicitReturnType>;
65
66
  privateGetContractPrivateAffilateTradeList(params?: {}): Promise<implicitReturnType>;
67
+ privateGetContractPrivateTransactionHistory(params?: {}): Promise<implicitReturnType>;
66
68
  privatePostAccountSubAccountMainV1SubToMain(params?: {}): Promise<implicitReturnType>;
67
69
  privatePostAccountSubAccountSubV1SubToMain(params?: {}): Promise<implicitReturnType>;
68
70
  privatePostAccountSubAccountMainV1MainToSub(params?: {}): Promise<implicitReturnType>;