ccxt 4.3.98 → 4.4.1

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.
package/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.3.98';
197
+ const version = '4.4.1';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -1308,10 +1308,11 @@ class bitget extends bitget$1 {
1308
1308
  },
1309
1309
  'precisionMode': number.TICK_SIZE,
1310
1310
  'commonCurrencies': {
1311
- 'JADE': 'Jade Protocol',
1311
+ 'APX': 'AstroPepeX',
1312
1312
  'DEGEN': 'DegenReborn',
1313
+ 'JADE': 'Jade Protocol',
1314
+ 'OMNI': 'omni',
1313
1315
  'TONCOIN': 'TON',
1314
- 'OMNI': 'omni', // conflict with Omni Network
1315
1316
  },
1316
1317
  'options': {
1317
1318
  'timeframes': {
@@ -607,6 +607,7 @@ class gate extends gate$1 {
607
607
  'MPH': 'MORPHER',
608
608
  'POINT': 'GATEPOINT',
609
609
  'RAI': 'RAIREFLEXINDEX',
610
+ 'RED': 'RedLang',
610
611
  'SBTC': 'SUPERBITCOIN',
611
612
  'TNC': 'TRINITYNETWORKCREDIT',
612
613
  'VAI': 'VAIOT',
@@ -160,6 +160,34 @@ class hyperliquid extends hyperliquid$1 {
160
160
  const orderbook = await this.watch(url, messageHash, message, messageHash);
161
161
  return orderbook.limit();
162
162
  }
163
+ async unWatchOrderBook(symbol, params = {}) {
164
+ /**
165
+ * @method
166
+ * @name hyperliquid#unWatchOrderBook
167
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
168
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
169
+ * @param {string} symbol unified symbol of the market to fetch the order book for
170
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
171
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
172
+ */
173
+ await this.loadMarkets();
174
+ const market = this.market(symbol);
175
+ symbol = market['symbol'];
176
+ const subMessageHash = 'orderbook:' + symbol;
177
+ const messageHash = 'unsubscribe:' + subMessageHash;
178
+ const url = this.urls['api']['ws']['public'];
179
+ const id = this.nonce().toString();
180
+ const request = {
181
+ 'id': id,
182
+ 'method': 'unsubscribe',
183
+ 'subscription': {
184
+ 'type': 'l2Book',
185
+ 'coin': market['swap'] ? market['base'] : market['id'],
186
+ },
187
+ };
188
+ const message = this.extend(request, params);
189
+ return await this.watch(url, messageHash, message, messageHash);
190
+ }
163
191
  handleOrderBook(client, message) {
164
192
  //
165
193
  // {
@@ -234,6 +262,30 @@ class hyperliquid extends hyperliquid$1 {
234
262
  }
235
263
  return this.tickers;
236
264
  }
265
+ async unWatchTickers(symbols = undefined, params = {}) {
266
+ /**
267
+ * @method
268
+ * @name hyperliquid#unWatchTickers
269
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
270
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
271
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
272
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
273
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
274
+ */
275
+ await this.loadMarkets();
276
+ symbols = this.marketSymbols(symbols, undefined, true);
277
+ const subMessageHash = 'tickers';
278
+ const messageHash = 'unsubscribe:' + subMessageHash;
279
+ const url = this.urls['api']['ws']['public'];
280
+ const request = {
281
+ 'method': 'unsubscribe',
282
+ 'subscription': {
283
+ 'type': 'webData2',
284
+ 'user': '0x0000000000000000000000000000000000000000',
285
+ },
286
+ };
287
+ return await this.watch(url, messageHash, this.extend(request, params), messageHash);
288
+ }
237
289
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
238
290
  /**
239
291
  * @method
@@ -403,17 +455,17 @@ class hyperliquid extends hyperliquid$1 {
403
455
  client.resolve(trades, messageHash);
404
456
  }
405
457
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
406
- /**
407
- * @method
408
- * @name hyperliquid#watchTrades
409
- * @description watches information on multiple trades made in a market
410
- * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
411
- * @param {string} symbol unified market symbol of the market trades were made in
412
- * @param {int} [since] the earliest time in ms to fetch trades for
413
- * @param {int} [limit] the maximum number of trade structures to retrieve
414
- * @param {object} [params] extra parameters specific to the exchange API endpoint
415
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
416
- */
458
+ // s
459
+ // @method
460
+ // @name hyperliquid#watchTrades
461
+ // @description watches information on multiple trades made in a market
462
+ // @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
463
+ // @param {string} symbol unified market symbol of the market trades were made in
464
+ // @param {int} [since] the earliest time in ms to fetch trades for
465
+ // @param {int} [limit] the maximum number of trade structures to retrieve
466
+ // @param {object} [params] extra parameters specific to the exchange API endpoint
467
+ // @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
468
+ //
417
469
  await this.loadMarkets();
418
470
  const market = this.market(symbol);
419
471
  symbol = market['symbol'];
@@ -433,6 +485,32 @@ class hyperliquid extends hyperliquid$1 {
433
485
  }
434
486
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
435
487
  }
488
+ async unWatchTrades(symbol, params = {}) {
489
+ /**
490
+ * @method
491
+ * @name hyperliquid#unWatchTrades
492
+ * @description unWatches information on multiple trades made in a market
493
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
494
+ * @param {string} symbol unified market symbol of the market trades were made in
495
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
496
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
497
+ */
498
+ await this.loadMarkets();
499
+ const market = this.market(symbol);
500
+ symbol = market['symbol'];
501
+ const subMessageHash = 'trade:' + symbol;
502
+ const messageHash = 'unsubscribe:' + subMessageHash;
503
+ const url = this.urls['api']['ws']['public'];
504
+ const request = {
505
+ 'method': 'unsubscribe',
506
+ 'subscription': {
507
+ 'type': 'trades',
508
+ 'coin': market['swap'] ? market['base'] : market['id'],
509
+ },
510
+ };
511
+ const message = this.extend(request, params);
512
+ return await this.watch(url, messageHash, message, messageHash);
513
+ }
436
514
  handleTrades(client, message) {
437
515
  //
438
516
  // {
@@ -566,6 +644,34 @@ class hyperliquid extends hyperliquid$1 {
566
644
  }
567
645
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
568
646
  }
647
+ async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
648
+ /**
649
+ * @method
650
+ * @name hyperliquid#unWatchOHLCV
651
+ * @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
652
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
653
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
654
+ * @param {string} timeframe the length of time each candle represents
655
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
656
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
657
+ */
658
+ await this.loadMarkets();
659
+ const market = this.market(symbol);
660
+ symbol = market['symbol'];
661
+ const url = this.urls['api']['ws']['public'];
662
+ const request = {
663
+ 'method': 'unsubscribe',
664
+ 'subscription': {
665
+ 'type': 'candle',
666
+ 'coin': market['swap'] ? market['base'] : market['id'],
667
+ 'interval': timeframe,
668
+ },
669
+ };
670
+ const subMessageHash = 'candles:' + timeframe + ':' + symbol;
671
+ const messagehash = 'unsubscribe:' + subMessageHash;
672
+ const message = this.extend(request, params);
673
+ return await this.watch(url, messagehash, message, messagehash);
674
+ }
569
675
  handleOHLCV(client, message) {
570
676
  //
571
677
  // {
@@ -721,7 +827,153 @@ class hyperliquid extends hyperliquid$1 {
721
827
  return false;
722
828
  }
723
829
  }
830
+ handleOrderBookUnsubscription(client, subscription) {
831
+ //
832
+ // "subscription":{
833
+ // "type":"l2Book",
834
+ // "coin":"BTC",
835
+ // "nSigFigs":5,
836
+ // "mantissa":null
837
+ // }
838
+ //
839
+ const coin = this.safeString(subscription, 'coin');
840
+ const marketId = this.coinToMarketId(coin);
841
+ const symbol = this.safeSymbol(marketId);
842
+ const subMessageHash = 'orderbook:' + symbol;
843
+ const messageHash = 'unsubscribe:' + subMessageHash;
844
+ if (messageHash in client.subscriptions) {
845
+ delete client.subscriptions[messageHash];
846
+ }
847
+ if (subMessageHash in client.subscriptions) {
848
+ delete client.subscriptions[subMessageHash];
849
+ }
850
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
851
+ client.reject(error, subMessageHash);
852
+ client.resolve(true, messageHash);
853
+ if (symbol in this.orderbooks) {
854
+ delete this.orderbooks[symbol];
855
+ }
856
+ }
857
+ handleTradesUnsubscription(client, subscription) {
858
+ //
859
+ const coin = this.safeString(subscription, 'coin');
860
+ const marketId = this.coinToMarketId(coin);
861
+ const symbol = this.safeSymbol(marketId);
862
+ const subMessageHash = 'trade:' + symbol;
863
+ const messageHash = 'unsubscribe:' + subMessageHash;
864
+ if (messageHash in client.subscriptions) {
865
+ delete client.subscriptions[messageHash];
866
+ }
867
+ if (subMessageHash in client.subscriptions) {
868
+ delete client.subscriptions[subMessageHash];
869
+ }
870
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
871
+ client.reject(error, subMessageHash);
872
+ client.resolve(true, messageHash);
873
+ if (symbol in this.trades) {
874
+ delete this.trades[symbol];
875
+ }
876
+ }
877
+ handleTickersUnsubscription(client, subscription) {
878
+ //
879
+ const subMessageHash = 'tickers';
880
+ const messageHash = 'unsubscribe:' + subMessageHash;
881
+ if (messageHash in client.subscriptions) {
882
+ delete client.subscriptions[messageHash];
883
+ }
884
+ if (subMessageHash in client.subscriptions) {
885
+ delete client.subscriptions[subMessageHash];
886
+ }
887
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
888
+ client.reject(error, subMessageHash);
889
+ client.resolve(true, messageHash);
890
+ const symbols = Object.keys(this.tickers);
891
+ for (let i = 0; i < symbols.length; i++) {
892
+ delete this.tickers[symbols[i]];
893
+ }
894
+ }
895
+ handleOHLCVUnsubscription(client, subscription) {
896
+ const coin = this.safeString(subscription, 'coin');
897
+ const marketId = this.coinToMarketId(coin);
898
+ const symbol = this.safeSymbol(marketId);
899
+ const interval = this.safeString(subscription, 'interval');
900
+ const timeframe = this.findTimeframe(interval);
901
+ const subMessageHash = 'candles:' + timeframe + ':' + symbol;
902
+ const messageHash = 'unsubscribe:' + subMessageHash;
903
+ if (messageHash in client.subscriptions) {
904
+ delete client.subscriptions[messageHash];
905
+ }
906
+ if (subMessageHash in client.subscriptions) {
907
+ delete client.subscriptions[subMessageHash];
908
+ }
909
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
910
+ client.reject(error, subMessageHash);
911
+ client.resolve(true, messageHash);
912
+ if (symbol in this.ohlcvs) {
913
+ if (timeframe in this.ohlcvs[symbol]) {
914
+ delete this.ohlcvs[symbol][timeframe];
915
+ }
916
+ }
917
+ }
918
+ handleSubscriptionResponse(client, message) {
919
+ // {
920
+ // "channel":"subscriptionResponse",
921
+ // "data":{
922
+ // "method":"unsubscribe",
923
+ // "subscription":{
924
+ // "type":"l2Book",
925
+ // "coin":"BTC",
926
+ // "nSigFigs":5,
927
+ // "mantissa":null
928
+ // }
929
+ // }
930
+ // }
931
+ //
932
+ // {
933
+ // "channel":"subscriptionResponse",
934
+ // "data":{
935
+ // "method":"unsubscribe",
936
+ // "subscription":{
937
+ // "type":"trades",
938
+ // "coin":"PURR/USDC"
939
+ // }
940
+ // }
941
+ // }
942
+ //
943
+ const data = this.safeDict(message, 'data', {});
944
+ const method = this.safeString(data, 'method');
945
+ if (method === 'unsubscribe') {
946
+ const subscription = this.safeDict(data, 'subscription', {});
947
+ const type = this.safeString(subscription, 'type');
948
+ if (type === 'l2Book') {
949
+ this.handleOrderBookUnsubscription(client, subscription);
950
+ }
951
+ else if (type === 'trades') {
952
+ this.handleTradesUnsubscription(client, subscription);
953
+ }
954
+ else if (type === 'webData2') {
955
+ this.handleTickersUnsubscription(client, subscription);
956
+ }
957
+ else if (type === 'candle') {
958
+ this.handleOHLCVUnsubscription(client, subscription);
959
+ }
960
+ }
961
+ }
724
962
  handleMessage(client, message) {
963
+ //
964
+ // {
965
+ // "channel":"subscriptionResponse",
966
+ // "data":{
967
+ // "method":"unsubscribe",
968
+ // "subscription":{
969
+ // "type":"l2Book",
970
+ // "coin":"BTC",
971
+ // "nSigFigs":5,
972
+ // "mantissa":null
973
+ // }
974
+ // }
975
+ // }
976
+ //
725
977
  if (this.handleErrorMessage(client, message)) {
726
978
  return;
727
979
  }
@@ -735,6 +987,7 @@ class hyperliquid extends hyperliquid$1 {
735
987
  'userFills': this.handleMyTrades,
736
988
  'webData2': this.handleWsTickers,
737
989
  'post': this.handleWsPost,
990
+ 'subscriptionResponse': this.handleSubscriptionResponse,
738
991
  };
739
992
  const exacMethod = this.safeValue(methods, topic);
740
993
  if (exacMethod !== undefined) {
@@ -351,7 +351,7 @@ async function run () {
351
351
  if (!isWsMethod && !raw) {
352
352
  log (exchange.iso8601 (end), 'iteration', i++, 'passed in', end - start, 'ms\n')
353
353
  }
354
- printHumanReadable (exchange, JSON.parse(JSON.stringify(result)))
354
+ printHumanReadable (exchange, result)
355
355
  if (!isWsMethod && !raw) {
356
356
  log (exchange.iso8601 (end), 'iteration', i, 'passed in', end - start, 'ms\n')
357
357
  }
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.97";
7
+ declare const version = "4.4.0";
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.98';
41
+ const version = '4.4.1';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bitget.js CHANGED
@@ -1311,10 +1311,11 @@ export default class bitget extends Exchange {
1311
1311
  },
1312
1312
  'precisionMode': TICK_SIZE,
1313
1313
  'commonCurrencies': {
1314
- 'JADE': 'Jade Protocol',
1314
+ 'APX': 'AstroPepeX',
1315
1315
  'DEGEN': 'DegenReborn',
1316
+ 'JADE': 'Jade Protocol',
1317
+ 'OMNI': 'omni',
1316
1318
  'TONCOIN': 'TON',
1317
- 'OMNI': 'omni', // conflict with Omni Network
1318
1319
  },
1319
1320
  'options': {
1320
1321
  'timeframes': {
package/js/src/gate.js CHANGED
@@ -610,6 +610,7 @@ export default class gate extends Exchange {
610
610
  'MPH': 'MORPHER',
611
611
  'POINT': 'GATEPOINT',
612
612
  'RAI': 'RAIREFLEXINDEX',
613
+ 'RED': 'RedLang',
613
614
  'SBTC': 'SUPERBITCOIN',
614
615
  'TNC': 'TRINITYNETWORKCREDIT',
615
616
  'VAI': 'VAIOT',
@@ -7,21 +7,30 @@ export default class hyperliquid extends hyperliquidRest {
7
7
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
8
8
  editOrderWs(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
9
9
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
10
+ unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
10
11
  handleOrderBook(client: any, message: any): void;
11
12
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
+ unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
12
14
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
13
15
  handleWsTickers(client: Client, message: any): void;
14
16
  parseWsTicker(rawTicker: any, market?: Market): Ticker;
15
17
  handleMyTrades(client: Client, message: any): void;
16
18
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
19
+ unWatchTrades(symbol: string, params?: {}): Promise<any>;
17
20
  handleTrades(client: Client, message: any): void;
18
21
  parseWsTrade(trade: Dict, market?: Market): Trade;
19
22
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
23
+ unWatchOHLCV(symbol: string, timeframe?: string, params?: {}): Promise<any>;
20
24
  handleOHLCV(client: Client, message: any): void;
21
- handleWsPost(client: Client, message: any): void;
25
+ handleWsPost(client: Client, message: Dict): void;
22
26
  watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
23
27
  handleOrder(client: Client, message: any): void;
24
28
  handleErrorMessage(client: Client, message: any): boolean;
29
+ handleOrderBookUnsubscription(client: Client, subscription: Dict): void;
30
+ handleTradesUnsubscription(client: Client, subscription: Dict): void;
31
+ handleTickersUnsubscription(client: Client, subscription: Dict): void;
32
+ handleOHLCVUnsubscription(client: Client, subscription: Dict): void;
33
+ handleSubscriptionResponse(client: Client, message: any): void;
25
34
  handleMessage(client: Client, message: any): void;
26
35
  ping(client: Client): {
27
36
  method: string;