ccxt 4.4.39 → 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 (190) 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/ascendex.js +9 -9
  5. package/dist/cjs/src/base/Exchange.js +32 -21
  6. package/dist/cjs/src/binance.js +37 -43
  7. package/dist/cjs/src/bingx.js +4 -3
  8. package/dist/cjs/src/bit2c.js +0 -1
  9. package/dist/cjs/src/bitbank.js +0 -1
  10. package/dist/cjs/src/bitbns.js +0 -1
  11. package/dist/cjs/src/bitfinex.js +18 -19
  12. package/dist/cjs/src/bitfinex1.js +0 -1
  13. package/dist/cjs/src/bitflyer.js +0 -1
  14. package/dist/cjs/src/bitget.js +2 -2
  15. package/dist/cjs/src/bithumb.js +0 -1
  16. package/dist/cjs/src/bitmart.js +257 -5
  17. package/dist/cjs/src/bitmex.js +5 -6
  18. package/dist/cjs/src/bitopro.js +4 -5
  19. package/dist/cjs/src/bitrue.js +5 -7
  20. package/dist/cjs/src/bitso.js +1 -2
  21. package/dist/cjs/src/bitstamp.js +1 -2
  22. package/dist/cjs/src/bitteam.js +1 -3
  23. package/dist/cjs/src/bitvavo.js +2 -4
  24. package/dist/cjs/src/blockchaincom.js +5 -5
  25. package/dist/cjs/src/blofin.js +10 -10
  26. package/dist/cjs/src/btcalpha.js +0 -1
  27. package/dist/cjs/src/btcbox.js +0 -1
  28. package/dist/cjs/src/btcmarkets.js +1 -3
  29. package/dist/cjs/src/bybit.js +10 -11
  30. package/dist/cjs/src/cex.js +1 -1
  31. package/dist/cjs/src/coinbase.js +77 -1
  32. package/dist/cjs/src/coinbaseexchange.js +1 -1
  33. package/dist/cjs/src/coinbaseinternational.js +62 -0
  34. package/dist/cjs/src/coincatch.js +1 -1
  35. package/dist/cjs/src/coinex.js +9 -9
  36. package/dist/cjs/src/coinlist.js +1 -1
  37. package/dist/cjs/src/coinmetro.js +1 -1
  38. package/dist/cjs/src/cryptocom.js +91 -2
  39. package/dist/cjs/src/currencycom.js +1 -1
  40. package/dist/cjs/src/defx.js +1 -2
  41. package/dist/cjs/src/delta.js +1 -1
  42. package/dist/cjs/src/digifinex.js +1 -1
  43. package/dist/cjs/src/exmo.js +64 -6
  44. package/dist/cjs/src/gate.js +2 -2
  45. package/dist/cjs/src/hashkey.js +3 -5
  46. package/dist/cjs/src/htx.js +2 -2
  47. package/dist/cjs/src/hyperliquid.js +66 -2
  48. package/dist/cjs/src/kraken.js +130 -27
  49. package/dist/cjs/src/kucoin.js +30 -25
  50. package/dist/cjs/src/luno.js +1 -1
  51. package/dist/cjs/src/mexc.js +138 -2
  52. package/dist/cjs/src/ndax.js +1 -1
  53. package/dist/cjs/src/okcoin.js +18 -18
  54. package/dist/cjs/src/okx.js +27 -22
  55. package/dist/cjs/src/phemex.js +12 -8
  56. package/dist/cjs/src/poloniex.js +1 -1
  57. package/dist/cjs/src/poloniexfutures.js +6 -6
  58. package/dist/cjs/src/pro/bitget.js +1 -1
  59. package/dist/cjs/src/pro/bybit.js +13 -1
  60. package/dist/cjs/src/pro/coinex.js +2 -2
  61. package/dist/cjs/src/pro/gate.js +6 -6
  62. package/dist/cjs/src/pro/kucoin.js +3 -3
  63. package/dist/cjs/src/pro/okx.js +11 -11
  64. package/dist/cjs/src/pro/upbit.js +3 -3
  65. package/dist/cjs/src/vertex.js +11 -11
  66. package/dist/cjs/src/woo.js +33 -33
  67. package/dist/cjs/src/woofipro.js +24 -24
  68. package/dist/cjs/src/xt.js +31 -28
  69. package/dist/cjs/src/zonda.js +1 -1
  70. package/js/ccxt.d.ts +3 -3
  71. package/js/ccxt.js +1 -1
  72. package/js/src/abstract/bitmart.d.ts +2 -0
  73. package/js/src/abstract/okx.d.ts +5 -0
  74. package/js/src/ascendex.d.ts +2 -2
  75. package/js/src/ascendex.js +9 -9
  76. package/js/src/base/Exchange.d.ts +6 -3
  77. package/js/src/base/Exchange.js +32 -21
  78. package/js/src/base/types.d.ts +2 -0
  79. package/js/src/binance.d.ts +9 -9
  80. package/js/src/binance.js +37 -43
  81. package/js/src/bingx.d.ts +1 -1
  82. package/js/src/bingx.js +4 -3
  83. package/js/src/bit2c.js +0 -1
  84. package/js/src/bitbank.js +0 -1
  85. package/js/src/bitbns.js +0 -1
  86. package/js/src/bitfinex.d.ts +3 -3
  87. package/js/src/bitfinex.js +18 -19
  88. package/js/src/bitfinex1.js +0 -1
  89. package/js/src/bitflyer.js +0 -1
  90. package/js/src/bitget.d.ts +1 -1
  91. package/js/src/bitget.js +2 -2
  92. package/js/src/bithumb.js +0 -1
  93. package/js/src/bitmart.d.ts +53 -2
  94. package/js/src/bitmart.js +257 -5
  95. package/js/src/bitmex.d.ts +1 -1
  96. package/js/src/bitmex.js +5 -6
  97. package/js/src/bitopro.js +4 -5
  98. package/js/src/bitrue.js +5 -7
  99. package/js/src/bitso.d.ts +1 -1
  100. package/js/src/bitso.js +1 -2
  101. package/js/src/bitstamp.d.ts +1 -1
  102. package/js/src/bitstamp.js +1 -2
  103. package/js/src/bitteam.js +1 -3
  104. package/js/src/bitvavo.d.ts +1 -1
  105. package/js/src/bitvavo.js +2 -4
  106. package/js/src/blockchaincom.js +5 -5
  107. package/js/src/blofin.d.ts +3 -3
  108. package/js/src/blofin.js +10 -10
  109. package/js/src/btcalpha.js +0 -1
  110. package/js/src/btcbox.js +0 -1
  111. package/js/src/btcmarkets.js +1 -3
  112. package/js/src/bybit.d.ts +1 -1
  113. package/js/src/bybit.js +10 -11
  114. package/js/src/cex.d.ts +1 -1
  115. package/js/src/cex.js +1 -1
  116. package/js/src/coinbase.d.ts +1 -1
  117. package/js/src/coinbase.js +77 -1
  118. package/js/src/coinbaseexchange.d.ts +1 -1
  119. package/js/src/coinbaseexchange.js +1 -1
  120. package/js/src/coinbaseinternational.js +62 -0
  121. package/js/src/coincatch.d.ts +1 -1
  122. package/js/src/coincatch.js +1 -1
  123. package/js/src/coinex.js +9 -9
  124. package/js/src/coinlist.d.ts +1 -1
  125. package/js/src/coinlist.js +1 -1
  126. package/js/src/coinmetro.d.ts +1 -1
  127. package/js/src/coinmetro.js +1 -1
  128. package/js/src/cryptocom.d.ts +2 -2
  129. package/js/src/cryptocom.js +91 -2
  130. package/js/src/currencycom.d.ts +1 -1
  131. package/js/src/currencycom.js +1 -1
  132. package/js/src/defx.d.ts +1 -2
  133. package/js/src/defx.js +1 -2
  134. package/js/src/delta.d.ts +1 -1
  135. package/js/src/delta.js +1 -1
  136. package/js/src/digifinex.d.ts +1 -1
  137. package/js/src/digifinex.js +1 -1
  138. package/js/src/exmo.d.ts +35 -0
  139. package/js/src/exmo.js +64 -6
  140. package/js/src/gate.d.ts +1 -1
  141. package/js/src/gate.js +2 -2
  142. package/js/src/hashkey.d.ts +1 -1
  143. package/js/src/hashkey.js +3 -5
  144. package/js/src/htx.d.ts +1 -1
  145. package/js/src/htx.js +2 -2
  146. package/js/src/hyperliquid.d.ts +21 -2
  147. package/js/src/hyperliquid.js +66 -2
  148. package/js/src/kraken.d.ts +14 -8
  149. package/js/src/kraken.js +130 -27
  150. package/js/src/kucoin.d.ts +13 -13
  151. package/js/src/kucoin.js +30 -25
  152. package/js/src/luno.d.ts +1 -1
  153. package/js/src/luno.js +1 -1
  154. package/js/src/mexc.d.ts +1 -2
  155. package/js/src/mexc.js +138 -2
  156. package/js/src/ndax.d.ts +1 -1
  157. package/js/src/ndax.js +1 -1
  158. package/js/src/okcoin.d.ts +4 -4
  159. package/js/src/okcoin.js +18 -18
  160. package/js/src/okx.d.ts +3 -3
  161. package/js/src/okx.js +27 -22
  162. package/js/src/phemex.js +12 -8
  163. package/js/src/poloniex.d.ts +1 -1
  164. package/js/src/poloniex.js +1 -1
  165. package/js/src/poloniexfutures.d.ts +1 -1
  166. package/js/src/poloniexfutures.js +6 -6
  167. package/js/src/pro/bitget.d.ts +1 -1
  168. package/js/src/pro/bitget.js +1 -1
  169. package/js/src/pro/bybit.d.ts +1 -1
  170. package/js/src/pro/bybit.js +13 -1
  171. package/js/src/pro/coinex.js +2 -2
  172. package/js/src/pro/gate.d.ts +2 -2
  173. package/js/src/pro/gate.js +6 -6
  174. package/js/src/pro/kucoin.d.ts +1 -1
  175. package/js/src/pro/kucoin.js +3 -3
  176. package/js/src/pro/okx.d.ts +2 -2
  177. package/js/src/pro/okx.js +11 -11
  178. package/js/src/pro/upbit.d.ts +3 -3
  179. package/js/src/pro/upbit.js +3 -3
  180. package/js/src/vertex.d.ts +3 -3
  181. package/js/src/vertex.js +11 -11
  182. package/js/src/woo.d.ts +7 -7
  183. package/js/src/woo.js +33 -33
  184. package/js/src/woofipro.d.ts +1 -1
  185. package/js/src/woofipro.js +24 -24
  186. package/js/src/xt.d.ts +7 -7
  187. package/js/src/xt.js +31 -28
  188. package/js/src/zonda.d.ts +1 -1
  189. package/js/src/zonda.js +1 -1
  190. package/package.json +2 -2
@@ -1134,7 +1134,7 @@ class kraken extends kraken$1 {
1134
1134
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1135
1135
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
1136
1136
  * @param {int} [params.end] timestamp in seconds of the latest ledger entry
1137
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1137
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
1138
1138
  */
1139
1139
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1140
1140
  // https://www.kraken.com/features/api#get-ledgers-info
@@ -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
  /**
@@ -2232,7 +2237,7 @@ class kucoin extends kucoin$1 {
2232
2237
  * market orders --------------------------------------------------
2233
2238
  * @param {string} [params.funds] // Amount of quote currency to use
2234
2239
  * stop orders ----------------------------------------------------
2235
- * @param {string} [params.stop] Either loss or entry, the default is loss. Requires stopPrice to be defined
2240
+ * @param {string} [params.stop] Either loss or entry, the default is loss. Requires triggerPrice to be defined
2236
2241
  * margin orders --------------------------------------------------
2237
2242
  * @param {float} [params.leverage] Leverage size of the order
2238
2243
  * @param {string} [params.stp] '', // self trade prevention, CN, CO, CB or DC
@@ -2573,7 +2578,7 @@ class kucoin extends kucoin$1 {
2573
2578
  * @param {string} id order id
2574
2579
  * @param {string} symbol unified symbol of the market the order was made in
2575
2580
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2576
- * @param {bool} [params.stop] True if cancelling a stop order
2581
+ * @param {bool} [params.trigger] True if cancelling a stop order
2577
2582
  * @param {bool} [params.hf] false, // true for hf order
2578
2583
  * @param {bool} [params.sync] false, // true to use the hf sync call
2579
2584
  * @returns Response from the exchange
@@ -2582,7 +2587,7 @@ class kucoin extends kucoin$1 {
2582
2587
  await this.loadMarkets();
2583
2588
  const request = {};
2584
2589
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2585
- const stop = this.safeBool2(params, 'stop', 'trigger', false);
2590
+ const trigger = this.safeBool2(params, 'stop', 'trigger', false);
2586
2591
  let hf = undefined;
2587
2592
  [hf, params] = this.handleHfAndParams(params);
2588
2593
  let useSync = false;
@@ -2598,7 +2603,7 @@ class kucoin extends kucoin$1 {
2598
2603
  params = this.omit(params, ['clientOid', 'clientOrderId', 'stop', 'trigger']);
2599
2604
  if (clientOrderId !== undefined) {
2600
2605
  request['clientOid'] = clientOrderId;
2601
- if (stop) {
2606
+ if (trigger) {
2602
2607
  response = await this.privateDeleteStopOrderCancelOrderByClientOid(this.extend(request, params));
2603
2608
  //
2604
2609
  // {
@@ -2642,7 +2647,7 @@ class kucoin extends kucoin$1 {
2642
2647
  }
2643
2648
  else {
2644
2649
  request['orderId'] = id;
2645
- if (stop) {
2650
+ if (trigger) {
2646
2651
  response = await this.privateDeleteStopOrderOrderId(this.extend(request, params));
2647
2652
  //
2648
2653
  // {
@@ -2694,7 +2699,7 @@ class kucoin extends kucoin$1 {
2694
2699
  * @see https://docs.kucoin.com/spot-hf/#cancel-all-hf-orders-by-symbol
2695
2700
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
2696
2701
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2697
- * @param {bool} [params.stop] *invalid for isolated margin* true if cancelling all stop orders
2702
+ * @param {bool} [params.trigger] *invalid for isolated margin* true if cancelling all stop orders
2698
2703
  * @param {string} [params.marginMode] 'cross' or 'isolated'
2699
2704
  * @param {string} [params.orderIds] *stop orders only* Comma seperated order IDs
2700
2705
  * @param {bool} [params.hf] false, // true for hf order
@@ -2703,7 +2708,7 @@ class kucoin extends kucoin$1 {
2703
2708
  async cancelAllOrders(symbol = undefined, params = {}) {
2704
2709
  await this.loadMarkets();
2705
2710
  const request = {};
2706
- const stop = this.safeBool(params, 'stop', false);
2711
+ const trigger = this.safeBool(params, 'stop', false);
2707
2712
  let hf = undefined;
2708
2713
  [hf, params] = this.handleHfAndParams(params);
2709
2714
  params = this.omit(params, 'stop');
@@ -2713,12 +2718,12 @@ class kucoin extends kucoin$1 {
2713
2718
  }
2714
2719
  if (marginMode !== undefined) {
2715
2720
  request['tradeType'] = this.options['marginModes'][marginMode];
2716
- if (marginMode === 'isolated' && stop) {
2721
+ if (marginMode === 'isolated' && trigger) {
2717
2722
  throw new errors.BadRequest(this.id + ' cancelAllOrders does not support isolated margin for stop orders');
2718
2723
  }
2719
2724
  }
2720
2725
  let response = undefined;
2721
- if (stop) {
2726
+ if (trigger) {
2722
2727
  response = await this.privateDeleteStopOrderCancel(this.extend(request, query));
2723
2728
  }
2724
2729
  else if (hf) {
@@ -2751,9 +2756,9 @@ class kucoin extends kucoin$1 {
2751
2756
  * @param {string} [params.side] buy or sell
2752
2757
  * @param {string} [params.type] limit, market, limit_stop or market_stop
2753
2758
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
2754
- * @param {int} [params.currentPage] *stop orders only* current page
2755
- * @param {string} [params.orderIds] *stop orders only* comma seperated order ID list
2756
- * @param {bool} [params.stop] True if fetching a stop order
2759
+ * @param {int} [params.currentPage] *trigger orders only* current page
2760
+ * @param {string} [params.orderIds] *trigger orders only* comma seperated order ID list
2761
+ * @param {bool} [params.trigger] True if fetching a trigger order
2757
2762
  * @param {bool} [params.hf] false, // true for hf order
2758
2763
  * @returns An [array of order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2759
2764
  */
@@ -2875,7 +2880,7 @@ class kucoin extends kucoin$1 {
2875
2880
  * @param {string} [params.side] buy or sell
2876
2881
  * @param {string} [params.type] limit, market, limit_stop or market_stop
2877
2882
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
2878
- * @param {bool} [params.stop] True if fetching a stop order
2883
+ * @param {bool} [params.trigger] True if fetching a trigger order
2879
2884
  * @param {bool} [params.hf] false, // true for hf order
2880
2885
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2881
2886
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2902,12 +2907,12 @@ class kucoin extends kucoin$1 {
2902
2907
  * @param {int} [limit] the maximum number of open orders structures to retrieve
2903
2908
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2904
2909
  * @param {int} [params.until] end time in ms
2905
- * @param {bool} [params.stop] true if fetching stop orders
2910
+ * @param {bool} [params.trigger] true if fetching trigger orders
2906
2911
  * @param {string} [params.side] buy or sell
2907
2912
  * @param {string} [params.type] limit, market, limit_stop or market_stop
2908
2913
  * @param {string} [params.tradeType] TRADE for spot trading, MARGIN_TRADE for Margin Trading
2909
- * @param {int} [params.currentPage] *stop orders only* current page
2910
- * @param {string} [params.orderIds] *stop orders only* comma seperated order ID list
2914
+ * @param {int} [params.currentPage] *trigger orders only* current page
2915
+ * @param {string} [params.orderIds] *trigger orders only* comma seperated order ID list
2911
2916
  * @param {bool} [params.hf] false, // true for hf order
2912
2917
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
2913
2918
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2932,9 +2937,9 @@ class kucoin extends kucoin$1 {
2932
2937
  * @see https://docs.kucoin.com/spot-hf/#details-of-a-single-hf-order
2933
2938
  * @see https://docs.kucoin.com/spot-hf/#obtain-details-of-a-single-hf-order-using-clientoid
2934
2939
  * @param {string} id Order id
2935
- * @param {string} symbol not sent to exchange except for stop orders with clientOid, but used internally by CCXT to filter
2940
+ * @param {string} symbol not sent to exchange except for trigger orders with clientOid, but used internally by CCXT to filter
2936
2941
  * @param {object} [params] exchange specific parameters
2937
- * @param {bool} [params.stop] true if fetching a stop order
2942
+ * @param {bool} [params.trigger] true if fetching a trigger order
2938
2943
  * @param {bool} [params.hf] false, // true for hf order
2939
2944
  * @param {bool} [params.clientOid] unique order id created by users to identify their orders
2940
2945
  * @returns An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2943,7 +2948,7 @@ class kucoin extends kucoin$1 {
2943
2948
  await this.loadMarkets();
2944
2949
  const request = {};
2945
2950
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2946
- const stop = this.safeBool2(params, 'stop', 'trigger', false);
2951
+ const trigger = this.safeBool2(params, 'stop', 'trigger', false);
2947
2952
  let hf = undefined;
2948
2953
  [hf, params] = this.handleHfAndParams(params);
2949
2954
  let market = undefined;
@@ -2960,7 +2965,7 @@ class kucoin extends kucoin$1 {
2960
2965
  let response = undefined;
2961
2966
  if (clientOrderId !== undefined) {
2962
2967
  request['clientOid'] = clientOrderId;
2963
- if (stop) {
2968
+ if (trigger) {
2964
2969
  if (symbol !== undefined) {
2965
2970
  request['symbol'] = market['id'];
2966
2971
  }
@@ -2981,7 +2986,7 @@ class kucoin extends kucoin$1 {
2981
2986
  throw new errors.InvalidOrder(this.id + ' fetchOrder() requires an order id');
2982
2987
  }
2983
2988
  request['orderId'] = id;
2984
- if (stop) {
2989
+ if (trigger) {
2985
2990
  response = await this.privateGetStopOrderOrderId(this.extend(request, params));
2986
2991
  }
2987
2992
  else if (hf) {
@@ -3124,7 +3129,7 @@ class kucoin extends kucoin$1 {
3124
3129
  const feeCurrencyId = this.safeString(order, 'feeCurrency');
3125
3130
  const cancelExist = this.safeBool(order, 'cancelExist', false);
3126
3131
  const responseStop = this.safeString(order, 'stop');
3127
- const stop = responseStop !== undefined;
3132
+ const trigger = responseStop !== undefined;
3128
3133
  const stopTriggered = this.safeBool(order, 'stopTriggered', false);
3129
3134
  const isActive = this.safeBool2(order, 'isActive', 'active');
3130
3135
  const responseStatus = this.safeString(order, 'status');
@@ -3137,7 +3142,7 @@ class kucoin extends kucoin$1 {
3137
3142
  status = 'closed';
3138
3143
  }
3139
3144
  }
3140
- if (stop) {
3145
+ if (trigger) {
3141
3146
  if (responseStatus === 'NEW') {
3142
3147
  status = 'open';
3143
3148
  }
@@ -4364,7 +4369,7 @@ class kucoin extends kucoin$1 {
4364
4369
  * @param {boolean} [params.hf] default false, when true will fetch ledger entries for the high frequency trading account
4365
4370
  * @param {int} [params.until] the latest time in ms to fetch entries for
4366
4371
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
4367
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
4372
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
4368
4373
  */
4369
4374
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
4370
4375
  await this.loadMarkets();
@@ -996,7 +996,7 @@ class luno extends luno$1 {
996
996
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
997
997
  * @param {int} [limit] max number of ledger entries to return, default is undefined
998
998
  * @param {object} [params] extra parameters specific to the exchange API endpoint
999
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
999
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
1000
1000
  */
1001
1001
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1002
1002
  await this.loadMarkets();
@@ -674,6 +674,143 @@ class mexc extends mexc$1 {
674
674
  'maxTimeTillEnd': 90 * 86400 * 1000 - 1,
675
675
  'broker': 'CCXT',
676
676
  },
677
+ 'features': {
678
+ 'default': {
679
+ 'sandbox': false,
680
+ 'createOrder': {
681
+ 'marginMode': true,
682
+ 'triggerPrice': false,
683
+ 'triggerDirection': false,
684
+ 'triggerPriceType': {
685
+ 'last': false,
686
+ 'mark': false,
687
+ 'index': false,
688
+ },
689
+ 'stopLossPrice': false,
690
+ 'takeProfitPrice': false,
691
+ 'attachedStopLossTakeProfit': undefined,
692
+ 'timeInForce': {
693
+ 'IOC': true,
694
+ 'FOK': true,
695
+ 'PO': true,
696
+ 'GTD': false,
697
+ },
698
+ 'hedged': false,
699
+ // exchange-supported features
700
+ 'selfTradePrevention': false,
701
+ 'trailing': false,
702
+ 'iceberg': false,
703
+ },
704
+ 'createOrders': {
705
+ 'max': 20,
706
+ },
707
+ 'fetchMyTrades': {
708
+ 'marginMode': false,
709
+ 'limit': 100,
710
+ 'daysBack': 30,
711
+ 'untilDays': undefined,
712
+ },
713
+ 'fetchOrder': {
714
+ 'marginMode': false,
715
+ 'trigger': false,
716
+ 'trailing': false,
717
+ },
718
+ 'fetchOpenOrders': {
719
+ 'marginMode': true,
720
+ 'limit': undefined,
721
+ 'trigger': false,
722
+ 'trailing': false,
723
+ },
724
+ 'fetchOrders': {
725
+ 'marginMode': true,
726
+ 'limit': 1000,
727
+ 'daysBack': 7,
728
+ 'untilDays': 7,
729
+ 'trigger': false,
730
+ 'trailing': false,
731
+ },
732
+ 'fetchClosedOrders': {
733
+ 'marginMode': true,
734
+ 'limit': 1000,
735
+ 'daysBackClosed': 7,
736
+ 'daysBackCanceled': 7,
737
+ 'untilDays': 7,
738
+ 'trigger': false,
739
+ 'trailing': false,
740
+ },
741
+ 'fetchOHLCV': {
742
+ 'limit': 1000,
743
+ },
744
+ },
745
+ 'spot': {
746
+ 'extends': 'default',
747
+ },
748
+ 'forDerivs': {
749
+ 'extends': 'default',
750
+ 'createOrder': {
751
+ 'triggerPrice': true,
752
+ 'triggerPriceType': {
753
+ 'last': true,
754
+ 'mark': true,
755
+ 'index': true,
756
+ },
757
+ 'triggerDirection': true,
758
+ 'stopLossPrice': false,
759
+ 'takeProfitPrice': false,
760
+ 'hedged': true,
761
+ },
762
+ 'createOrders': {
763
+ 'max': 50,
764
+ },
765
+ 'fetchMyTrades': {
766
+ 'marginMode': false,
767
+ 'limit': 100,
768
+ 'daysBack': 90,
769
+ 'untilDays': 90,
770
+ },
771
+ 'fetchOrder': {
772
+ 'marginMode': false,
773
+ },
774
+ 'fetchOpenOrders': {
775
+ 'marginMode': false,
776
+ 'limit': 100,
777
+ 'trigger': true,
778
+ 'trailing': false,
779
+ },
780
+ 'fetchOrders': {
781
+ 'marginMode': false,
782
+ 'limit': 100,
783
+ 'daysBack': 90,
784
+ 'untilDays': 90,
785
+ 'trigger': true,
786
+ 'trailing': false,
787
+ },
788
+ 'fetchClosedOrders': {
789
+ 'marginMode': false,
790
+ 'limit': 100,
791
+ 'daysBackClosed': 90,
792
+ 'daysBackCanceled': undefined,
793
+ 'untilDays': 90,
794
+ 'trigger': true,
795
+ 'trailing': false,
796
+ },
797
+ 'fetchOHLCV': {
798
+ 'limit': 2000,
799
+ },
800
+ },
801
+ 'swap': {
802
+ 'linear': {
803
+ 'extends': 'forDerivs',
804
+ },
805
+ 'inverse': {
806
+ 'extends': 'forDerivs',
807
+ },
808
+ },
809
+ 'future': {
810
+ 'linear': undefined,
811
+ 'inverse': undefined,
812
+ },
813
+ },
677
814
  'commonCurrencies': {
678
815
  'BEYONDPROTOCOL': 'BEYOND',
679
816
  'BIFI': 'BIFIF',
@@ -2235,7 +2372,6 @@ class mexc extends mexc$1 {
2235
2372
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2236
2373
  * @param {string} [marginMode] only 'isolated' is supported for spot-margin trading
2237
2374
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2238
- * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
2239
2375
  * @param {bool} [params.postOnly] if true, the order will only be posted if it will be a maker order
2240
2376
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2241
2377
  */
@@ -2284,7 +2420,7 @@ class mexc extends mexc$1 {
2284
2420
  /**
2285
2421
  * @ignore
2286
2422
  * @method
2287
- * @name mexc#createOrder
2423
+ * @name mexc#createSwapOrder
2288
2424
  * @description create a trade order
2289
2425
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2290
2426
  * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
@@ -1218,7 +1218,7 @@ class ndax extends ndax$1 {
1218
1218
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1219
1219
  * @param {int} [limit] max number of ledger entries to return, default is undefined
1220
1220
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1221
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1221
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
1222
1222
  */
1223
1223
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1224
1224
  const omsId = this.safeInteger(this.options, 'omsId', 1);