ccxt 4.3.88 → 4.3.89

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 (85) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ace.js +1 -0
  5. package/dist/cjs/src/alpaca.js +1 -0
  6. package/dist/cjs/src/ascendex.js +7 -19
  7. package/dist/cjs/src/bigone.js +1 -0
  8. package/dist/cjs/src/bingx.js +1 -0
  9. package/dist/cjs/src/bit2c.js +1 -0
  10. package/dist/cjs/src/bitbank.js +1 -0
  11. package/dist/cjs/src/bitfinex.js +1 -0
  12. package/dist/cjs/src/bitflyer.js +1 -0
  13. package/dist/cjs/src/bitget.js +1 -0
  14. package/dist/cjs/src/bitmex.js +1 -0
  15. package/dist/cjs/src/bitopro.js +1 -0
  16. package/dist/cjs/src/bitrue.js +62 -71
  17. package/dist/cjs/src/bitso.js +1 -0
  18. package/dist/cjs/src/bitstamp.js +1 -0
  19. package/dist/cjs/src/bitvavo.js +1 -0
  20. package/dist/cjs/src/blockchaincom.js +1 -0
  21. package/dist/cjs/src/btcalpha.js +1 -0
  22. package/dist/cjs/src/btcbox.js +1 -0
  23. package/dist/cjs/src/btcmarkets.js +1 -0
  24. package/dist/cjs/src/bybit.js +2 -0
  25. package/dist/cjs/src/cex.js +1 -0
  26. package/dist/cjs/src/coinbaseexchange.js +1 -0
  27. package/dist/cjs/src/cryptocom.js +0 -12
  28. package/dist/cjs/src/kraken.js +48 -48
  29. package/dist/cjs/src/mexc.js +1 -61
  30. package/dist/cjs/src/okcoin.js +4 -9
  31. package/dist/cjs/src/onetrading.js +1 -0
  32. package/dist/cjs/src/phemex.js +1 -0
  33. package/dist/cjs/src/poloniexfutures.js +1 -0
  34. package/dist/cjs/src/pro/bitvavo.js +1 -0
  35. package/dist/cjs/src/pro/bybit.js +290 -1
  36. package/dist/cjs/src/pro/cex.js +1 -0
  37. package/dist/cjs/src/probit.js +1 -0
  38. package/dist/cjs/src/vertex.js +1 -0
  39. package/dist/cjs/src/woo.js +1 -0
  40. package/dist/cjs/src/woofipro.js +1 -0
  41. package/js/ccxt.d.ts +1 -1
  42. package/js/ccxt.js +1 -1
  43. package/js/src/ace.js +1 -0
  44. package/js/src/alpaca.js +1 -0
  45. package/js/src/ascendex.d.ts +0 -1
  46. package/js/src/ascendex.js +7 -19
  47. package/js/src/bigone.js +1 -0
  48. package/js/src/bingx.js +1 -0
  49. package/js/src/bit2c.js +1 -0
  50. package/js/src/bitbank.js +1 -0
  51. package/js/src/bitfinex.js +1 -0
  52. package/js/src/bitflyer.js +1 -0
  53. package/js/src/bitget.js +1 -0
  54. package/js/src/bitmex.js +1 -0
  55. package/js/src/bitopro.js +1 -0
  56. package/js/src/bitrue.d.ts +0 -1
  57. package/js/src/bitrue.js +62 -71
  58. package/js/src/bitso.js +1 -0
  59. package/js/src/bitstamp.js +1 -0
  60. package/js/src/bitvavo.js +1 -0
  61. package/js/src/blockchaincom.js +1 -0
  62. package/js/src/btcalpha.js +1 -0
  63. package/js/src/btcbox.js +1 -0
  64. package/js/src/btcmarkets.js +1 -0
  65. package/js/src/bybit.js +2 -0
  66. package/js/src/cex.js +1 -0
  67. package/js/src/coinbaseexchange.js +1 -0
  68. package/js/src/cryptocom.d.ts +0 -1
  69. package/js/src/cryptocom.js +0 -12
  70. package/js/src/kraken.js +48 -48
  71. package/js/src/mexc.js +1 -61
  72. package/js/src/okcoin.d.ts +0 -1
  73. package/js/src/okcoin.js +4 -9
  74. package/js/src/onetrading.js +1 -0
  75. package/js/src/phemex.js +1 -0
  76. package/js/src/poloniexfutures.js +1 -0
  77. package/js/src/pro/bitvavo.js +1 -0
  78. package/js/src/pro/bybit.d.ts +12 -1
  79. package/js/src/pro/bybit.js +291 -2
  80. package/js/src/pro/cex.js +1 -0
  81. package/js/src/probit.js +1 -0
  82. package/js/src/vertex.js +1 -0
  83. package/js/src/woo.js +1 -0
  84. package/js/src/woofipro.js +1 -0
  85. package/package.json +1 -1
@@ -563,7 +563,7 @@ class mexc extends mexc$1 {
563
563
  'POKT': 'POKT',
564
564
  'QKC': 'QKC',
565
565
  'QTUM': 'QTUM',
566
- 'RAP20': 'RAP20 (Rangers Mainnet)',
566
+ 'RAP20': 'RAP20' + ' ' + '(Rangers Mainnet)',
567
567
  'REI': 'REI',
568
568
  'RSK': 'RBTC',
569
569
  'RVN': 'Ravencoin(RVN)',
@@ -713,69 +713,9 @@ class mexc extends mexc$1 {
713
713
  // OKB <> OKT (for usdt it's exception) for OKC, PMEER, FLARE, STRD, ZEL, FUND, "NONE", CRING, FREETON, QTZ (probably unique network is meant), HT, BSC(RACAV1), BSC(RACAV2), AMBROSUS, BAJUN, NOM. their individual info is at https://www.mexc.com/api/platform/asset/spot/{COINNAME}
714
714
  },
715
715
  'networksById': {
716
- 'Aleph Zero(AZERO)': 'AZERO',
717
- 'Alephium(ALPH)': 'ALPH',
718
- 'Algorand(ALGO)': 'ALGO',
719
- 'APTOS(APT)': 'APT',
720
- 'Arbitrum One(ARB)': 'ARB',
721
- 'Avalanche C Chain(AVAX CCHAIN)': 'AVAXC',
722
- 'Avalanche X Chain(AVAX XCHAIN)': 'AVAXX',
723
- 'BEP20(BSC)': 'BSC',
724
- 'Bitcoin Cash(BCH)': 'BCH',
725
- 'Bitcoin SV(BSV)': 'BSV',
726
- 'Bitcoin(BTC)': 'BTC',
727
- 'Bittensor(TAO)': 'TAO',
728
- 'BNB Beacon Chain(BEP2)': 'BEP2',
729
716
  'BNB Smart Chain(BEP20-RACAV1)': 'BSC',
730
717
  'BNB Smart Chain(BEP20-RACAV2)': 'BSC',
731
718
  'BNB Smart Chain(BEP20)': 'BSC',
732
- 'Cardano(ADA)': 'ADA',
733
- 'Celestia(TIA)': 'TIA',
734
- 'Chia(XCH)': 'XCH',
735
- 'Chiliz Chain(CHZ2)': 'CHZ2',
736
- 'Chiliz Legacy Chain(CHZ)': 'CHZ',
737
- 'Clore.ai(CLORE)': 'CLORE',
738
- 'Cosmos(ATOM)': 'ATOM',
739
- 'Dogechain(DC)': 'DC',
740
- 'Dogecoin(DOGE)': 'DOGE',
741
- 'Dymension(DYM)': 'DYM',
742
- 'Dynex(DNX)': 'DNX',
743
- 'Elysium(LAVA)': 'LAVA',
744
- 'Ethereum Classic(ETC)': 'ETC',
745
- 'Ethereum(ERC20)': 'ERC20',
746
- 'Fantom(FTM)': 'FTM',
747
- 'Hedera(HBAR)': 'HBAR',
748
- 'Index Chain': 'INDEX',
749
- 'Internet Computer(ICP)': 'ICP',
750
- 'Kaspa(KAS)': 'KAS',
751
- 'Klaytn(KLAY)': 'KLAY',
752
- 'Litecoin(LTC)': 'LTC',
753
- 'Mantle(MNT)': 'MNT',
754
- 'Mcoin Network': 'MCOIN',
755
- 'Meter(MTRG)': 'MTRG',
756
- 'Monero(XMR)': 'XMR',
757
- 'NEAR Protocol(NEAR)': 'NEAR',
758
- 'Neoxa Network': 'NEOXA',
759
- 'Neurai(XNA)': 'XNA',
760
- 'Omega Network(OMN)': 'OMN',
761
- 'Optimism(OP)': 'OPTIMISM',
762
- 'Polkadot(DOT)': 'DOT',
763
- 'Polygon(MATIC)': 'MATIC',
764
- 'RAP20 (Rangers Mainnet)': 'RAP20',
765
- 'Ravencoin(RVN)': 'RVN',
766
- 'Ripple(XRP)': 'XRP',
767
- 'Satoxcoin(SATOX)': 'SATOX',
768
- 'Solana(SOL)': 'SOL',
769
- 'Starknet(STARK)': 'STARK',
770
- 'Stellar(XLM)': 'XLM',
771
- 'Terra(LUNA)': 'LUNA',
772
- 'Toncoin(TON)': 'TON',
773
- 'Tron(TRC20)': 'TRC20',
774
- 'UGAS(Ultrain)': 'UGAS',
775
- 'VeChain(VET)': 'VET',
776
- 'Vexanium(VEX)': 'VEX',
777
- 'XPR Network': 'XPR',
778
- 'Zilliqa(ZIL)': 'ZIL',
779
719
  // TODO: uncomment below after deciding unified name
780
720
  // 'PEPE COIN BSC':
781
721
  // 'SMART BLOCKCHAIN':
@@ -577,6 +577,9 @@ class okcoin extends okcoin$1 {
577
577
  'defaultNetwork': 'ERC20',
578
578
  'networks': {
579
579
  'ERC20': 'Ethereum',
580
+ 'BTC': 'Bitcoin',
581
+ 'OMNI': 'Omni',
582
+ 'TRC20': 'TRON',
580
583
  },
581
584
  },
582
585
  'commonCurrencies': {
@@ -709,14 +712,6 @@ class okcoin extends okcoin$1 {
709
712
  'info': market,
710
713
  });
711
714
  }
712
- safeNetwork(networkId) {
713
- const networksById = {
714
- 'Bitcoin': 'BTC',
715
- 'Omni': 'OMNI',
716
- 'TRON': 'TRC20',
717
- };
718
- return this.safeString(networksById, networkId, networkId);
719
- }
720
715
  async fetchCurrencies(params = {}) {
721
716
  /**
722
717
  * @method
@@ -760,7 +755,7 @@ class okcoin extends okcoin$1 {
760
755
  if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
761
756
  const parts = networkId.split('-');
762
757
  const chainPart = this.safeString(parts, 1, networkId);
763
- const networkCode = this.safeNetwork(chainPart);
758
+ const networkCode = this.networkIdToCode(chainPart);
764
759
  const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
765
760
  if (maxPrecision === undefined) {
766
761
  maxPrecision = precision;
@@ -1641,6 +1641,7 @@ class onetrading extends onetrading$1 {
1641
1641
  * @method
1642
1642
  * @name onetrading#fetchOrder
1643
1643
  * @description fetches information on an order made by the user
1644
+ * @param {string} id the order id
1644
1645
  * @param {string} symbol not used by onetrading fetchOrder
1645
1646
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1646
1647
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2983,6 +2983,7 @@ class phemex extends phemex$1 {
2983
2983
  * @name phemex#fetchOrder
2984
2984
  * @see https://phemex-docs.github.io/#query-orders-by-ids
2985
2985
  * @description fetches information on an order made by the user
2986
+ * @param {string} id the order id
2986
2987
  * @param {string} symbol unified symbol of the market the order was made in
2987
2988
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2988
2989
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1415,6 +1415,7 @@ class poloniexfutures extends poloniexfutures$1 {
1415
1415
  * @description fetches information on an order made by the user
1416
1416
  * @see https://api-docs.poloniex.com/futures/api/orders#get-details-of-a-single-order
1417
1417
  * @see https://api-docs.poloniex.com/futures/api/orders#get-single-order-by-clientoid
1418
+ * @param {string} id the order id
1418
1419
  * @param {string} symbol unified symbol of the market the order was made in
1419
1420
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1420
1421
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -639,6 +639,7 @@ class bitvavo extends bitvavo$1 {
639
639
  * @name bitvavo#fetchOrderWs
640
640
  * @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
641
641
  * @description fetches information on an order made by the user
642
+ * @param {string} id the order id
642
643
  * @param {string} symbol unified symbol of the market the order was made in
643
644
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
644
645
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -390,6 +390,49 @@ class bybit extends bybit$1 {
390
390
  }
391
391
  return this.filterByArray(this.tickers, 'symbol', symbols);
392
392
  }
393
+ async unWatchTickers(symbols = undefined, params = {}) {
394
+ /**
395
+ * @method
396
+ * @name bybit#unWatchTickers
397
+ * @description unWatches a price ticker
398
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
399
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
400
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
401
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
402
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
403
+ */
404
+ await this.loadMarkets();
405
+ symbols = this.marketSymbols(symbols, undefined, false);
406
+ const options = this.safeValue(this.options, 'watchTickers', {});
407
+ const topic = this.safeString(options, 'name', 'tickers');
408
+ const messageHashes = [];
409
+ const subMessageHashes = [];
410
+ const marketIds = this.marketIds(symbols);
411
+ const topics = [];
412
+ for (let i = 0; i < marketIds.length; i++) {
413
+ const marketId = marketIds[i];
414
+ const symbol = symbols[i];
415
+ topics.push(topic + '.' + marketId);
416
+ subMessageHashes.push('ticker:' + symbol);
417
+ messageHashes.push('unsubscribe:ticker:' + symbol);
418
+ }
419
+ const url = await this.getUrlByMarketType(symbols[0], false, 'watchTickers', params);
420
+ return await this.unWatchTopics(url, 'ticker', symbols, messageHashes, subMessageHashes, topics, params);
421
+ }
422
+ async unWatchTicker(symbols, params = {}) {
423
+ /**
424
+ * @method
425
+ * @name bybit#unWatchTicker
426
+ * @description unWatches a price ticker
427
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
428
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
429
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
430
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
431
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
432
+ */
433
+ await this.loadMarkets();
434
+ return await this.unWatchTickers([symbols], params);
435
+ }
393
436
  handleTicker(client, message) {
394
437
  //
395
438
  // linear
@@ -723,6 +766,56 @@ class bybit extends bybit$1 {
723
766
  const orderbook = await this.watchTopics(url, messageHashes, topics, params);
724
767
  return orderbook.limit();
725
768
  }
769
+ async unWatchOrderBookForSymbols(symbols, params = {}) {
770
+ /**
771
+ * @method
772
+ * @name bybit#unWatchOrderBookForSymbols
773
+ * @description unsubscribe from the orderbook channel
774
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook
775
+ * @param {string[]} symbols unified symbol of the market to unwatch the trades for
776
+ * @param {int} [params.limit] orderbook limit, default is undefined
777
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
778
+ */
779
+ await this.loadMarkets();
780
+ symbols = this.marketSymbols(symbols, undefined, false);
781
+ let channel = 'orderbook.';
782
+ let limit = this.safeInteger(params, 'limit');
783
+ if (limit !== undefined) {
784
+ params = this.omit(params, 'limit');
785
+ }
786
+ else {
787
+ const firstMarket = this.market(symbols[0]);
788
+ limit = firstMarket['spot'] ? 50 : 500;
789
+ }
790
+ channel += limit.toString();
791
+ const subMessageHashes = [];
792
+ const messageHashes = [];
793
+ const topics = [];
794
+ for (let i = 0; i < symbols.length; i++) {
795
+ const symbol = symbols[i];
796
+ const market = this.market(symbol);
797
+ const marketId = market['id'];
798
+ const topic = channel + '.' + marketId;
799
+ messageHashes.push('unsubscribe:orderbook:' + symbol);
800
+ subMessageHashes.push('orderbook:' + symbol);
801
+ topics.push(topic);
802
+ }
803
+ const url = await this.getUrlByMarketType(symbols[0], false, 'watchOrderBook', params);
804
+ return await this.unWatchTopics(url, 'orderbook', symbols, messageHashes, subMessageHashes, topics, params);
805
+ }
806
+ async unWatchOrderBook(symbol, params = {}) {
807
+ /**
808
+ * @method
809
+ * @name bybit#unWatchOrderBook
810
+ * @description unsubscribe from the orderbook channel
811
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook
812
+ * @param {string[]} symbols unified symbol of the market to unwatch the trades for
813
+ * @param {int} [params.limit] orderbook limit, default is undefined
814
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
815
+ */
816
+ await this.loadMarkets();
817
+ return await this.unWatchOrderBookForSymbols([symbol], params);
818
+ }
726
819
  handleOrderBook(client, message) {
727
820
  //
728
821
  // {
@@ -847,6 +940,44 @@ class bybit extends bybit$1 {
847
940
  }
848
941
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
849
942
  }
943
+ async unWatchTradesForSymbols(symbols, params = {}) {
944
+ /**
945
+ * @method
946
+ * @name bybit#unWatchTradesForSymbols
947
+ * @description unsubscribe from the trades channel
948
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/trade
949
+ * @param {string[]} symbols unified symbol of the market to unwatch the trades for
950
+ * @returns {any} status of the unwatch request
951
+ */
952
+ await this.loadMarkets();
953
+ symbols = this.marketSymbols(symbols, undefined, false, true);
954
+ const url = await this.getUrlByMarketType(symbols[0], false, 'unWatchTradesForSymbols', params);
955
+ const messageHashes = [];
956
+ const topics = [];
957
+ const subMessageHashes = [];
958
+ for (let i = 0; i < symbols.length; i++) {
959
+ const symbol = symbols[i];
960
+ const market = this.market(symbol);
961
+ const topic = 'publicTrade.' + market['id'];
962
+ topics.push(topic);
963
+ const messageHash = 'unsubscribe:trade:' + symbol;
964
+ messageHashes.push(messageHash);
965
+ subMessageHashes.push('trade:' + symbol);
966
+ }
967
+ return await this.unWatchTopics(url, 'trade', symbols, messageHashes, subMessageHashes, topics, params);
968
+ }
969
+ async unWatchTrades(symbol, params = {}) {
970
+ /**
971
+ * @method
972
+ * @name bybit#unWatchTrades
973
+ * @description unsubscribe from the trades channel
974
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/public/trade
975
+ * @param {string} symbol unified symbol of the market to unwatch the trades for
976
+ * @returns {any} status of the unwatch request
977
+ */
978
+ await this.loadMarkets();
979
+ return await this.unWatchTradesForSymbols([symbol], params);
980
+ }
850
981
  handleTrades(client, message) {
851
982
  //
852
983
  // {
@@ -1005,6 +1136,35 @@ class bybit extends bybit$1 {
1005
1136
  }
1006
1137
  return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
1007
1138
  }
1139
+ async unWatchMyTrades(symbol = undefined, params = {}) {
1140
+ /**
1141
+ * @method
1142
+ * @name bybit#unWatchMyTrades
1143
+ * @description unWatches information on multiple trades made by the user
1144
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/private/execution
1145
+ * @param {string} symbol unified market symbol of the market orders were made in
1146
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1147
+ * @param {boolean} [params.unifiedMargin] use unified margin account
1148
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1149
+ */
1150
+ const method = 'watchMyTrades';
1151
+ const messageHash = 'unsubscribe:myTrades';
1152
+ let subHash = 'myTrades';
1153
+ await this.loadMarkets();
1154
+ if (symbol !== undefined) {
1155
+ symbol = this.symbol(symbol);
1156
+ subHash += ':' + symbol;
1157
+ }
1158
+ const url = await this.getUrlByMarketType(symbol, true, method, params);
1159
+ await this.authenticate(url);
1160
+ const topicByMarket = {
1161
+ 'spot': 'ticketInfo',
1162
+ 'unified': 'execution',
1163
+ 'usdc': 'user.openapi.perp.trade',
1164
+ };
1165
+ const topic = this.safeValue(topicByMarket, this.getPrivateType(url));
1166
+ return await this.unWatchTopics(url, 'myTrades', [], [messageHash], [subHash], [topic], params);
1167
+ }
1008
1168
  handleMyTrades(client, message) {
1009
1169
  //
1010
1170
  // spot
@@ -1369,6 +1529,35 @@ class bybit extends bybit$1 {
1369
1529
  }
1370
1530
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
1371
1531
  }
1532
+ async unWatchOrders(symbol = undefined, params = {}) {
1533
+ /**
1534
+ * @method
1535
+ * @name bybit#unWatchOrders
1536
+ * @description unWatches information on multiple orders made by the user
1537
+ * @see https://bybit-exchange.github.io/docs/v5/websocket/private/order
1538
+ * @param {string} symbol unified market symbol of the market orders were made in
1539
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1540
+ * @param {boolean} [params.unifiedMargin] use unified margin account
1541
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1542
+ */
1543
+ await this.loadMarkets();
1544
+ const method = 'watchOrders';
1545
+ const messageHash = 'unsubscribe:orders';
1546
+ let subHash = 'orders';
1547
+ if (symbol !== undefined) {
1548
+ symbol = this.symbol(symbol);
1549
+ subHash += ':' + symbol;
1550
+ }
1551
+ const url = await this.getUrlByMarketType(symbol, true, method, params);
1552
+ await this.authenticate(url);
1553
+ const topicsByMarket = {
1554
+ 'spot': ['order', 'stopOrder'],
1555
+ 'unified': ['order'],
1556
+ 'usdc': ['user.openapi.perp.order'],
1557
+ };
1558
+ const topics = this.safeValue(topicsByMarket, this.getPrivateType(url));
1559
+ return await this.unWatchTopics(url, 'orders', [], [messageHash], [subHash], topics, params);
1560
+ }
1372
1561
  handleOrderWs(client, message) {
1373
1562
  //
1374
1563
  // {
@@ -1951,7 +2140,24 @@ class bybit extends bybit$1 {
1951
2140
  'args': topics,
1952
2141
  };
1953
2142
  const message = this.extend(request, params);
1954
- return await this.watchMultiple(url, messageHashes, message, topics);
2143
+ return await this.watchMultiple(url, messageHashes, message, messageHashes);
2144
+ }
2145
+ async unWatchTopics(url, topic, symbols, messageHashes, subMessageHashes, topics, params = {}) {
2146
+ const reqId = this.requestId();
2147
+ const request = {
2148
+ 'op': 'unsubscribe',
2149
+ 'req_id': reqId,
2150
+ 'args': topics,
2151
+ };
2152
+ const subscription = {
2153
+ 'id': reqId,
2154
+ 'topic': topic,
2155
+ 'messageHashes': messageHashes,
2156
+ 'subMessageHashes': subMessageHashes,
2157
+ 'symbols': symbols,
2158
+ };
2159
+ const message = this.extend(request, params);
2160
+ return await this.watchMultiple(url, messageHashes, message, messageHashes, subscription);
1955
2161
  }
1956
2162
  async authenticate(url, params = {}) {
1957
2163
  this.checkRequiredCredentials();
@@ -2102,6 +2308,7 @@ class bybit extends bybit$1 {
2102
2308
  'order.amend': this.handleOrderWs,
2103
2309
  'order.cancel': this.handleOrderWs,
2104
2310
  'auth': this.handleAuthenticate,
2311
+ 'unsubscribe': this.handleUnSubscribe,
2105
2312
  };
2106
2313
  const exacMethod = this.safeValue(methods, topic);
2107
2314
  if (exacMethod !== undefined) {
@@ -2192,6 +2399,88 @@ class bybit extends bybit$1 {
2192
2399
  //
2193
2400
  return message;
2194
2401
  }
2402
+ handleUnSubscribe(client, message) {
2403
+ //
2404
+ // {"success":true,"ret_msg":"","conn_id":"7188110e-6908-41e9-b863-6365127e92ad","req_id":"3","op":"unsubscribe"}
2405
+ //
2406
+ // client.subscription will be something like:
2407
+ // {
2408
+ // "publicTrade.LTCUSDT":true,
2409
+ // "publicTrade.ADAUSDT":true,
2410
+ // "unsubscribe:trade:LTC/USDT:USDT": {
2411
+ // "id":4,
2412
+ // "subHash": "trade:LTC/USDT"
2413
+ // },
2414
+ // }
2415
+ const reqId = this.safeString(message, 'req_id');
2416
+ const keys = Object.keys(client.subscriptions);
2417
+ for (let i = 0; i < keys.length; i++) {
2418
+ const messageHash = keys[i];
2419
+ if (!(messageHash in client.subscriptions)) {
2420
+ continue;
2421
+ // the previous iteration can have deleted the messageHash from the subscriptions
2422
+ }
2423
+ if (messageHash.startsWith('unsubscribe')) {
2424
+ const subscription = client.subscriptions[messageHash];
2425
+ const subId = this.safeString(subscription, 'id');
2426
+ if (reqId !== subId) {
2427
+ continue;
2428
+ }
2429
+ const messageHashes = this.safeList(subscription, 'messageHashes', []);
2430
+ const subMessageHashes = this.safeList(subscription, 'subMessageHashes', []);
2431
+ for (let j = 0; j < messageHashes.length; j++) {
2432
+ const unsubHash = messageHashes[j];
2433
+ const subHash = subMessageHashes[j];
2434
+ if (unsubHash in client.subscriptions) {
2435
+ delete client.subscriptions[unsubHash];
2436
+ }
2437
+ if (subHash in client.subscriptions) {
2438
+ delete client.subscriptions[subHash];
2439
+ }
2440
+ const error = new errors.UnsubscribeError(this.id + ' ' + messageHash);
2441
+ client.reject(error, subHash);
2442
+ client.resolve(true, unsubHash);
2443
+ this.cleanCache(subscription);
2444
+ }
2445
+ }
2446
+ }
2447
+ return message;
2448
+ }
2449
+ cleanCache(subscription) {
2450
+ const topic = this.safeString(subscription, 'topic');
2451
+ const symbols = this.safeList(subscription, 'symbols', []);
2452
+ const symbolsLength = symbols.length;
2453
+ if (symbolsLength > 0) {
2454
+ for (let i = 0; i < symbols.length; i++) {
2455
+ const symbol = symbols[i];
2456
+ if (topic === 'trade') {
2457
+ delete this.trades[symbol];
2458
+ }
2459
+ else if (topic === 'orderbook') {
2460
+ delete this.orderbooks[symbol];
2461
+ }
2462
+ else if (topic === 'ticker') {
2463
+ delete this.tickers[symbol];
2464
+ }
2465
+ }
2466
+ }
2467
+ else {
2468
+ if (topic === 'myTrades') {
2469
+ // don't reset this.myTrades directly here
2470
+ // because in c# we need to use a different object
2471
+ const keys = Object.keys(this.myTrades);
2472
+ for (let i = 0; i < keys.length; i++) {
2473
+ delete this.myTrades[keys[i]];
2474
+ }
2475
+ }
2476
+ else if (topic === 'orders') {
2477
+ const orderSymbols = Object.keys(this.orders);
2478
+ for (let i = 0; i < orderSymbols.length; i++) {
2479
+ delete this.orders[orderSymbols[i]];
2480
+ }
2481
+ }
2482
+ }
2483
+ }
2195
2484
  }
2196
2485
 
2197
2486
  module.exports = bybit;
@@ -1192,6 +1192,7 @@ class cex extends cex$1 {
1192
1192
  * @name cex#fetchOrderWs
1193
1193
  * @description fetches information on an order made by the user
1194
1194
  * @see https://docs.cex.io/#ws-api-get-order
1195
+ * @param {string} id the order id
1195
1196
  * @param {string} symbol not used by cex fetchOrder
1196
1197
  * @param {object} [params] extra parameters specific to the cex api endpoint
1197
1198
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1073,6 +1073,7 @@ class probit extends probit$1 {
1073
1073
  * @name probit#fetchOrder
1074
1074
  * @see https://docs-en.probit.com/reference/order-3
1075
1075
  * @description fetches information on an order made by the user
1076
+ * @param {string} id the order id
1076
1077
  * @param {string} symbol unified symbol of the market the order was made in
1077
1078
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1078
1079
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1968,6 +1968,7 @@ class vertex extends vertex$1 {
1968
1968
  * @name vertex#fetchOrder
1969
1969
  * @description fetches information on an order made by the user
1970
1970
  * @see https://docs.vertexprotocol.com/developer-resources/api/gateway/queries/order
1971
+ * @param {string} id the order id
1971
1972
  * @param {string} symbol unified symbol of the market the order was made in
1972
1973
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1973
1974
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1366,6 +1366,7 @@ class woo extends woo$1 {
1366
1366
  * @see https://docs.woo.org/#get-algo-order
1367
1367
  * @see https://docs.woo.org/#get-order
1368
1368
  * @description fetches information on an order made by the user
1369
+ * @param {string} id the order id
1369
1370
  * @param {string} symbol unified symbol of the market the order was made in
1370
1371
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1371
1372
  * @param {boolean} [params.stop] whether the order is a stop/algo order
@@ -1713,6 +1713,7 @@ class woofipro extends woofipro$1 {
1713
1713
  * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id
1714
1714
  * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id
1715
1715
  * @description fetches information on an order made by the user
1716
+ * @param {string} id the order id
1716
1717
  * @param {string} symbol unified symbol of the market the order was made in
1717
1718
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1718
1719
  * @param {boolean} [params.trigger] whether the order is a stop/algo order
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
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, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } 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.3.87";
7
+ declare const version = "4.3.88";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
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.3.88';
41
+ const version = '4.3.89';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/ace.js CHANGED
@@ -676,6 +676,7 @@ export default class ace extends Exchange {
676
676
  * @name ace#fetchOrder
677
677
  * @description fetches information on an order made by the user
678
678
  * @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-status
679
+ * @param {string} id the order id
679
680
  * @param {string} symbol unified symbol of the market the order was made in
680
681
  * @param {object} [params] extra parameters specific to the exchange API endpoint
681
682
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
package/js/src/alpaca.js CHANGED
@@ -825,6 +825,7 @@ export default class alpaca extends Exchange {
825
825
  * @name alpaca#fetchOrder
826
826
  * @description fetches information on an order made by the user
827
827
  * @see https://docs.alpaca.markets/reference/getorderbyorderid
828
+ * @param {string} id the order id
828
829
  * @param {string} symbol unified symbol of the market the order was made in
829
830
  * @param {object} [params] extra parameters specific to the exchange API endpoint
830
831
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -41,7 +41,6 @@ export default class ascendex extends Exchange {
41
41
  network: string;
42
42
  info: any;
43
43
  };
44
- safeNetwork(networkId: any): string;
45
44
  fetchDepositAddress(code: string, params?: {}): Promise<any>;
46
45
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
47
46
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
@@ -285,26 +285,17 @@ export default class ascendex extends Exchange {
285
285
  'SOL': 'Solana',
286
286
  'AVAX': 'avalanche C chain',
287
287
  'OMNI': 'Omni',
288
- 'TRC': 'TRC20',
288
+ // 'TRC': 'TRC20',
289
289
  'TRX': 'TRC20',
290
- 'ERC': 'ERC20',
291
- },
292
- 'networksById': {
293
- 'BEP20 (BSC)': 'BSC',
294
- 'arbitrum': 'ARB',
295
- 'Solana': 'SOL',
296
- 'avalanche C chain': 'AVAX',
297
- 'Omni': 'OMNI',
298
290
  'TRC20': 'TRC20',
299
291
  'ERC20': 'ERC20',
300
292
  'GO20': 'GO20',
301
293
  'BEP2': 'BEP2',
302
- 'Bitcoin': 'BTC',
303
- 'Bitcoin ABC': 'BCH',
304
- 'Litecoin': 'LTC',
305
- 'Matic Network': 'MATIC',
306
- 'xDai': 'STAKE',
307
- 'Akash': 'AKT',
294
+ 'BTC': 'Bitcoin',
295
+ 'BCH': 'Bitcoin ABC',
296
+ 'LTC': 'Litecoin',
297
+ 'MATIC': 'Matic Network',
298
+ 'AKT': 'Akash',
308
299
  },
309
300
  },
310
301
  'exceptions': {
@@ -1787,6 +1778,7 @@ export default class ascendex extends Exchange {
1787
1778
  * @description fetches information on an order made by the user
1788
1779
  * @see https://ascendex.github.io/ascendex-pro-api/#query-order
1789
1780
  * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
1781
+ * @param {string} id the order id
1790
1782
  * @param {string} symbol unified symbol of the market the order was made in
1791
1783
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1792
1784
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2407,10 +2399,6 @@ export default class ascendex extends Exchange {
2407
2399
  'info': depositAddress,
2408
2400
  };
2409
2401
  }
2410
- safeNetwork(networkId) {
2411
- const networksById = this.safeDict(this.options, 'networksById');
2412
- return this.safeString(networksById, networkId, networkId);
2413
- }
2414
2402
  async fetchDepositAddress(code, params = {}) {
2415
2403
  /**
2416
2404
  * @method
package/js/src/bigone.js CHANGED
@@ -1652,6 +1652,7 @@ export default class bigone extends Exchange {
1652
1652
  * @name bigone#fetchOrder
1653
1653
  * @description fetches information on an order made by the user
1654
1654
  * @see https://open.big.one/docs/spot_orders.html#get-one-order
1655
+ * @param {string} id the order id
1655
1656
  * @param {string} symbol not used by bigone fetchOrder
1656
1657
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1657
1658
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}