ccxt 4.4.4 → 4.4.6

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 (48) 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/binance.js +3 -3
  5. package/dist/cjs/src/binanceus.js +1 -0
  6. package/dist/cjs/src/bitflyer.js +2 -2
  7. package/dist/cjs/src/bitget.js +56 -95
  8. package/dist/cjs/src/bitmart.js +186 -127
  9. package/dist/cjs/src/bybit.js +90 -7
  10. package/dist/cjs/src/coinbase.js +6 -8
  11. package/dist/cjs/src/kraken.js +6 -1
  12. package/dist/cjs/src/lykke.js +2 -2
  13. package/dist/cjs/src/mexc.js +37 -7
  14. package/dist/cjs/src/paradex.js +1 -1
  15. package/dist/cjs/src/pro/binance.js +6 -2
  16. package/dist/cjs/src/pro/binanceus.js +2 -1
  17. package/dist/cjs/src/pro/htx.js +14 -0
  18. package/dist/cjs/src/pro/hyperliquid.js +16 -1
  19. package/dist/cjs/src/pro/kraken.js +60 -0
  20. package/dist/cjs/src/pro/paradex.js +1 -0
  21. package/js/ccxt.d.ts +1 -1
  22. package/js/ccxt.js +1 -1
  23. package/js/src/abstract/bitmart.d.ts +4 -0
  24. package/js/src/binance.js +3 -3
  25. package/js/src/binanceus.js +1 -0
  26. package/js/src/bitflyer.js +2 -2
  27. package/js/src/bitget.d.ts +1 -1
  28. package/js/src/bitget.js +56 -95
  29. package/js/src/bitmart.js +186 -127
  30. package/js/src/bybit.js +90 -7
  31. package/js/src/coinbase.js +6 -8
  32. package/js/src/kraken.js +6 -1
  33. package/js/src/lykke.js +2 -2
  34. package/js/src/mexc.d.ts +1 -0
  35. package/js/src/mexc.js +37 -7
  36. package/js/src/paradex.js +1 -1
  37. package/js/src/pro/binance.d.ts +140 -0
  38. package/js/src/pro/binance.js +6 -2
  39. package/js/src/pro/binanceus.js +2 -1
  40. package/js/src/pro/htx.js +14 -0
  41. package/js/src/pro/hyperliquid.d.ts +1 -0
  42. package/js/src/pro/hyperliquid.js +16 -1
  43. package/js/src/pro/kraken.d.ts +3 -0
  44. package/js/src/pro/kraken.js +60 -0
  45. package/js/src/pro/paradex.js +1 -0
  46. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  47. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  48. package/package.json +1 -1
package/js/src/kraken.js CHANGED
@@ -234,6 +234,8 @@ export default class kraken extends Exchange {
234
234
  'XDG': 'DOGE',
235
235
  },
236
236
  'options': {
237
+ 'timeDifference': 0,
238
+ 'adjustForTimeDifference': false,
237
239
  'marketsByAltname': {},
238
240
  'delistedMarketsById': {},
239
241
  // cannot withdraw/deposit these
@@ -464,6 +466,9 @@ export default class kraken extends Exchange {
464
466
  * @param {object} [params] extra parameters specific to the exchange API endpoint
465
467
  * @returns {object[]} an array of objects representing market data
466
468
  */
469
+ if (this.options['adjustForTimeDifference']) {
470
+ await this.loadTimeDifference();
471
+ }
467
472
  const response = await this.publicGetAssetPairs(params);
468
473
  //
469
474
  // {
@@ -3148,7 +3153,7 @@ export default class kraken extends Exchange {
3148
3153
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
3149
3154
  }
3150
3155
  nonce() {
3151
- return this.milliseconds();
3156
+ return this.milliseconds() - this.options['timeDifference'];
3152
3157
  }
3153
3158
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
3154
3159
  if (code === 520) {
package/js/src/lykke.js CHANGED
@@ -681,9 +681,9 @@ export default class lykke extends Exchange {
681
681
  const currencyId = this.safeString(balance, 'assetId');
682
682
  const code = this.safeCurrencyCode(currencyId);
683
683
  const account = this.account();
684
- const free = this.safeString(balance, 'available');
684
+ const total = this.safeString(balance, 'available');
685
685
  const used = this.safeString(balance, 'reserved');
686
- account['free'] = free;
686
+ account['total'] = total;
687
687
  account['used'] = used;
688
688
  result[code] = account;
689
689
  }
package/js/src/mexc.d.ts CHANGED
@@ -156,6 +156,7 @@ export default class mexc extends Exchange {
156
156
  parseLeverage(leverage: Dict, market?: Market): Leverage;
157
157
  handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
158
158
  fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
159
+ nonce(): number;
159
160
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
160
161
  url: any;
161
162
  method: string;
package/js/src/mexc.js CHANGED
@@ -33,6 +33,9 @@ export default class mexc extends Exchange {
33
33
  'future': false,
34
34
  'option': false,
35
35
  'addMargin': true,
36
+ 'borrowCrossMargin': false,
37
+ 'borrowIsolatedMargin': false,
38
+ 'borrowMargin': false,
36
39
  'cancelAllOrders': true,
37
40
  'cancelOrder': true,
38
41
  'cancelOrders': undefined,
@@ -46,12 +49,21 @@ export default class mexc extends Exchange {
46
49
  'createOrders': true,
47
50
  'createPostOnlyOrder': true,
48
51
  'createReduceOnlyOrder': true,
52
+ 'createStopLimitOrder': true,
53
+ 'createStopMarketOrder': true,
54
+ 'createStopOrder': true,
55
+ 'createTriggerOrder': true,
49
56
  'deposit': undefined,
50
57
  'editOrder': undefined,
51
58
  'fetchAccounts': true,
52
59
  'fetchBalance': true,
53
60
  'fetchBidsAsks': true,
54
- 'fetchBorrowRateHistory': undefined,
61
+ 'fetchBorrowInterest': false,
62
+ 'fetchBorrowRate': false,
63
+ 'fetchBorrowRateHistories': false,
64
+ 'fetchBorrowRateHistory': false,
65
+ 'fetchBorrowRates': false,
66
+ 'fetchBorrowRatesPerSymbol': false,
55
67
  'fetchCanceledOrders': true,
56
68
  'fetchClosedOrder': undefined,
57
69
  'fetchClosedOrders': true,
@@ -72,6 +84,7 @@ export default class mexc extends Exchange {
72
84
  'fetchIndexOHLCV': true,
73
85
  'fetchIsolatedBorrowRate': false,
74
86
  'fetchIsolatedBorrowRates': false,
87
+ 'fetchIsolatedPositions': false,
75
88
  'fetchL2OrderBook': true,
76
89
  'fetchLedger': undefined,
77
90
  'fetchLedgerEntry': undefined,
@@ -80,11 +93,13 @@ export default class mexc extends Exchange {
80
93
  'fetchLeverageTiers': true,
81
94
  'fetchMarginAdjustmentHistory': false,
82
95
  'fetchMarginMode': false,
83
- 'fetchMarketLeverageTiers': undefined,
96
+ 'fetchMarketLeverageTiers': 'emulated',
84
97
  'fetchMarkets': true,
85
98
  'fetchMarkOHLCV': true,
86
99
  'fetchMyTrades': true,
87
100
  'fetchOHLCV': true,
101
+ 'fetchOpenInterest': false,
102
+ 'fetchOpenInterestHistory': false,
88
103
  'fetchOpenOrder': undefined,
89
104
  'fetchOpenOrders': true,
90
105
  'fetchOrder': true,
@@ -92,7 +107,7 @@ export default class mexc extends Exchange {
92
107
  'fetchOrderBooks': undefined,
93
108
  'fetchOrders': true,
94
109
  'fetchOrderTrades': true,
95
- 'fetchPosition': true,
110
+ 'fetchPosition': 'emulated',
96
111
  'fetchPositionHistory': 'emulated',
97
112
  'fetchPositionMode': true,
98
113
  'fetchPositions': true,
@@ -402,6 +417,8 @@ export default class mexc extends Exchange {
402
417
  },
403
418
  },
404
419
  'options': {
420
+ 'adjustForTimeDifference': false,
421
+ 'timeDifference': 0,
405
422
  'createMarketBuyOrderRequiresPrice': true,
406
423
  'unavailableContracts': {
407
424
  'BTC/USDT:USDT': true,
@@ -456,6 +473,7 @@ export default class mexc extends Exchange {
456
473
  'AVAXC': 'AVAX_CCHAIN',
457
474
  'ERC20': 'ETH',
458
475
  'ACA': 'ACALA',
476
+ 'BEP20': 'BSC',
459
477
  // 'ADA': 'Cardano(ADA)',
460
478
  // 'AE': 'AE',
461
479
  // 'ALGO': 'Algorand(ALGO)',
@@ -1017,6 +1035,9 @@ export default class mexc extends Exchange {
1017
1035
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1018
1036
  * @returns {object[]} an array of objects representing market data
1019
1037
  */
1038
+ if (this.options['adjustForTimeDifference']) {
1039
+ await this.loadTimeDifference();
1040
+ }
1020
1041
  const spotMarketPromise = this.fetchSpotMarkets(params);
1021
1042
  const swapMarketPromise = this.fetchSwapMarkets(params);
1022
1043
  const [spotMarket, swapMarket] = await Promise.all([spotMarketPromise, swapMarketPromise]);
@@ -2917,6 +2938,9 @@ export default class mexc extends Exchange {
2917
2938
  * @method
2918
2939
  * @name mexc#cancelOrder
2919
2940
  * @description cancels an open order
2941
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-order
2942
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance
2943
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-stop-limit-trigger-order-under-maintenance
2920
2944
  * @param {string} id order id
2921
2945
  * @param {string} symbol unified symbol of the market the order was made in
2922
2946
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3034,6 +3058,7 @@ export default class mexc extends Exchange {
3034
3058
  * @method
3035
3059
  * @name mexc#cancelOrders
3036
3060
  * @description cancel multiple orders
3061
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance
3037
3062
  * @param {string[]} ids order ids
3038
3063
  * @param {string} symbol unified market symbol, default is undefined
3039
3064
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4542,7 +4567,7 @@ export default class mexc extends Exchange {
4542
4567
  // 'coin': currency['id'] + network example: USDT-TRX,
4543
4568
  // 'status': 'status',
4544
4569
  // 'startTime': since, // default 90 days
4545
- // 'endTime': this.milliseconds (),
4570
+ // 'endTime': this.nonce(),
4546
4571
  // 'limit': limit, // default 1000, maximum 1000
4547
4572
  };
4548
4573
  let currency = undefined;
@@ -4602,7 +4627,7 @@ export default class mexc extends Exchange {
4602
4627
  // 'coin': currency['id'],
4603
4628
  // 'status': 'status',
4604
4629
  // 'startTime': since, // default 90 days
4605
- // 'endTime': this.milliseconds (),
4630
+ // 'endTime': this.nonce(),
4606
4631
  // 'limit': limit, // default 1000, maximum 1000
4607
4632
  };
4608
4633
  let currency = undefined;
@@ -4767,6 +4792,7 @@ export default class mexc extends Exchange {
4767
4792
  * @method
4768
4793
  * @name mexc#fetchPosition
4769
4794
  * @description fetch data on a single open contract trade position
4795
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
4770
4796
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
4771
4797
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4772
4798
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4784,6 +4810,7 @@ export default class mexc extends Exchange {
4784
4810
  * @method
4785
4811
  * @name mexc#fetchPositions
4786
4812
  * @description fetch all open positions
4813
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
4787
4814
  * @param {string[]|undefined} symbols list of unified market symbols
4788
4815
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4789
4816
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -5626,6 +5653,9 @@ export default class mexc extends Exchange {
5626
5653
  const positions = this.parsePositions(data, symbols, params);
5627
5654
  return this.filterBySinceLimit(positions, since, limit);
5628
5655
  }
5656
+ nonce() {
5657
+ return this.milliseconds() - this.safeInteger(this.options, 'timeDifference', 0);
5658
+ }
5629
5659
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
5630
5660
  const section = this.safeString(api, 0);
5631
5661
  const access = this.safeString(api, 1);
@@ -5640,7 +5670,7 @@ export default class mexc extends Exchange {
5640
5670
  }
5641
5671
  let paramsEncoded = '';
5642
5672
  if (access === 'private') {
5643
- params['timestamp'] = this.milliseconds();
5673
+ params['timestamp'] = this.nonce();
5644
5674
  params['recvWindow'] = this.safeInteger(this.options, 'recvWindow', 5000);
5645
5675
  }
5646
5676
  if (Object.keys(params).length) {
@@ -5670,7 +5700,7 @@ export default class mexc extends Exchange {
5670
5700
  }
5671
5701
  else {
5672
5702
  this.checkRequiredCredentials();
5673
- const timestamp = this.milliseconds().toString();
5703
+ const timestamp = this.nonce().toString();
5674
5704
  let auth = '';
5675
5705
  headers = {
5676
5706
  'ApiKey': this.apiKey,
package/js/src/paradex.js CHANGED
@@ -659,7 +659,7 @@ export default class paradex extends Exchange {
659
659
  'low': undefined,
660
660
  'bid': this.safeString(ticker, 'bid'),
661
661
  'bidVolume': undefined,
662
- 'ask': this.safeString(ticker, 'sdk'),
662
+ 'ask': this.safeString(ticker, 'ask'),
663
663
  'askVolume': undefined,
664
664
  'vwap': undefined,
665
665
  'open': undefined,
@@ -3,6 +3,146 @@ import type { Int, OrderSide, OrderType, Str, Strings, Trade, OrderBook, Order,
3
3
  import Client from '../base/ws/Client.js';
4
4
  export default class binance extends binanceRest {
5
5
  describe(): any;
6
+ describeData(): {
7
+ has: {
8
+ ws: boolean;
9
+ watchBalance: boolean;
10
+ watchLiquidations: boolean;
11
+ watchLiquidationsForSymbols: boolean;
12
+ watchMyLiquidations: boolean;
13
+ watchMyLiquidationsForSymbols: boolean;
14
+ watchBidsAsks: boolean;
15
+ watchMyTrades: boolean;
16
+ watchOHLCV: boolean;
17
+ watchOHLCVForSymbols: boolean;
18
+ watchOrderBook: boolean;
19
+ watchOrderBookForSymbols: boolean;
20
+ watchOrders: boolean;
21
+ watchOrdersForSymbols: boolean;
22
+ watchPositions: boolean;
23
+ watchTicker: boolean;
24
+ watchTickers: boolean;
25
+ watchTrades: boolean;
26
+ watchTradesForSymbols: boolean;
27
+ createOrderWs: boolean;
28
+ editOrderWs: boolean;
29
+ cancelOrderWs: boolean;
30
+ cancelOrdersWs: boolean;
31
+ cancelAllOrdersWs: boolean;
32
+ fetchBalanceWs: boolean;
33
+ fetchDepositsWs: boolean;
34
+ fetchMarketsWs: boolean;
35
+ fetchMyTradesWs: boolean;
36
+ fetchOHLCVWs: boolean;
37
+ fetchOrderBookWs: boolean;
38
+ fetchOpenOrdersWs: boolean;
39
+ fetchOrderWs: boolean;
40
+ fetchOrdersWs: boolean;
41
+ fetchPositionWs: boolean;
42
+ fetchPositionForSymbolWs: boolean;
43
+ fetchPositionsWs: boolean;
44
+ fetchTickerWs: boolean;
45
+ fetchTradesWs: boolean;
46
+ fetchTradingFeesWs: boolean;
47
+ fetchWithdrawalsWs: boolean;
48
+ };
49
+ urls: {
50
+ test: {
51
+ ws: {
52
+ spot: string;
53
+ margin: string;
54
+ future: string;
55
+ delivery: string;
56
+ 'ws-api': {
57
+ spot: string;
58
+ future: string;
59
+ };
60
+ };
61
+ };
62
+ api: {
63
+ ws: {
64
+ spot: string;
65
+ margin: string;
66
+ future: string;
67
+ delivery: string;
68
+ 'ws-api': {
69
+ spot: string;
70
+ future: string;
71
+ };
72
+ papi: string;
73
+ };
74
+ };
75
+ doc: string;
76
+ };
77
+ streaming: {
78
+ keepAlive: number;
79
+ };
80
+ options: {
81
+ returnRateLimits: boolean;
82
+ streamLimits: {
83
+ spot: number;
84
+ margin: number;
85
+ future: number;
86
+ delivery: number;
87
+ };
88
+ subscriptionLimitByStream: {
89
+ spot: number;
90
+ margin: number;
91
+ future: number;
92
+ delivery: number;
93
+ };
94
+ streamBySubscriptionsHash: {};
95
+ streamIndex: number;
96
+ watchOrderBookRate: number;
97
+ liquidationsLimit: number;
98
+ myLiquidationsLimit: number;
99
+ tradesLimit: number;
100
+ ordersLimit: number;
101
+ OHLCVLimit: number;
102
+ requestId: {};
103
+ watchOrderBookLimit: number;
104
+ watchTrades: {
105
+ name: string;
106
+ };
107
+ watchTicker: {
108
+ name: string;
109
+ };
110
+ watchTickers: {
111
+ name: string;
112
+ };
113
+ watchOHLCV: {
114
+ name: string;
115
+ };
116
+ watchOrderBook: {
117
+ maxRetries: number;
118
+ checksum: boolean;
119
+ };
120
+ watchBalance: {
121
+ fetchBalanceSnapshot: boolean;
122
+ awaitBalanceSnapshot: boolean;
123
+ };
124
+ watchLiquidationsForSymbols: {
125
+ defaultType: string;
126
+ };
127
+ watchPositions: {
128
+ fetchPositionsSnapshot: boolean;
129
+ awaitPositionsSnapshot: boolean;
130
+ };
131
+ wallet: string;
132
+ listenKeyRefreshRate: number;
133
+ ws: {
134
+ cost: number;
135
+ };
136
+ tickerChannelsMap: {
137
+ '24hrTicker': string;
138
+ '24hrMiniTicker': string;
139
+ '1hTicker': string;
140
+ '4hTicker': string;
141
+ '1dTicker': string;
142
+ bookTicker: string;
143
+ };
144
+ };
145
+ };
6
146
  requestId(url: any): any;
7
147
  stream(type: Str, subscriptionHash: Str, numSubscriptions?: number): string;
8
148
  watchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
@@ -16,7 +16,11 @@ import { ed25519 } from '../static_dependencies/noble-curves/ed25519.js';
16
16
  // -----------------------------------------------------------------------------
17
17
  export default class binance extends binanceRest {
18
18
  describe() {
19
- return this.deepExtend(super.describe(), {
19
+ const superDescribe = super.describe();
20
+ return this.deepExtend(superDescribe, this.describeData());
21
+ }
22
+ describeData() {
23
+ return {
20
24
  'has': {
21
25
  'ws': true,
22
26
  'watchBalance': true,
@@ -158,7 +162,7 @@ export default class binance extends binanceRest {
158
162
  'bookTicker': 'bookTicker',
159
163
  },
160
164
  },
161
- });
165
+ };
162
166
  }
163
167
  requestId(url) {
164
168
  const options = this.safeDict(this.options, 'requestId', this.createSafeDictionary());
@@ -13,7 +13,8 @@ export default class binanceus extends binance {
13
13
  // eslint-disable-next-line new-cap
14
14
  const restInstance = new binanceusRest();
15
15
  const restDescribe = restInstance.describe();
16
- const extended = this.deepExtend(restDescribe, super.describe());
16
+ const parentWsDescribe = super.describeData();
17
+ const extended = this.deepExtend(restDescribe, parentWsDescribe);
17
18
  return this.deepExtend(extended, {
18
19
  'id': 'binanceus',
19
20
  'name': 'Binance US',
package/js/src/pro/htx.js CHANGED
@@ -135,6 +135,8 @@ export default class htx extends htxRest {
135
135
  * @method
136
136
  * @name huobi#watchTicker
137
137
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
138
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53561-7773-11ed-9966-0242ac110003
139
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c33ab2-77ae-11ed-9966-0242ac110003
138
140
  * @param {string} symbol unified symbol of the market to fetch the ticker for
139
141
  * @param {object} [params] extra parameters specific to the exchange API endpoint
140
142
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -203,6 +205,9 @@ export default class htx extends htxRest {
203
205
  * @method
204
206
  * @name huobi#watchTrades
205
207
  * @description get the list of most recent trades for a particular symbol
208
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53b69-7773-11ed-9966-0242ac110003
209
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c33c21-77ae-11ed-9966-0242ac110003
210
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c33cfe-77ae-11ed-9966-0242ac110003
206
211
  * @param {string} symbol unified symbol of the market to fetch trades for
207
212
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
208
213
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -266,6 +271,9 @@ export default class htx extends htxRest {
266
271
  * @method
267
272
  * @name huobi#watchOHLCV
268
273
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
274
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53241-7773-11ed-9966-0242ac110003
275
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c3346a-77ae-11ed-9966-0242ac110003
276
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c33563-77ae-11ed-9966-0242ac110003
269
277
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
270
278
  * @param {string} timeframe the length of time each candle represents
271
279
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -672,6 +680,7 @@ export default class htx extends htxRest {
672
680
  * @method
673
681
  * @name huobi#watchMyTrades
674
682
  * @description watches information on multiple trades made by the user
683
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53dd5-7773-11ed-9966-0242ac110003
675
684
  * @param {string} symbol unified market symbol of the market trades were made in
676
685
  * @param {int} [since] the earliest time in ms to fetch trades for
677
686
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -775,6 +784,7 @@ export default class htx extends htxRest {
775
784
  * @method
776
785
  * @name huobi#watchOrders
777
786
  * @description watches information on multiple orders made by the user
787
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec53c8f-7773-11ed-9966-0242ac110003
778
788
  * @param {string} symbol unified market symbol of the market orders were made in
779
789
  * @param {int} [since] the earliest time in ms to fetch orders for
780
790
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1349,6 +1359,10 @@ export default class htx extends htxRest {
1349
1359
  * @method
1350
1360
  * @name huobi#watchBalance
1351
1361
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
1362
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=7ec52e28-7773-11ed-9966-0242ac110003
1363
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=10000084-77b7-11ed-9966-0242ac110003
1364
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb7dcca-77b5-11ed-9966-0242ac110003
1365
+ * @see https://www.htx.com/en-us/opend/newApiPages/?id=28c34995-77ae-11ed-9966-0242ac110003
1352
1366
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1353
1367
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1354
1368
  */
@@ -9,6 +9,7 @@ export default class hyperliquid extends hyperliquidRest {
9
9
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
10
10
  unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
11
11
  handleOrderBook(client: any, message: any): void;
12
+ watchTicker(symbol: string, params?: {}): Promise<Ticker>;
12
13
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
14
  unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
14
15
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -22,7 +22,7 @@ export default class hyperliquid extends hyperliquidRest {
22
22
  'watchOHLCV': true,
23
23
  'watchOrderBook': true,
24
24
  'watchOrders': true,
25
- 'watchTicker': false,
25
+ 'watchTicker': true,
26
26
  'watchTickers': true,
27
27
  'watchTrades': true,
28
28
  'watchTradesForSymbols': false,
@@ -238,6 +238,21 @@ export default class hyperliquid extends hyperliquidRest {
238
238
  const messageHash = 'orderbook:' + symbol;
239
239
  client.resolve(orderbook, messageHash);
240
240
  }
241
+ async watchTicker(symbol, params = {}) {
242
+ /**
243
+ * @method
244
+ * @name hyperliquid#watchTicker
245
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
246
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
247
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
248
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
249
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
250
+ */
251
+ const market = this.market(symbol);
252
+ symbol = market['symbol'];
253
+ const tickers = await this.watchTickers([symbol], params);
254
+ return tickers[symbol];
255
+ }
241
256
  async watchTickers(symbols = undefined, params = {}) {
242
257
  /**
243
258
  * @method
@@ -18,6 +18,9 @@ export default class kraken extends krakenRest {
18
18
  watchPublic(name: any, symbol: any, params?: {}): Promise<any>;
19
19
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
20
20
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
21
+ watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
22
+ handleBidAsk(client: Client, message: any, subscription: any): void;
23
+ parseWsBidAsk(ticker: any, market?: any): Ticker;
21
24
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
22
25
  watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
23
26
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
@@ -23,6 +23,7 @@ export default class kraken extends krakenRest {
23
23
  'watchOrders': true,
24
24
  'watchTicker': true,
25
25
  'watchTickers': true,
26
+ 'watchBidsAsks': true,
26
27
  'watchTrades': true,
27
28
  'watchTradesForSymbols': true,
28
29
  'createOrderWs': true,
@@ -499,6 +500,64 @@ export default class kraken extends krakenRest {
499
500
  }
500
501
  return this.filterByArray(this.tickers, 'symbol', symbols);
501
502
  }
503
+ async watchBidsAsks(symbols = undefined, params = {}) {
504
+ /**
505
+ * @method
506
+ * @name kraken#watchBidsAsks
507
+ * @see https://docs.kraken.com/api/docs/websocket-v1/spread
508
+ * @description watches best bid & ask for symbols
509
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
510
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
511
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
512
+ */
513
+ await this.loadMarkets();
514
+ symbols = this.marketSymbols(symbols, undefined, false);
515
+ const ticker = await this.watchMultiHelper('bidask', 'spread', symbols, undefined, params);
516
+ if (this.newUpdates) {
517
+ const result = {};
518
+ result[ticker['symbol']] = ticker;
519
+ return result;
520
+ }
521
+ return this.filterByArray(this.bidsasks, 'symbol', symbols);
522
+ }
523
+ handleBidAsk(client, message, subscription) {
524
+ //
525
+ // [
526
+ // 7208974, // channelID
527
+ // [
528
+ // "63758.60000", // bid
529
+ // "63759.10000", // ask
530
+ // "1726814731.089778", // timestamp
531
+ // "0.00057917", // bid_volume
532
+ // "0.15681688" // ask_volume
533
+ // ],
534
+ // "spread",
535
+ // "XBT/USDT"
536
+ // ]
537
+ //
538
+ const parsedTicker = this.parseWsBidAsk(message);
539
+ const symbol = parsedTicker['symbol'];
540
+ this.bidsasks[symbol] = parsedTicker;
541
+ const messageHash = this.getMessageHash('bidask', undefined, symbol);
542
+ client.resolve(parsedTicker, messageHash);
543
+ }
544
+ parseWsBidAsk(ticker, market = undefined) {
545
+ const data = this.safeList(ticker, 1, []);
546
+ const marketId = this.safeString(ticker, 3);
547
+ market = this.safeValue(this.options['marketsByWsName'], marketId);
548
+ const symbol = this.safeString(market, 'symbol');
549
+ const timestamp = this.parseToInt(this.safeInteger(data, 2)) * 1000;
550
+ return this.safeTicker({
551
+ 'symbol': symbol,
552
+ 'timestamp': timestamp,
553
+ 'datetime': this.iso8601(timestamp),
554
+ 'ask': this.safeString(data, 1),
555
+ 'askVolume': this.safeString(data, 4),
556
+ 'bid': this.safeString(data, 0),
557
+ 'bidVolume': this.safeString(data, 3),
558
+ 'info': ticker,
559
+ }, market);
560
+ }
502
561
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
503
562
  /**
504
563
  * @method
@@ -1493,6 +1552,7 @@ export default class kraken extends krakenRest {
1493
1552
  'book': this.handleOrderBook,
1494
1553
  'ohlc': this.handleOHLCV,
1495
1554
  'ticker': this.handleTicker,
1555
+ 'spread': this.handleBidAsk,
1496
1556
  'trade': this.handleTrades,
1497
1557
  // private
1498
1558
  'openOrders': this.handleOrders,
@@ -224,6 +224,7 @@ export default class paradex extends paradexRest {
224
224
  * @method
225
225
  * @name paradex#watchTickers
226
226
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
227
+ * @see https://docs.api.testnet.paradex.trade/#sub-markets_summary-operation
227
228
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
228
229
  * @param {object} [params] extra parameters specific to the exchange API endpoint
229
230
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -15,7 +15,7 @@ export declare class BigInteger {
15
15
  protected intValue(): number;
16
16
  protected byteValue(): number;
17
17
  protected shortValue(): number;
18
- protected signum(): 0 | 1 | -1;
18
+ protected signum(): 1 | 0 | -1;
19
19
  toByteArray(): number[];
20
20
  protected equals(a: BigInteger): boolean;
21
21
  protected min(a: BigInteger): BigInteger;
@@ -1,5 +1,5 @@
1
1
  import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
2
2
  import { AbiParserInterface } from './interface.js';
3
3
  export declare function createAbiParser(abi: Abi): AbiParserInterface;
4
- export declare function getAbiVersion(abi: Abi): 0 | 1 | 2;
4
+ export declare function getAbiVersion(abi: Abi): 1 | 0 | 2;
5
5
  export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.4.4",
3
+ "version": "4.4.6",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",