ccxt 4.2.49 → 4.2.51

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.
@@ -243,6 +243,9 @@ interface binance {
243
243
  sapiGetSimpleEarnFlexibleHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
244
244
  sapiGetSimpleEarnLockedHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
245
245
  sapiGetSimpleEarnFlexibleHistoryCollateralRecord(params?: {}): Promise<implicitReturnType>;
246
+ sapiGetDciProductList(params?: {}): Promise<implicitReturnType>;
247
+ sapiGetDciProductPositions(params?: {}): Promise<implicitReturnType>;
248
+ sapiGetDciProductAccounts(params?: {}): Promise<implicitReturnType>;
246
249
  sapiPostAssetDust(params?: {}): Promise<implicitReturnType>;
247
250
  sapiPostAssetDustBtc(params?: {}): Promise<implicitReturnType>;
248
251
  sapiPostAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -357,6 +360,8 @@ interface binance {
357
360
  sapiPostSimpleEarnLockedRedeem(params?: {}): Promise<implicitReturnType>;
358
361
  sapiPostSimpleEarnFlexibleSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
359
362
  sapiPostSimpleEarnLockedSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
363
+ sapiPostDciProductSubscribe(params?: {}): Promise<implicitReturnType>;
364
+ sapiPostDciProductAutoCompoundEdit(params?: {}): Promise<implicitReturnType>;
360
365
  sapiPutUserDataStream(params?: {}): Promise<implicitReturnType>;
361
366
  sapiPutUserDataStreamIsolated(params?: {}): Promise<implicitReturnType>;
362
367
  sapiDeleteMarginOpenOrders(params?: {}): Promise<implicitReturnType>;
@@ -243,6 +243,9 @@ interface binance {
243
243
  sapiGetSimpleEarnFlexibleHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
244
244
  sapiGetSimpleEarnLockedHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
245
245
  sapiGetSimpleEarnFlexibleHistoryCollateralRecord(params?: {}): Promise<implicitReturnType>;
246
+ sapiGetDciProductList(params?: {}): Promise<implicitReturnType>;
247
+ sapiGetDciProductPositions(params?: {}): Promise<implicitReturnType>;
248
+ sapiGetDciProductAccounts(params?: {}): Promise<implicitReturnType>;
246
249
  sapiGetAssetAssetDistributionHistory(params?: {}): Promise<implicitReturnType>;
247
250
  sapiGetAssetQueryTradingFee(params?: {}): Promise<implicitReturnType>;
248
251
  sapiGetAssetQueryTradingVolume(params?: {}): Promise<implicitReturnType>;
@@ -388,6 +391,8 @@ interface binance {
388
391
  sapiPostSimpleEarnLockedRedeem(params?: {}): Promise<implicitReturnType>;
389
392
  sapiPostSimpleEarnFlexibleSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
390
393
  sapiPostSimpleEarnLockedSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
394
+ sapiPostDciProductSubscribe(params?: {}): Promise<implicitReturnType>;
395
+ sapiPostDciProductAutoCompoundEdit(params?: {}): Promise<implicitReturnType>;
391
396
  sapiPostOtcQuotes(params?: {}): Promise<implicitReturnType>;
392
397
  sapiPostOtcOrders(params?: {}): Promise<implicitReturnType>;
393
398
  sapiPostFiatpaymentWithdrawApply(params?: {}): Promise<implicitReturnType>;
@@ -243,6 +243,9 @@ interface binance {
243
243
  sapiGetSimpleEarnFlexibleHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
244
244
  sapiGetSimpleEarnLockedHistoryRewardsRecord(params?: {}): Promise<implicitReturnType>;
245
245
  sapiGetSimpleEarnFlexibleHistoryCollateralRecord(params?: {}): Promise<implicitReturnType>;
246
+ sapiGetDciProductList(params?: {}): Promise<implicitReturnType>;
247
+ sapiGetDciProductPositions(params?: {}): Promise<implicitReturnType>;
248
+ sapiGetDciProductAccounts(params?: {}): Promise<implicitReturnType>;
246
249
  sapiPostAssetDust(params?: {}): Promise<implicitReturnType>;
247
250
  sapiPostAssetDustBtc(params?: {}): Promise<implicitReturnType>;
248
251
  sapiPostAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -357,6 +360,8 @@ interface binance {
357
360
  sapiPostSimpleEarnLockedRedeem(params?: {}): Promise<implicitReturnType>;
358
361
  sapiPostSimpleEarnFlexibleSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
359
362
  sapiPostSimpleEarnLockedSetAutoSubscribe(params?: {}): Promise<implicitReturnType>;
363
+ sapiPostDciProductSubscribe(params?: {}): Promise<implicitReturnType>;
364
+ sapiPostDciProductAutoCompoundEdit(params?: {}): Promise<implicitReturnType>;
360
365
  sapiPutUserDataStream(params?: {}): Promise<implicitReturnType>;
361
366
  sapiPutUserDataStreamIsolated(params?: {}): Promise<implicitReturnType>;
362
367
  sapiDeleteMarginOpenOrders(params?: {}): Promise<implicitReturnType>;
@@ -690,6 +690,7 @@ export default class Exchange {
690
690
  safeCurrencyStructure(currency: object): any;
691
691
  safeMarketStructure(market?: any): MarketInterface;
692
692
  setMarkets(markets: any, currencies?: any): Dictionary<any>;
693
+ getDescribeForExtendedWsExchange(currentRestInstance: any, parentRestInstance: any, wsBaseDescribe: Dictionary<any>): any;
693
694
  safeBalance(balance: object): Balances;
694
695
  safeOrder(order: object, market?: Market): Order;
695
696
  parseOrders(orders: object, market?: Market, since?: Int, limit?: Int, params?: {}): Order[];
@@ -2259,6 +2259,11 @@ export default class Exchange {
2259
2259
  this.codes = Object.keys(currenciesSortedByCode);
2260
2260
  return this.markets;
2261
2261
  }
2262
+ getDescribeForExtendedWsExchange(currentRestInstance, parentRestInstance, wsBaseDescribe) {
2263
+ const extendedRestDescribe = this.deepExtend(parentRestInstance.describe(), currentRestInstance.describe());
2264
+ const superWithRestDescribe = this.deepExtend(extendedRestDescribe, wsBaseDescribe);
2265
+ return superWithRestDescribe;
2266
+ }
2262
2267
  safeBalance(balance) {
2263
2268
  const balances = this.omit(balance, ['info', 'timestamp', 'datetime', 'free', 'used', 'total']);
2264
2269
  const codes = Object.keys(balances);
package/js/src/binance.js CHANGED
@@ -49,6 +49,7 @@ export default class binance extends Exchange {
49
49
  'createMarketSellOrderWithCost': true,
50
50
  'createOrder': true,
51
51
  'createOrders': true,
52
+ 'createOrderWithTakeProfitAndStopLoss': true,
52
53
  'createPostOnlyOrder': true,
53
54
  'createReduceOnlyOrder': true,
54
55
  'createStopLimitOrder': true,
@@ -122,7 +123,7 @@ export default class binance extends Exchange {
122
123
  'fetchTradingFee': true,
123
124
  'fetchTradingFees': true,
124
125
  'fetchTradingLimits': undefined,
125
- 'fetchTransactionFee': undefined,
126
+ 'fetchTransactionFee': 'emulated',
126
127
  'fetchTransactionFees': true,
127
128
  'fetchTransactions': false,
128
129
  'fetchTransfers': true,
@@ -474,6 +475,10 @@ export default class binance extends Exchange {
474
475
  'simple-earn/flexible/history/rewardsRecord': 15,
475
476
  'simple-earn/locked/history/rewardsRecord': 15,
476
477
  'simple-earn/flexible/history/collateralRecord': 0.1,
478
+ // Convert
479
+ 'dci/product/list': 0.1,
480
+ 'dci/product/positions': 0.1,
481
+ 'dci/product/accounts': 0.1,
477
482
  },
478
483
  'post': {
479
484
  'asset/dust': 0.06667,
@@ -602,6 +607,9 @@ export default class binance extends Exchange {
602
607
  'simple-earn/locked/redeem': 0.1,
603
608
  'simple-earn/flexible/setAutoSubscribe': 15,
604
609
  'simple-earn/locked/setAutoSubscribe': 15,
610
+ // convert
611
+ 'dci/product/subscribe': 0.1,
612
+ 'dci/product/auto_compound/edit': 0.1,
605
613
  },
606
614
  'put': {
607
615
  'userDataStream': 0.1,
package/js/src/bl3p.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bl3p.js';
2
- import type { Balances, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, IndexType } from './base/types.js';
2
+ import type { Balances, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, IndexType, Currency } from './base/types.js';
3
3
  /**
4
4
  * @class bl3p
5
5
  * @augments Exchange
@@ -17,6 +17,20 @@ export default class bl3p extends Exchange {
17
17
  fetchTradingFees(params?: {}): Promise<{}>;
18
18
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<import("./base/types.js").Order>;
19
19
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
20
+ createDepositAddress(code: string, params?: {}): Promise<{
21
+ info: any;
22
+ currency: string;
23
+ address: string;
24
+ tag: any;
25
+ network: any;
26
+ }>;
27
+ parseDepositAddress(depositAddress: any, currency?: Currency): {
28
+ info: any;
29
+ currency: string;
30
+ address: string;
31
+ tag: any;
32
+ network: any;
33
+ };
20
34
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
21
35
  url: string;
22
36
  method: string;
package/js/src/bl3p.js CHANGED
@@ -35,6 +35,7 @@ export default class bl3p extends Exchange {
35
35
  'cancelOrder': true,
36
36
  'closeAllPositions': false,
37
37
  'closePosition': false,
38
+ 'createDepositAddress': true,
38
39
  'createOrder': true,
39
40
  'createReduceOnlyOrder': false,
40
41
  'createStopLimitOrder': false,
@@ -45,6 +46,9 @@ export default class bl3p extends Exchange {
45
46
  'fetchBorrowRateHistory': false,
46
47
  'fetchCrossBorrowRate': false,
47
48
  'fetchCrossBorrowRates': false,
49
+ 'fetchDepositAddress': false,
50
+ 'fetchDepositAddresses': false,
51
+ 'fetchDepositAddressesByNetwork': false,
48
52
  'fetchFundingHistory': false,
49
53
  'fetchFundingRate': false,
50
54
  'fetchFundingRateHistory': false,
@@ -426,6 +430,49 @@ export default class bl3p extends Exchange {
426
430
  };
427
431
  return await this.privatePostMarketMoneyOrderCancel(this.extend(request, params));
428
432
  }
433
+ async createDepositAddress(code, params = {}) {
434
+ /**
435
+ * @method
436
+ * @name bl3p#createDepositAddress
437
+ * @description create a currency deposit address
438
+ * @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#32---create-a-new-deposit-address
439
+ * @param {string} code unified currency code of the currency for the deposit address
440
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
441
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
442
+ */
443
+ await this.loadMarkets();
444
+ const currency = this.currency(code);
445
+ const request = {
446
+ 'currency': currency['id'],
447
+ };
448
+ const response = await this.privatePostGENMKTMoneyNewDepositAddress(this.extend(request, params));
449
+ //
450
+ // {
451
+ // "result": "success",
452
+ // "data": {
453
+ // "address": "36Udu9zi1uYicpXcJpoKfv3bewZeok5tpk"
454
+ // }
455
+ // }
456
+ //
457
+ const data = this.safeDict(response, 'data');
458
+ return this.parseDepositAddress(data, currency);
459
+ }
460
+ parseDepositAddress(depositAddress, currency = undefined) {
461
+ //
462
+ // {
463
+ // "address": "36Udu9zi1uYicpXcJpoKfv3bewZeok5tpk"
464
+ // }
465
+ //
466
+ const address = this.safeString(depositAddress, 'address');
467
+ this.checkAddress(address);
468
+ return {
469
+ 'info': depositAddress,
470
+ 'currency': this.safeString(currency, 'code'),
471
+ 'address': address,
472
+ 'tag': undefined,
473
+ 'network': undefined,
474
+ };
475
+ }
429
476
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
430
477
  const request = this.implodeParams(path, params);
431
478
  let url = this.urls['api']['rest'] + '/' + this.version + '/' + request;
package/js/src/mexc.js CHANGED
@@ -892,6 +892,7 @@ export default class mexc extends Exchange {
892
892
  '700006': BadRequest,
893
893
  '700007': AuthenticationError,
894
894
  '700008': BadRequest,
895
+ '700013': AuthenticationError,
895
896
  '730001': BadRequest,
896
897
  '730002': BadRequest,
897
898
  '730000': ExchangeError,
@@ -5424,7 +5425,7 @@ export default class mexc extends Exchange {
5424
5425
  'source': this.safeString(this.options, 'broker', 'CCXT'),
5425
5426
  };
5426
5427
  }
5427
- if (method === 'POST') {
5428
+ if ((method === 'POST') || (method === 'PUT')) {
5428
5429
  headers['Content-Type'] = 'application/json';
5429
5430
  }
5430
5431
  }
package/js/src/okx.js CHANGED
@@ -5471,7 +5471,7 @@ export default class okx extends Exchange {
5471
5471
  const liquidationPrice = this.safeNumber(position, 'liqPx');
5472
5472
  const percentageString = this.safeString(position, 'uplRatio');
5473
5473
  const percentage = this.parseNumber(Precise.stringMul(percentageString, '100'));
5474
- const timestamp = this.safeInteger(position, 'uTime');
5474
+ const timestamp = this.safeInteger(position, 'cTime');
5475
5475
  const marginRatio = this.parseNumber(Precise.stringDiv(maintenanceMarginString, collateralString, 4));
5476
5476
  return this.safePosition({
5477
5477
  'info': position,
@@ -6,15 +6,14 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import hitbtc from './hitbtc.js';
9
+ import hitbtcRest from '../hitbtc.js';
9
10
  import bequantRest from '../bequant.js';
10
11
  // ---------------------------------------------------------------------------
11
12
  export default class bequant extends hitbtc {
12
13
  describe() {
13
14
  // eslint-disable-next-line new-cap
14
- const restInstance = new bequantRest();
15
- const restDescribe = restInstance.describe();
16
- const extended = this.deepExtend(super.describe(), restDescribe);
17
- return this.deepExtend(extended, {
15
+ const describeExtended = this.getDescribeForExtendedWsExchange(new bequantRest(), new hitbtcRest(), super.describe());
16
+ return this.deepExtend(describeExtended, {
18
17
  'id': 'bequant',
19
18
  'name': 'Bequant',
20
19
  'countries': ['MT'],
@@ -44,6 +44,7 @@ export default class binance extends binanceRest {
44
44
  cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<any>;
45
45
  fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
46
46
  fetchOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
47
+ fetchClosedOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
47
48
  fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
48
49
  watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
49
50
  parseWsOrder(order: any, market?: any): Order;
@@ -37,10 +37,15 @@ export default class binance extends binanceRest {
37
37
  'cancelOrderWs': true,
38
38
  'cancelOrdersWs': false,
39
39
  'cancelAllOrdersWs': true,
40
- 'fetchOrderWs': true,
41
- 'fetchOrdersWs': true,
42
40
  'fetchBalanceWs': true,
41
+ 'fetchDepositsWs': false,
42
+ 'fetchMarketsWs': false,
43
43
  'fetchMyTradesWs': true,
44
+ 'fetchOpenOrdersWs': true,
45
+ 'fetchOrderWs': true,
46
+ 'fetchOrdersWs': true,
47
+ 'fetchTradingFeesWs': false,
48
+ 'fetchWithdrawalsWs': false,
44
49
  },
45
50
  'urls': {
46
51
  'test': {
@@ -1941,6 +1946,28 @@ export default class binance extends binanceRest {
1941
1946
  const orders = await this.watch(url, messageHash, message, messageHash, subscription);
1942
1947
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
1943
1948
  }
1949
+ async fetchClosedOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1950
+ /**
1951
+ * @method
1952
+ * @name binance#fetchClosedOrdersWs
1953
+ * @see https://binance-docs.github.io/apidocs/websocket_api/en/#account-order-history-user_data
1954
+ * @description fetch closed orders
1955
+ * @param {string} symbol unified market symbol
1956
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1957
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1958
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1959
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1960
+ */
1961
+ const orders = await this.fetchOrdersWs(symbol, since, limit, params);
1962
+ const closedOrders = [];
1963
+ for (let i = 0; i < orders.length; i++) {
1964
+ const order = orders[i];
1965
+ if (order['status'] === 'closed') {
1966
+ closedOrders.push(order);
1967
+ }
1968
+ }
1969
+ return closedOrders;
1970
+ }
1944
1971
  async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1945
1972
  /**
1946
1973
  * @method
@@ -6,15 +6,14 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import hitbtc from './hitbtc.js';
9
- import bequantRest from '../bequant.js';
9
+ import hitbtcRest from '../hitbtc.js';
10
+ import bitcoincomRest from '../bitcoincom.js';
10
11
  // ---------------------------------------------------------------------------
11
12
  export default class bitcoincom extends hitbtc {
12
13
  describe() {
13
14
  // eslint-disable-next-line new-cap
14
- const restInstance = new bequantRest();
15
- const restDescribe = restInstance.describe();
16
- const extended = this.deepExtend(super.describe(), restDescribe);
17
- return this.deepExtend(extended, {
15
+ const describeExtended = this.getDescribeForExtendedWsExchange(new bitcoincomRest(), new hitbtcRest(), super.describe());
16
+ return this.deepExtend(describeExtended, {
18
17
  'id': 'bitcoincom',
19
18
  'name': 'bitcoin.com',
20
19
  'countries': ['KN'],
@@ -1,5 +1,5 @@
1
1
  import geminiRest from '../gemini.js';
2
- import type { Int, Str, OrderBook, Order, Trade, OHLCV } from '../base/types.js';
2
+ import type { Int, Str, OrderBook, Order, Trade, OHLCV, Tickers } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
4
  export default class gemini extends geminiRest {
5
5
  describe(): any;
@@ -14,6 +14,8 @@ export default class gemini extends geminiRest {
14
14
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
15
15
  handleOrderBook(client: Client, message: any): void;
16
16
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
17
+ watchBidsAsks(symbols: string[], limit?: Int, params?: {}): Promise<Tickers>;
18
+ handleBidsAsksForMultidata(client: Client, rawBidAskChanges: any, timestamp: Int, nonce: Int): void;
17
19
  helperForWatchMultipleConstruct(itemHashName: string, symbols: string[], params?: {}): Promise<any>;
18
20
  handleOrderBookForMultidata(client: Client, rawOrderBookChanges: any, timestamp: Int, nonce: Int): void;
19
21
  handleL2Updates(client: Client, message: any): void;
@@ -18,6 +18,7 @@ export default class gemini extends geminiRest {
18
18
  'watchBalance': false,
19
19
  'watchTicker': false,
20
20
  'watchTickers': false,
21
+ 'watchBidsAsks': true,
21
22
  'watchTrades': true,
22
23
  'watchTradesForSymbols': true,
23
24
  'watchMyTrades': false,
@@ -417,6 +418,79 @@ export default class gemini extends geminiRest {
417
418
  const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
418
419
  return orderbook.limit();
419
420
  }
421
+ async watchBidsAsks(symbols, limit = undefined, params = {}) {
422
+ /**
423
+ * @method
424
+ * @name gemini#watchBidsAsks
425
+ * @description watches best bid & ask for symbols
426
+ * @see https://docs.gemini.com/websocket-api/#multi-market-data
427
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
428
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
429
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
430
+ */
431
+ return await this.helperForWatchMultipleConstruct('bidsasks', symbols, params);
432
+ }
433
+ handleBidsAsksForMultidata(client, rawBidAskChanges, timestamp, nonce) {
434
+ //
435
+ // {
436
+ // eventId: '1683002916916153',
437
+ // events: [
438
+ // {
439
+ // price: '50945.37',
440
+ // reason: 'top-of-book',
441
+ // remaining: '0.0',
442
+ // side: 'bid',
443
+ // symbol: 'BTCUSDT',
444
+ // type: 'change'
445
+ // },
446
+ // {
447
+ // price: '50947.75',
448
+ // reason: 'top-of-book',
449
+ // remaining: '0.11725',
450
+ // side: 'bid',
451
+ // symbol: 'BTCUSDT',
452
+ // type: 'change'
453
+ // }
454
+ // ],
455
+ // socket_sequence: 322,
456
+ // timestamp: 1708674495,
457
+ // timestampms: 1708674495174,
458
+ // type: 'update'
459
+ // }
460
+ //
461
+ const marketId = rawBidAskChanges[0]['symbol'];
462
+ const market = this.safeMarket(marketId.toLowerCase());
463
+ const symbol = market['symbol'];
464
+ if (!(symbol in this.bidsasks)) {
465
+ this.bidsasks[symbol] = this.parseTicker({});
466
+ this.bidsasks[symbol]['symbol'] = symbol;
467
+ }
468
+ const currentBidAsk = this.bidsasks[symbol];
469
+ const messageHash = 'bidsasks:' + symbol;
470
+ // last update always overwrites the previous state and is the latest state
471
+ for (let i = 0; i < rawBidAskChanges.length; i++) {
472
+ const entry = rawBidAskChanges[i];
473
+ const rawSide = this.safeString(entry, 'side');
474
+ const price = this.safeNumber(entry, 'price');
475
+ const size = this.safeNumber(entry, 'remaining');
476
+ if (size === 0) {
477
+ continue;
478
+ }
479
+ if (rawSide === 'bid') {
480
+ currentBidAsk['bid'] = price;
481
+ currentBidAsk['bidVolume'] = size;
482
+ }
483
+ else {
484
+ currentBidAsk['ask'] = price;
485
+ currentBidAsk['askVolume'] = size;
486
+ }
487
+ }
488
+ currentBidAsk['timestamp'] = timestamp;
489
+ currentBidAsk['datetime'] = this.iso8601(timestamp);
490
+ currentBidAsk['info'] = rawBidAskChanges;
491
+ this.bidsasks[symbol] = currentBidAsk;
492
+ client.resolve(currentBidAsk, messageHash);
493
+ }
420
494
  async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
421
495
  await this.loadMarkets();
422
496
  symbols = this.marketSymbols(symbols, undefined, false, true, true);
@@ -438,6 +512,9 @@ export default class gemini extends geminiRest {
438
512
  if (itemHashName === 'orderbook') {
439
513
  url += 'trades=false&bids=true&offers=true';
440
514
  }
515
+ else if (itemHashName === 'bidsasks') {
516
+ url += 'trades=false&bids=true&offers=true&top_of_book=true';
517
+ }
441
518
  else if (itemHashName === 'trades') {
442
519
  url += 'trades=true&bids=false&offers=false';
443
520
  }
@@ -780,18 +857,29 @@ export default class gemini extends geminiRest {
780
857
  const eventId = this.safeInteger(message, 'eventId');
781
858
  const events = this.safeList(message, 'events');
782
859
  const orderBookItems = [];
860
+ const bidaskItems = [];
783
861
  const collectedEventsOfTrades = [];
862
+ const eventsLength = events.length;
784
863
  for (let i = 0; i < events.length; i++) {
785
864
  const event = events[i];
786
865
  const eventType = this.safeString(event, 'type');
787
866
  const isOrderBook = (eventType === 'change') && ('side' in event) && this.inArray(event['side'], ['ask', 'bid']);
788
- if (isOrderBook) {
867
+ const eventReason = this.safeString(event, 'reason');
868
+ const isBidAsk = (eventReason === 'top-of-book') || (isOrderBook && (eventReason === 'initial') && eventsLength === 2);
869
+ if (isBidAsk) {
870
+ bidaskItems.push(event);
871
+ }
872
+ else if (isOrderBook) {
789
873
  orderBookItems.push(event);
790
874
  }
791
875
  else if (eventType === 'trade') {
792
876
  collectedEventsOfTrades.push(events[i]);
793
877
  }
794
878
  }
879
+ const lengthBa = bidaskItems.length;
880
+ if (lengthBa > 0) {
881
+ this.handleBidsAsksForMultidata(client, bidaskItems, ts, eventId);
882
+ }
795
883
  const lengthOb = orderBookItems.length;
796
884
  if (lengthOb > 0) {
797
885
  this.handleOrderBookForMultidata(client, orderBookItems, ts, eventId);
@@ -166,6 +166,7 @@ export default class whitebit extends whitebitRest {
166
166
  // "params":[
167
167
  // true,
168
168
  // {
169
+ // "timestamp": 1708679568.940867,
169
170
  // "asks":[
170
171
  // [ "21252.45","0.01957"],
171
172
  // ["21252.55","0.126205"],
@@ -202,14 +203,14 @@ export default class whitebit extends whitebitRest {
202
203
  const market = this.safeMarket(marketId);
203
204
  const symbol = market['symbol'];
204
205
  const data = this.safeValue(params, 1);
205
- let orderbook = undefined;
206
- if (symbol in this.orderbooks) {
207
- orderbook = this.orderbooks[symbol];
208
- }
209
- else {
210
- orderbook = this.orderBook();
211
- this.orderbooks[symbol] = orderbook;
212
- }
206
+ const timestamp = this.safeTimestamp(data, 'timestamp');
207
+ if (!(symbol in this.orderbooks)) {
208
+ const ob = this.orderBook();
209
+ this.orderbooks[symbol] = ob;
210
+ }
211
+ const orderbook = this.orderbooks[symbol];
212
+ orderbook['timestamp'] = timestamp;
213
+ orderbook['datetime'] = this.iso8601(timestamp);
213
214
  if (isSnapshot) {
214
215
  const snapshot = this.parseOrderBook(data, symbol);
215
216
  orderbook.reset(snapshot);
package/js/src/timex.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSid
6
6
  */
7
7
  export default class timex extends Exchange {
8
8
  describe(): any;
9
+ fetchTime(params?: {}): Promise<number>;
9
10
  fetchMarkets(params?: {}): Promise<import("./base/types.js").MarketInterface[]>;
10
11
  fetchCurrencies(params?: {}): Promise<{}>;
11
12
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;