ccxt 4.2.52 → 4.2.53

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
@@ -176,7 +176,7 @@ var woo$1 = require('./src/pro/woo.js');
176
176
 
177
177
  //-----------------------------------------------------------------------------
178
178
  // this is updated by vss.js when building
179
- const version = '4.2.52';
179
+ const version = '4.2.53';
180
180
  Exchange["default"].ccxtVersion = version;
181
181
  const exchanges = {
182
182
  'ace': ace,
@@ -41,13 +41,13 @@ class binance extends binance$1 {
41
41
  'closeAllPositions': false,
42
42
  'closePosition': false,
43
43
  'createDepositAddress': false,
44
- 'createMarketBuyOrderWithCost': true,
45
- 'createMarketOrderWithCost': true,
46
- 'createMarketSellOrderWithCost': true,
47
44
  'createLimitBuyOrder': true,
48
45
  'createLimitSellOrder': true,
49
46
  'createMarketBuyOrder': true,
47
+ 'createMarketBuyOrderWithCost': true,
48
+ 'createMarketOrderWithCost': true,
50
49
  'createMarketSellOrder': true,
50
+ 'createMarketSellOrderWithCost': true,
51
51
  'createOrder': true,
52
52
  'createOrders': true,
53
53
  'createOrderWithTakeProfitAndStopLoss': true,
@@ -67,6 +67,7 @@ class binance extends binance$1 {
67
67
  'fetchBorrowInterest': true,
68
68
  'fetchBorrowRateHistories': false,
69
69
  'fetchBorrowRateHistory': true,
70
+ 'fetchCanceledAndClosedOrders': 'emulated',
70
71
  'fetchCanceledOrders': 'emulated',
71
72
  'fetchClosedOrder': false,
72
73
  'fetchClosedOrders': 'emulated',
@@ -124,7 +125,7 @@ class binance extends binance$1 {
124
125
  'fetchTrades': true,
125
126
  'fetchTradingFee': true,
126
127
  'fetchTradingFees': true,
127
- 'fetchTradingLimits': undefined,
128
+ 'fetchTradingLimits': 'emulated',
128
129
  'fetchTransactionFee': 'emulated',
129
130
  'fetchTransactionFees': true,
130
131
  'fetchTransactions': false,
@@ -6823,6 +6824,38 @@ class binance extends binance$1 {
6823
6824
  const filteredOrders = this.filterBy(orders, 'status', 'canceled');
6824
6825
  return this.filterBySinceLimit(filteredOrders, since, limit);
6825
6826
  }
6827
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
6828
+ /**
6829
+ * @method
6830
+ * @name binance#fetchCanceledAndClosedOrders
6831
+ * @description fetches information on multiple canceled orders made by the user
6832
+ * @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
6833
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
6834
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
6835
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
6836
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
6837
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
6838
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
6839
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
6840
+ * @param {string} symbol unified market symbol of the market the orders were made in
6841
+ * @param {int} [since] the earliest time in ms to fetch orders for
6842
+ * @param {int} [limit] the maximum number of order structures to retrieve
6843
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6844
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6845
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
6846
+ * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
6847
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
6848
+ */
6849
+ if (symbol === undefined) {
6850
+ throw new errors.ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
6851
+ }
6852
+ const orders = await this.fetchOrders(symbol, since, undefined, params);
6853
+ const canceledOrders = this.filterBy(orders, 'status', 'canceled');
6854
+ const closedOrders = this.filterBy(orders, 'status', 'closed');
6855
+ const filteredOrders = this.arrayConcat(canceledOrders, closedOrders);
6856
+ const sortedOrders = this.sortBy(filteredOrders, 'timestamp');
6857
+ return this.filterBySinceLimit(sortedOrders, since, limit);
6858
+ }
6826
6859
  async cancelOrder(id, symbol = undefined, params = {}) {
6827
6860
  /**
6828
6861
  * @method
@@ -11994,6 +12027,19 @@ class binance extends binance$1 {
11994
12027
  'info': greeks,
11995
12028
  };
11996
12029
  }
12030
+ async fetchTradingLimits(symbols = undefined, params = {}) {
12031
+ // this method should not be called directly, use loadTradingLimits () instead
12032
+ const markets = await this.fetchMarkets();
12033
+ const tradingLimits = {};
12034
+ for (let i = 0; i < markets.length; i++) {
12035
+ const market = markets[i];
12036
+ const symbol = market['symbol'];
12037
+ if ((symbols === undefined) || (this.inArray(symbol, symbols))) {
12038
+ tradingLimits[symbol] = market['limits']['amount'];
12039
+ }
12040
+ }
12041
+ return tradingLimits;
12042
+ }
11997
12043
  async fetchPositionMode(symbol = undefined, params = {}) {
11998
12044
  /**
11999
12045
  * @method
@@ -67,6 +67,7 @@ class bingx extends bingx$1 {
67
67
  'fetchOpenOrders': true,
68
68
  'fetchOrder': true,
69
69
  'fetchOrderBook': true,
70
+ 'fetchPositionMode': true,
70
71
  'fetchPositions': true,
71
72
  'fetchTicker': true,
72
73
  'fetchTickers': true,
@@ -77,6 +78,7 @@ class bingx extends bingx$1 {
77
78
  'setLeverage': true,
78
79
  'setMargin': true,
79
80
  'setMarginMode': true,
81
+ 'setPositionMode': true,
80
82
  'transfer': true,
81
83
  },
82
84
  'hostname': 'bingx.com',
@@ -3503,13 +3505,14 @@ class bingx extends bingx$1 {
3503
3505
  * @param {float} leverage the rate of leverage
3504
3506
  * @param {string} symbol unified market symbol
3505
3507
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3508
+ * @param {string} [params.side] hedged: ['long' or 'short']. one way: ['both']
3506
3509
  * @returns {object} response from the exchange
3507
3510
  */
3508
3511
  if (symbol === undefined) {
3509
3512
  throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
3510
3513
  }
3511
3514
  const side = this.safeStringUpper(params, 'side');
3512
- this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT']);
3515
+ this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH']);
3513
3516
  await this.loadMarkets();
3514
3517
  const market = this.market(symbol);
3515
3518
  const request = {
@@ -3953,6 +3956,34 @@ class bingx extends bingx$1 {
3953
3956
  }
3954
3957
  return positions;
3955
3958
  }
3959
+ async fetchPositionMode(symbol = undefined, params = {}) {
3960
+ /**
3961
+ * @method
3962
+ * @name bingx#fetchPositionMode
3963
+ * @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
3964
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
3965
+ * @param {string} symbol unified symbol of the market to fetch the order book for
3966
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3967
+ * @returns {object} an object detailing whether the market is in hedged or one-way mode
3968
+ */
3969
+ const response = await this.swapV1PrivateGetPositionSideDual(params);
3970
+ //
3971
+ // {
3972
+ // "code": "0",
3973
+ // "msg": "",
3974
+ // "timeStamp": "1709002057516",
3975
+ // "data": {
3976
+ // "dualSidePosition": "false"
3977
+ // }
3978
+ // }
3979
+ //
3980
+ const data = this.safeDict(response, 'data', {});
3981
+ const dualSidePosition = this.safeString(data, 'dualSidePosition');
3982
+ return {
3983
+ 'info': response,
3984
+ 'hedged': (dualSidePosition === 'true'),
3985
+ };
3986
+ }
3956
3987
  async setPositionMode(hedged, symbol = undefined, params = {}) {
3957
3988
  /**
3958
3989
  * @method
@@ -3592,6 +3592,7 @@ class bitget extends bitget$1 {
3592
3592
  'not_trigger': 'open',
3593
3593
  'partial_fill': 'open',
3594
3594
  'partially_fill': 'open',
3595
+ 'partially_filled': 'open',
3595
3596
  'triggered': 'closed',
3596
3597
  'full_fill': 'closed',
3597
3598
  'filled': 'closed',
@@ -568,7 +568,7 @@ class bitvavo extends bitvavo$1 {
568
568
  // "market":"ETH-BTC",
569
569
  // "open":"0.022578",
570
570
  // "high":"0.023019",
571
- // "low":"0.022573",
571
+ // "low":"0.022572",
572
572
  // "last":"0.023019",
573
573
  // "volume":"25.16366324",
574
574
  // "volumeQuote":"0.57333305",
@@ -51,6 +51,7 @@ class coinbase extends coinbase$1 {
51
51
  'createStopLimitOrder': true,
52
52
  'createStopMarketOrder': false,
53
53
  'createStopOrder': true,
54
+ 'deposit': true,
54
55
  'editOrder': true,
55
56
  'fetchAccounts': true,
56
57
  'fetchBalance': true,
@@ -62,6 +63,7 @@ class coinbase extends coinbase$1 {
62
63
  'fetchCrossBorrowRate': false,
63
64
  'fetchCrossBorrowRates': false,
64
65
  'fetchCurrencies': true,
66
+ 'fetchDeposit': true,
65
67
  'fetchDepositAddress': 'emulated',
66
68
  'fetchDepositAddresses': false,
67
69
  'fetchDepositAddressesByNetwork': true,
@@ -190,6 +192,11 @@ class coinbase extends coinbase$1 {
190
192
  },
191
193
  },
192
194
  'v3': {
195
+ 'public': {
196
+ 'get': [
197
+ 'brokerage/time',
198
+ ],
199
+ },
193
200
  'private': {
194
201
  'get': [
195
202
  'brokerage/accounts',
@@ -207,7 +214,6 @@ class coinbase extends coinbase$1 {
207
214
  'brokerage/product_book',
208
215
  'brokerage/best_bid_ask',
209
216
  'brokerage/convert/trade/{trade_id}',
210
- 'brokerage/time',
211
217
  'brokerage/cfm/balance_summary',
212
218
  'brokerage/cfm/positions',
213
219
  'brokerage/cfm/positions/{product_id}',
@@ -338,6 +344,7 @@ class coinbase extends coinbase$1 {
338
344
  'fetchTickers': 'fetchTickersV3',
339
345
  'fetchAccounts': 'fetchAccountsV3',
340
346
  'fetchBalance': 'v2PrivateGetAccounts',
347
+ 'fetchTime': 'v2PublicGetTime',
341
348
  'user_native_currency': 'USD', // needed to get fees for v3
342
349
  },
343
350
  });
@@ -349,19 +356,36 @@ class coinbase extends coinbase$1 {
349
356
  * @description fetches the current integer timestamp in milliseconds from the exchange server
350
357
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request
351
358
  * @param {object} [params] extra parameters specific to the exchange API endpoint
359
+ * @param {string} [params.method] 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
352
360
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
353
361
  */
354
- const response = await this.v2PublicGetTime(params);
355
- //
356
- // {
357
- // "data": {
358
- // "epoch": 1589295679,
359
- // "iso": "2020-05-12T15:01:19Z"
360
- // }
361
- // }
362
- //
363
- const data = this.safeValue(response, 'data', {});
364
- return this.safeTimestamp(data, 'epoch');
362
+ const defaultMethod = this.safeString(this.options, 'fetchTime', 'v2PublicGetTime');
363
+ const method = this.safeString(params, 'method', defaultMethod);
364
+ params = this.omit(params, 'method');
365
+ let response = undefined;
366
+ if (method === 'v2PublicGetTime') {
367
+ response = await this.v2PublicGetTime(params);
368
+ //
369
+ // {
370
+ // "data": {
371
+ // "epoch": 1589295679,
372
+ // "iso": "2020-05-12T15:01:19Z"
373
+ // }
374
+ // }
375
+ //
376
+ response = this.safeValue(response, 'data', {});
377
+ }
378
+ else {
379
+ response = await this.v3PublicGetBrokerageTime(params);
380
+ //
381
+ // {
382
+ // "iso": "2024-02-27T03:37:14Z",
383
+ // "epochSeconds": "1709005034",
384
+ // "epochMillis": "1709005034333"
385
+ // }
386
+ //
387
+ }
388
+ return this.safeTimestamp2(response, 'epoch', 'epochSeconds');
365
389
  }
366
390
  async fetchAccounts(params = {}) {
367
391
  /**
@@ -1757,6 +1781,7 @@ class coinbase extends coinbase$1 {
1757
1781
  response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
1758
1782
  }
1759
1783
  else {
1784
+ request['limit'] = 100;
1760
1785
  response = await this.v2PrivateGetAccounts(this.extend(request, params));
1761
1786
  }
1762
1787
  //
@@ -3536,6 +3561,145 @@ class coinbase extends coinbase$1 {
3536
3561
  'network': this.networkIdToCode(networkId, code),
3537
3562
  };
3538
3563
  }
3564
+ async deposit(code, amount, id, params = {}) {
3565
+ /**
3566
+ * @method
3567
+ * @name coinbase#deposit
3568
+ * @description make a deposit
3569
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#deposit-funds
3570
+ * @param {string} code unified currency code
3571
+ * @param {float} amount the amount to deposit
3572
+ * @param {string} id the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods
3573
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3574
+ * @param {string} [params.accountId] the id of the account to deposit into
3575
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3576
+ */
3577
+ await this.loadMarkets();
3578
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
3579
+ params = this.omit(params, ['account_id', 'accountId']);
3580
+ if (accountId === undefined) {
3581
+ if (code === undefined) {
3582
+ throw new errors.ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
3583
+ }
3584
+ accountId = await this.findAccountId(code);
3585
+ if (accountId === undefined) {
3586
+ throw new errors.ExchangeError(this.id + ' deposit() could not find account id for ' + code);
3587
+ }
3588
+ }
3589
+ const request = {
3590
+ 'account_id': accountId,
3591
+ 'amount': this.numberToString(amount),
3592
+ 'currency': code.toUpperCase(),
3593
+ 'payment_method': id,
3594
+ };
3595
+ const response = await this.v2PrivatePostAccountsAccountIdDeposits(this.extend(request, params));
3596
+ //
3597
+ // {
3598
+ // "data": {
3599
+ // "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
3600
+ // "status": "created",
3601
+ // "payment_method": {
3602
+ // "id": "83562370-3e5c-51db-87da-752af5ab9559",
3603
+ // "resource": "payment_method",
3604
+ // "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
3605
+ // },
3606
+ // "transaction": {
3607
+ // "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
3608
+ // "resource": "transaction",
3609
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
3610
+ // },
3611
+ // "amount": {
3612
+ // "amount": "10.00",
3613
+ // "currency": "USD"
3614
+ // },
3615
+ // "subtotal": {
3616
+ // "amount": "10.00",
3617
+ // "currency": "USD"
3618
+ // },
3619
+ // "created_at": "2015-01-31T20:49:02Z",
3620
+ // "updated_at": "2015-02-11T16:54:02-08:00",
3621
+ // "resource": "deposit",
3622
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
3623
+ // "committed": true,
3624
+ // "fee": {
3625
+ // "amount": "0.00",
3626
+ // "currency": "USD"
3627
+ // },
3628
+ // "payout_at": "2015-02-18T16:54:00-08:00"
3629
+ // }
3630
+ // }
3631
+ //
3632
+ const data = this.safeDict(response, 'data', {});
3633
+ return this.parseTransaction(data);
3634
+ }
3635
+ async fetchDeposit(id, code = undefined, params = {}) {
3636
+ /**
3637
+ * @method
3638
+ * @name coinbase#fetchDeposit
3639
+ * @description fetch information on a deposit, fiat only, for crypto transactions use fetchLedger
3640
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#show-deposit
3641
+ * @param {string} id deposit id
3642
+ * @param {string} [code] unified currency code
3643
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3644
+ * @param {string} [params.accountId] the id of the account that the funds were deposited into
3645
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3646
+ */
3647
+ await this.loadMarkets();
3648
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
3649
+ params = this.omit(params, ['account_id', 'accountId']);
3650
+ if (accountId === undefined) {
3651
+ if (code === undefined) {
3652
+ throw new errors.ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
3653
+ }
3654
+ accountId = await this.findAccountId(code);
3655
+ if (accountId === undefined) {
3656
+ throw new errors.ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
3657
+ }
3658
+ }
3659
+ const request = {
3660
+ 'account_id': accountId,
3661
+ 'deposit_id': id,
3662
+ };
3663
+ const response = await this.v2PrivateGetAccountsAccountIdDepositsDepositId(this.extend(request, params));
3664
+ //
3665
+ // {
3666
+ // "data": {
3667
+ // "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
3668
+ // "status": "completed",
3669
+ // "payment_method": {
3670
+ // "id": "83562370-3e5c-51db-87da-752af5ab9559",
3671
+ // "resource": "payment_method",
3672
+ // "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
3673
+ // },
3674
+ // "transaction": {
3675
+ // "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
3676
+ // "resource": "transaction",
3677
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
3678
+ // },
3679
+ // "amount": {
3680
+ // "amount": "10.00",
3681
+ // "currency": "USD"
3682
+ // },
3683
+ // "subtotal": {
3684
+ // "amount": "10.00",
3685
+ // "currency": "USD"
3686
+ // },
3687
+ // "created_at": "2015-01-31T20:49:02Z",
3688
+ // "updated_at": "2015-02-11T16:54:02-08:00",
3689
+ // "resource": "deposit",
3690
+ // "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
3691
+ // "committed": true,
3692
+ // "fee": {
3693
+ // "amount": "0.00",
3694
+ // "currency": "USD"
3695
+ // },
3696
+ // "payout_at": "2015-02-18T16:54:00-08:00"
3697
+ // }
3698
+ // }
3699
+ //
3700
+ const data = this.safeValue(response, 'data', {});
3701
+ return this.parseTransaction(data);
3702
+ }
3539
3703
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
3540
3704
  const version = api[0];
3541
3705
  const signed = api[1] === 'private';
@@ -3556,6 +3720,11 @@ class coinbase extends coinbase$1 {
3556
3720
  'Authorization': authorization,
3557
3721
  'Content-Type': 'application/json',
3558
3722
  };
3723
+ if (method !== 'GET') {
3724
+ if (Object.keys(query).length) {
3725
+ body = this.json(query);
3726
+ }
3727
+ }
3559
3728
  }
3560
3729
  else if (this.token && !this.checkRequiredCredentials(false)) {
3561
3730
  headers = {
@@ -3578,6 +3747,11 @@ class coinbase extends coinbase$1 {
3578
3747
  payload = body;
3579
3748
  }
3580
3749
  }
3750
+ else {
3751
+ if (Object.keys(query).length) {
3752
+ payload += '?' + this.urlencode(query);
3753
+ }
3754
+ }
3581
3755
  const auth = nonce + method + savedPath + payload;
3582
3756
  const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256);
3583
3757
  headers = {
@@ -1231,9 +1231,10 @@ class htx extends htx$1 {
1231
1231
  async fetchStatus(params = {}) {
1232
1232
  await this.loadMarkets();
1233
1233
  let marketType = undefined;
1234
- [marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', undefined, params);
1234
+ [marketType, params] = this.handleMarketTypeAndParams('fetchStatus', undefined, params);
1235
+ const enabledForContracts = this.handleOption('fetchStatus', 'enableForContracts', false); // temp fix for: https://status-linear-swap.huobigroup.com/api/v2/summary.json
1235
1236
  let response = undefined;
1236
- if (marketType !== 'spot') {
1237
+ if (marketType !== 'spot' && enabledForContracts) {
1237
1238
  const subType = this.safeString(params, 'subType', this.options['defaultSubType']);
1238
1239
  if (marketType === 'swap') {
1239
1240
  if (subType === 'linear') {
@@ -1255,7 +1256,7 @@ class htx extends htx$1 {
1255
1256
  response = await this.contractPublicGetHeartbeat();
1256
1257
  }
1257
1258
  }
1258
- else {
1259
+ else if (marketType === 'spot') {
1259
1260
  response = await this.statusPublicSpotGetApiV2SummaryJson();
1260
1261
  }
1261
1262
  //
@@ -1424,7 +1425,12 @@ class htx extends htx$1 {
1424
1425
  let url = undefined;
1425
1426
  if (marketType === 'contract') {
1426
1427
  const statusRaw = this.safeString(response, 'status');
1427
- status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
1428
+ if (statusRaw === undefined) {
1429
+ status = undefined;
1430
+ }
1431
+ else {
1432
+ status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
1433
+ }
1428
1434
  updated = this.safeString(response, 'ts');
1429
1435
  }
1430
1436
  else {
@@ -102,7 +102,7 @@ class bitvavo extends bitvavo$1 {
102
102
  // "volume": "3587.05020246",
103
103
  // "volumeQuote": "708030.17",
104
104
  // "bid": "199.56",
105
- // "bidSize": "4.14730803",
105
+ // "bidSize": "4.14730802",
106
106
  // "ask": "199.57",
107
107
  // "askSize": "6.13642074",
108
108
  // "timestamp": 1590770885217
@@ -34,7 +34,6 @@ class blockchaincom extends blockchaincom$1 {
34
34
  },
35
35
  'noOriginHeader': false,
36
36
  },
37
- 'sequenceNumbers': {},
38
37
  },
39
38
  'streaming': {},
40
39
  'exceptions': {},
@@ -678,21 +677,20 @@ class blockchaincom extends blockchaincom$1 {
678
677
  // }
679
678
  //
680
679
  const event = this.safeString(message, 'event');
680
+ if (event === 'subscribed') {
681
+ return;
682
+ }
681
683
  const type = this.safeString(message, 'channel');
682
684
  const marketId = this.safeString(message, 'symbol');
683
685
  const symbol = this.safeSymbol(marketId);
684
686
  const messageHash = 'orderbook:' + symbol + ':' + type;
685
687
  const datetime = this.safeString(message, 'timestamp');
686
688
  const timestamp = this.parse8601(datetime);
687
- let orderbook = this.safeValue(this.orderbooks, symbol);
688
- if (orderbook === undefined) {
689
- orderbook = this.countedOrderBook({});
690
- this.orderbooks[symbol] = orderbook;
691
- }
692
- if (event === 'subscribed') {
693
- return;
689
+ if (this.safeValue(this.orderbooks, symbol) === undefined) {
690
+ this.orderbooks[symbol] = this.countedOrderBook();
694
691
  }
695
- else if (event === 'snapshot') {
692
+ const orderbook = this.orderbooks[symbol];
693
+ if (event === 'snapshot') {
696
694
  const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num');
697
695
  orderbook.reset(snapshot);
698
696
  }
@@ -718,23 +716,7 @@ class blockchaincom extends blockchaincom$1 {
718
716
  this.handleDelta(bookside, deltas[i]);
719
717
  }
720
718
  }
721
- checkSequenceNumber(client, message) {
722
- const seqnum = this.safeInteger(message, 'seqnum', 0);
723
- const channel = this.safeString(message, 'channel', '');
724
- const sequenceNumbersByChannel = this.safeValue(this.options, 'sequenceNumbers', {});
725
- const lastSeqnum = this.safeInteger(sequenceNumbersByChannel, channel);
726
- if (lastSeqnum === undefined) {
727
- this.options['sequenceNumbers'][channel] = seqnum;
728
- }
729
- else {
730
- if (seqnum !== lastSeqnum + 1) {
731
- throw new errors.ExchangeError(this.id + ' ' + channel + ' seqnum ' + seqnum + ' is not the expected ' + (lastSeqnum + 1));
732
- }
733
- this.options['sequenceNumbers'][channel] = seqnum;
734
- }
735
- }
736
719
  handleMessage(client, message) {
737
- this.checkSequenceNumber(client, message);
738
720
  const channel = this.safeString(message, 'channel');
739
721
  const handlers = {
740
722
  'ticker': this.handleTicker,
@@ -177,7 +177,7 @@ class deribit extends deribit$1 {
177
177
  // "params": {
178
178
  // "channel": "ticker.BTC_USDC-PERPETUAL.raw",
179
179
  // "data": {
180
- // "timestamp": 1655393725041,
180
+ // "timestamp": 1655393725040,
181
181
  // "stats": [Object],
182
182
  // "state": "open",
183
183
  // "settlement_price": 21729.5891,
@@ -658,7 +658,7 @@ class deribit extends deribit$1 {
658
658
  const symbol = this.safeSymbol(marketId);
659
659
  const ohlcv = this.safeValue(params, 'data', {});
660
660
  const parsed = [
661
- this.safeNumber(ohlcv, 'tick'),
661
+ this.safeInteger(ohlcv, 'tick'),
662
662
  this.safeNumber(ohlcv, 'open'),
663
663
  this.safeNumber(ohlcv, 'high'),
664
664
  this.safeNumber(ohlcv, 'low'),
@@ -203,7 +203,7 @@ class gemini extends gemini$1 {
203
203
  // "time_ms": 1655323185000,
204
204
  // "result": "failure",
205
205
  // "highest_bid_price": "21661.90",
206
- // "lowest_ask_price": "21663.79",
206
+ // "lowest_ask_price": "21663.78",
207
207
  // "collar_price": "21662.845"
208
208
  // },
209
209
  // ]
@@ -907,9 +907,6 @@ class okx extends okx$1 {
907
907
  * @param {object} params extra parameters specific to the exchange API endpoint
908
908
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
909
909
  */
910
- if (this.isEmpty(symbols)) {
911
- throw new errors.ArgumentsRequired(this.id + ' watchPositions requires a list of symbols');
912
- }
913
910
  await this.loadMarkets();
914
911
  await this.authenticate(params);
915
912
  symbols = this.marketSymbols(symbols);
@@ -917,7 +914,23 @@ class okx extends okx$1 {
917
914
  'instType': 'ANY',
918
915
  };
919
916
  const channel = 'positions';
920
- const newPositions = await this.subscribeMultiple('private', channel, symbols, this.extend(request, params));
917
+ let newPositions = undefined;
918
+ if (symbols === undefined) {
919
+ const arg = {
920
+ 'channel': 'positions',
921
+ 'instType': 'ANY',
922
+ };
923
+ const args = [arg];
924
+ const nonSymbolRequest = {
925
+ 'op': 'subscribe',
926
+ 'args': args,
927
+ };
928
+ const url = this.getUrl(channel, 'private');
929
+ newPositions = await this.watch(url, channel, nonSymbolRequest, channel);
930
+ }
931
+ else {
932
+ newPositions = await this.subscribeMultiple('private', channel, symbols, this.extend(request, params));
933
+ }
921
934
  if (this.newUpdates) {
922
935
  return newPositions;
923
936
  }
@@ -1015,6 +1028,7 @@ class okx extends okx$1 {
1015
1028
  client.resolve(positions, messageHash);
1016
1029
  }
1017
1030
  }
1031
+ client.resolve(newPositions, channel);
1018
1032
  }
1019
1033
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1020
1034
  /**
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.51";
7
+ declare const version = "4.2.52";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';