ccxt 4.2.76 → 4.2.78

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 (74) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1181 -643
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +6 -0
  6. package/dist/cjs/src/binance.js +502 -443
  7. package/dist/cjs/src/bingx.js +1 -1
  8. package/dist/cjs/src/blofin.js +14 -2
  9. package/dist/cjs/src/bybit.js +106 -60
  10. package/dist/cjs/src/coinbase.js +23 -10
  11. package/dist/cjs/src/delta.js +66 -49
  12. package/dist/cjs/src/gate.js +1 -0
  13. package/dist/cjs/src/htx.js +36 -27
  14. package/dist/cjs/src/hyperliquid.js +7 -5
  15. package/dist/cjs/src/kraken.js +8 -8
  16. package/dist/cjs/src/kucoin.js +204 -5
  17. package/dist/cjs/src/okcoin.js +27 -1
  18. package/dist/cjs/src/okx.js +18 -0
  19. package/dist/cjs/src/pro/ascendex.js +1 -1
  20. package/dist/cjs/src/pro/bitvavo.js +1 -1
  21. package/dist/cjs/src/pro/coinex.js +20 -14
  22. package/dist/cjs/src/pro/deribit.js +1 -1
  23. package/dist/cjs/src/pro/exmo.js +1 -1
  24. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  25. package/dist/cjs/src/pro/phemex.js +1 -1
  26. package/dist/cjs/src/pro/poloniex.js +1 -1
  27. package/dist/cjs/src/pro/probit.js +1 -1
  28. package/dist/cjs/src/pro/woo.js +61 -6
  29. package/dist/cjs/src/woo.js +72 -3
  30. package/js/ccxt.d.ts +1 -1
  31. package/js/ccxt.js +1 -1
  32. package/js/src/abstract/kucoin.d.ts +1 -0
  33. package/js/src/abstract/kucoinfutures.d.ts +1 -0
  34. package/js/src/base/Exchange.d.ts +3 -3
  35. package/js/src/base/Exchange.js +6 -0
  36. package/js/src/base/types.d.ts +3 -3
  37. package/js/src/binance.d.ts +2 -2
  38. package/js/src/binance.js +502 -443
  39. package/js/src/bingx.js +1 -1
  40. package/js/src/bitflyer.d.ts +2 -2
  41. package/js/src/bithumb.d.ts +2 -2
  42. package/js/src/blofin.js +14 -2
  43. package/js/src/bybit.d.ts +1 -1
  44. package/js/src/bybit.js +106 -60
  45. package/js/src/coinbase.d.ts +2 -2
  46. package/js/src/coinbase.js +23 -10
  47. package/js/src/delta.d.ts +2 -1
  48. package/js/src/delta.js +66 -49
  49. package/js/src/deribit.d.ts +1 -1
  50. package/js/src/gate.d.ts +1 -1
  51. package/js/src/gate.js +1 -0
  52. package/js/src/htx.js +36 -27
  53. package/js/src/hyperliquid.js +7 -5
  54. package/js/src/kraken.js +8 -8
  55. package/js/src/kucoin.d.ts +4 -1
  56. package/js/src/kucoin.js +204 -5
  57. package/js/src/okcoin.js +27 -1
  58. package/js/src/okx.d.ts +1 -1
  59. package/js/src/okx.js +18 -0
  60. package/js/src/pro/ascendex.js +1 -1
  61. package/js/src/pro/bitvavo.js +1 -1
  62. package/js/src/pro/coinex.js +20 -14
  63. package/js/src/pro/deribit.js +1 -1
  64. package/js/src/pro/exmo.js +1 -1
  65. package/js/src/pro/krakenfutures.js +1 -1
  66. package/js/src/pro/phemex.js +1 -1
  67. package/js/src/pro/poloniex.js +1 -1
  68. package/js/src/pro/probit.js +1 -1
  69. package/js/src/pro/woo.d.ts +1 -0
  70. package/js/src/pro/woo.js +61 -6
  71. package/js/src/woo.d.ts +2 -0
  72. package/js/src/woo.js +72 -3
  73. package/package.json +1 -1
  74. package/skip-tests.json +6 -3
package/js/src/pro/woo.js CHANGED
@@ -58,6 +58,13 @@ export default class woo extends wooRest {
58
58
  'ping': this.ping,
59
59
  'keepAlive': 10000,
60
60
  },
61
+ 'exceptions': {
62
+ 'ws': {
63
+ 'exact': {
64
+ 'Auth is needed.': AuthenticationError,
65
+ },
66
+ },
67
+ },
61
68
  });
62
69
  }
63
70
  requestId(url) {
@@ -419,8 +426,9 @@ export default class woo extends wooRest {
419
426
  const client = this.client(url);
420
427
  const messageHash = 'authenticated';
421
428
  const event = 'auth';
422
- let future = this.safeValue(client.subscriptions, messageHash);
423
- if (future === undefined) {
429
+ const future = client.future(messageHash);
430
+ const authenticated = this.safeValue(client.subscriptions, messageHash);
431
+ if (authenticated === undefined) {
424
432
  const ts = this.nonce().toString();
425
433
  const auth = '|' + ts;
426
434
  const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256);
@@ -433,10 +441,9 @@ export default class woo extends wooRest {
433
441
  },
434
442
  };
435
443
  const message = this.extend(request, params);
436
- future = this.watch(url, messageHash, message);
437
- client.subscriptions[messageHash] = future;
444
+ this.watch(url, messageHash, message, messageHash);
438
445
  }
439
- return future;
446
+ return await future;
440
447
  }
441
448
  async watchPrivate(messageHash, message, params = {}) {
442
449
  await this.authenticate(params);
@@ -449,6 +456,16 @@ export default class woo extends wooRest {
449
456
  return await this.watch(url, messageHash, request, messageHash, subscribe);
450
457
  }
451
458
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
459
+ /**
460
+ * @method
461
+ * @name woo#watchOrders
462
+ * @description watches information on multiple orders made by the user
463
+ * @param {string} symbol unified market symbol of the market orders were made in
464
+ * @param {int} [since] the earliest time in ms to fetch orders for
465
+ * @param {int} [limit] the maximum number of order structures to retrieve
466
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
467
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
468
+ */
452
469
  await this.loadMarkets();
453
470
  const topic = 'executionreport';
454
471
  let messageHash = topic;
@@ -801,7 +818,43 @@ export default class woo extends wooRest {
801
818
  this.balance = this.safeBalance(this.balance);
802
819
  client.resolve(this.balance, 'balance');
803
820
  }
821
+ handleErrorMessage(client, message) {
822
+ //
823
+ // {"id":"1","event":"subscribe","success":false,"ts":1710780997216,"errorMsg":"Auth is needed."}
824
+ //
825
+ if (!('success' in message)) {
826
+ return false;
827
+ }
828
+ const success = this.safeBool(message, 'success');
829
+ if (success) {
830
+ return false;
831
+ }
832
+ const errorMessage = this.safeString(message, 'errorMsg');
833
+ try {
834
+ if (errorMessage !== undefined) {
835
+ const feedback = this.id + ' ' + this.json(message);
836
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorMessage, feedback);
837
+ }
838
+ return false;
839
+ }
840
+ catch (error) {
841
+ if (error instanceof AuthenticationError) {
842
+ const messageHash = 'authenticated';
843
+ client.reject(error, messageHash);
844
+ if (messageHash in client.subscriptions) {
845
+ delete client.subscriptions[messageHash];
846
+ }
847
+ }
848
+ else {
849
+ client.reject(error);
850
+ }
851
+ return true;
852
+ }
853
+ }
804
854
  handleMessage(client, message) {
855
+ if (this.handleErrorMessage(client, message)) {
856
+ return;
857
+ }
805
858
  const methods = {
806
859
  'ping': this.handlePing,
807
860
  'pong': this.handlePong,
@@ -884,7 +937,9 @@ export default class woo extends wooRest {
884
937
  const messageHash = 'authenticated';
885
938
  const success = this.safeValue(message, 'success');
886
939
  if (success) {
887
- client.resolve(message, messageHash);
940
+ // client.resolve (message, messageHash);
941
+ const future = this.safeValue(client.futures, 'authenticated');
942
+ future.resolve(true);
888
943
  }
889
944
  else {
890
945
  const error = new AuthenticationError(this.json(message));
package/js/src/woo.d.ts CHANGED
@@ -30,6 +30,8 @@ export default class woo extends Exchange {
30
30
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
31
31
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
32
32
  fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
33
+ fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
34
+ fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
33
35
  parseTimeInForce(timeInForce: any): string;
34
36
  parseOrder(order: any, market?: Market): Order;
35
37
  parseOrderStatus(status: any): any;
package/js/src/woo.js CHANGED
@@ -59,7 +59,7 @@ export default class woo extends Exchange {
59
59
  'fetchBalance': true,
60
60
  'fetchCanceledOrders': false,
61
61
  'fetchClosedOrder': false,
62
- 'fetchClosedOrders': false,
62
+ 'fetchClosedOrders': true,
63
63
  'fetchCurrencies': true,
64
64
  'fetchDepositAddress': true,
65
65
  'fetchDeposits': true,
@@ -78,7 +78,7 @@ export default class woo extends Exchange {
78
78
  'fetchOHLCV': true,
79
79
  'fetchOpenInterestHistory': false,
80
80
  'fetchOpenOrder': false,
81
- 'fetchOpenOrders': false,
81
+ 'fetchOpenOrders': true,
82
82
  'fetchOrder': true,
83
83
  'fetchOrderBook': true,
84
84
  'fetchOrders': true,
@@ -1370,9 +1370,15 @@ export default class woo extends Exchange {
1370
1370
  * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1371
1371
  * @param {string} [params.side] 'buy' or 'sell'
1372
1372
  * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1373
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1373
1374
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1374
1375
  */
1375
1376
  await this.loadMarkets();
1377
+ let paginate = false;
1378
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
1379
+ if (paginate) {
1380
+ return await this.fetchPaginatedCallIncremental('fetchOrders', symbol, since, limit, params, 'page', 500);
1381
+ }
1376
1382
  const request = {};
1377
1383
  let market = undefined;
1378
1384
  const stop = this.safeBool2(params, 'stop', 'trigger');
@@ -1390,6 +1396,12 @@ export default class woo extends Exchange {
1390
1396
  request['start_t'] = since;
1391
1397
  }
1392
1398
  }
1399
+ if (limit !== undefined) {
1400
+ request['size'] = limit;
1401
+ }
1402
+ else {
1403
+ request['size'] = 500;
1404
+ }
1393
1405
  if (stop) {
1394
1406
  request['algoType'] = 'stop';
1395
1407
  }
@@ -1436,7 +1448,51 @@ export default class woo extends Exchange {
1436
1448
  //
1437
1449
  const data = this.safeValue(response, 'data', response);
1438
1450
  const orders = this.safeList(data, 'rows');
1439
- return this.parseOrders(orders, market, since, limit, params);
1451
+ return this.parseOrders(orders, market, since, limit);
1452
+ }
1453
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1454
+ /**
1455
+ * @method
1456
+ * @name woo#fetchOpenOrders
1457
+ * @description fetches information on multiple orders made by the user
1458
+ * @see https://docs.woo.org/#get-orders
1459
+ * @see https://docs.woo.org/#get-algo-orders
1460
+ * @param {string} symbol unified market symbol of the market orders were made in
1461
+ * @param {int} [since] the earliest time in ms to fetch orders for
1462
+ * @param {int} [limit] the maximum number of order structures to retrieve
1463
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1464
+ * @param {boolean} [params.stop] whether the order is a stop/algo order
1465
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1466
+ * @param {string} [params.side] 'buy' or 'sell'
1467
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1468
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1469
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1470
+ */
1471
+ await this.loadMarkets();
1472
+ const extendedParams = this.extend(params, { 'status': 'INCOMPLETE' });
1473
+ return await this.fetchOrders(symbol, since, limit, extendedParams);
1474
+ }
1475
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1476
+ /**
1477
+ * @method
1478
+ * @name woo#fetchClosedOrders
1479
+ * @description fetches information on multiple orders made by the user
1480
+ * @see https://docs.woo.org/#get-orders
1481
+ * @see https://docs.woo.org/#get-algo-orders
1482
+ * @param {string} symbol unified market symbol of the market orders were made in
1483
+ * @param {int} [since] the earliest time in ms to fetch orders for
1484
+ * @param {int} [limit] the maximum number of order structures to retrieve
1485
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1486
+ * @param {boolean} [params.stop] whether the order is a stop/algo order
1487
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1488
+ * @param {string} [params.side] 'buy' or 'sell'
1489
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1490
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1491
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1492
+ */
1493
+ await this.loadMarkets();
1494
+ const extendedParams = this.extend(params, { 'status': 'COMPLETED' });
1495
+ return await this.fetchOrders(symbol, since, limit, extendedParams);
1440
1496
  }
1441
1497
  parseTimeInForce(timeInForce) {
1442
1498
  const timeInForces = {
@@ -1755,14 +1811,21 @@ export default class woo extends Exchange {
1755
1811
  /**
1756
1812
  * @method
1757
1813
  * @name woo#fetchMyTrades
1814
+ * @see https://docs.woo.org/#get-trades
1758
1815
  * @description fetch all trades made by the user
1759
1816
  * @param {string} symbol unified market symbol
1760
1817
  * @param {int} [since] the earliest time in ms to fetch trades for
1761
1818
  * @param {int} [limit] the maximum number of trades structures to retrieve
1762
1819
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1820
+ * @param {boolean} [params.paginate] set to true if you want to fetch trades with pagination
1763
1821
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1764
1822
  */
1765
1823
  await this.loadMarkets();
1824
+ let paginate = false;
1825
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
1826
+ if (paginate) {
1827
+ return await this.fetchPaginatedCallIncremental('fetchMyTrades', symbol, since, limit, params, 'page', 500);
1828
+ }
1766
1829
  const request = {};
1767
1830
  let market = undefined;
1768
1831
  if (symbol !== undefined) {
@@ -1772,6 +1835,12 @@ export default class woo extends Exchange {
1772
1835
  if (since !== undefined) {
1773
1836
  request['start_t'] = since;
1774
1837
  }
1838
+ if (limit !== undefined) {
1839
+ request['size'] = limit;
1840
+ }
1841
+ else {
1842
+ request['size'] = 500;
1843
+ }
1775
1844
  const response = await this.v1PrivateGetClientTrades(this.extend(request, params));
1776
1845
  // {
1777
1846
  // "success": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.76",
3
+ "version": "4.2.78",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
package/skip-tests.json CHANGED
@@ -719,8 +719,7 @@
719
719
  }
720
720
  },
721
721
  "delta": {
722
- "skip": "frequent timeouts https://app.travis-ci.com/github/ccxt/ccxt/builds/269273148#L4301",
723
- "until": "2024-03-19",
722
+ "skipCSharp": "frequent timeouts https://app.travis-ci.com/github/ccxt/ccxt/builds/269273148#L4301 https://app.travis-ci.com/github/ccxt/ccxt/builds/269533613#L3622",
724
723
  "skipMethods": {
725
724
  "loadMarkets": "expiryDatetime must be equal to expiry in iso8601 format",
726
725
  "orderBook": {
@@ -729,6 +728,9 @@
729
728
  "ticker": {
730
729
  "baseVolume": "quoteVolume >= baseVolume * low is failing",
731
730
  "bid": "failing the test"
731
+ },
732
+ "fetchOHLCV": {
733
+ "4":"https://app.travis-ci.com/github/ccxt/ccxt/builds/269542746#L3512"
732
734
  }
733
735
  }
734
736
  },
@@ -1398,7 +1400,8 @@
1398
1400
  "side": "undefined"
1399
1401
  },
1400
1402
  "ticker": {
1401
- "baseVolume": "not supported"
1403
+ "baseVolume": "not supported",
1404
+ "spread": "same bid-ask https://app.travis-ci.com/github/ccxt/ccxt/builds/269550508#L3581"
1402
1405
  },
1403
1406
  "fetchOHLCV": "spot not supported",
1404
1407
  "fetchCurrencies": {