ccxt 4.3.82 → 4.3.84

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.82';
197
+ const version = '4.3.84';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -3433,7 +3433,15 @@ class binance extends binance$1 {
3433
3433
  }
3434
3434
  else if (this.isLinear(type, subType)) {
3435
3435
  type = 'linear';
3436
- response = await this.fapiPrivateV3GetAccount(this.extend(request, query));
3436
+ let useV2 = undefined;
3437
+ [useV2, params] = this.handleOptionAndParams(params, 'fetchBalance', 'useV2', false);
3438
+ params = this.extend(request, query);
3439
+ if (!useV2) {
3440
+ response = await this.fapiPrivateV3GetAccount(params);
3441
+ }
3442
+ else {
3443
+ response = await this.fapiPrivateV2GetAccount(params);
3444
+ }
3437
3445
  }
3438
3446
  else if (this.isInverse(type, subType)) {
3439
3447
  type = 'inverse';
@@ -10284,6 +10292,7 @@ class binance extends binance$1 {
10284
10292
  * @param {string[]} [symbols] list of unified market symbols
10285
10293
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10286
10294
  * @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
10295
+ * @param {bool} [params.useV2] set to true if you want to use the obsolete endpoint, where some more additional fields were provided
10287
10296
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
10288
10297
  */
10289
10298
  let defaultMethod = undefined;
@@ -10457,6 +10466,7 @@ class binance extends binance$1 {
10457
10466
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10458
10467
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
10459
10468
  * @param {string} [params.subType] "linear" or "inverse"
10469
+ * @param {bool} [params.useV2] set to true if you want to use the obsolete endpoint, where some more additional fields were provided
10460
10470
  * @returns {object} data on the positions risk
10461
10471
  */
10462
10472
  if (symbols !== undefined) {
@@ -10481,7 +10491,15 @@ class binance extends binance$1 {
10481
10491
  response = await this.papiGetUmPositionRisk(this.extend(request, params));
10482
10492
  }
10483
10493
  else {
10484
- response = await this.fapiPrivateV3GetPositionRisk(this.extend(request, params));
10494
+ let useV2 = undefined;
10495
+ [useV2, params] = this.handleOptionAndParams(params, 'fetchPositionsRisk', 'useV2', false);
10496
+ params = this.extend(request, params);
10497
+ if (!useV2) {
10498
+ response = await this.fapiPrivateV3GetPositionRisk(params);
10499
+ }
10500
+ else {
10501
+ response = await this.fapiPrivateV2GetPositionRisk(params);
10502
+ }
10485
10503
  //
10486
10504
  // [
10487
10505
  // {
@@ -10925,7 +10943,7 @@ class binance extends binance$1 {
10925
10943
  let longLeverage = undefined;
10926
10944
  let shortLeverage = undefined;
10927
10945
  const leverageValue = this.safeInteger(leverage, 'leverage');
10928
- if (side === 'both') {
10946
+ if ((side === undefined) || (side === 'both')) {
10929
10947
  longLeverage = leverageValue;
10930
10948
  shortLeverage = leverageValue;
10931
10949
  }
@@ -11388,7 +11406,7 @@ class binance extends binance$1 {
11388
11406
  if ((api === 'sapi') && (path === 'asset/dust')) {
11389
11407
  query = this.urlencodeWithArrayRepeat(extendedParams);
11390
11408
  }
11391
- else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0)) {
11409
+ else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0) || (path.indexOf('simple-earn') >= 0)) {
11392
11410
  if ((method === 'DELETE') && (path === 'batchOrders')) {
11393
11411
  const orderidlist = this.safeList(extendedParams, 'orderidlist', []);
11394
11412
  const origclientorderidlist = this.safeList(extendedParams, 'origclientorderidlist', []);
@@ -13299,7 +13317,7 @@ class binance extends binance$1 {
13299
13317
  else {
13300
13318
  request['startTime'] = now - msInThirtyDays;
13301
13319
  }
13302
- const endTime = this.safeString2(params, 'endTime', 'until');
13320
+ const endTime = this.safeInteger2(params, 'endTime', 'until');
13303
13321
  if (endTime !== undefined) {
13304
13322
  request['endTime'] = endTime;
13305
13323
  }
@@ -13341,6 +13359,9 @@ class binance extends binance$1 {
13341
13359
  //
13342
13360
  }
13343
13361
  else {
13362
+ if ((request['endTime'] - request['startTime']) > msInThirtyDays) {
13363
+ throw new errors.BadRequest(this.id + ' fetchConvertTradeHistory () the max interval between startTime and endTime is 30 days.');
13364
+ }
13344
13365
  if (limit !== undefined) {
13345
13366
  request['limit'] = limit;
13346
13367
  }
@@ -335,9 +335,9 @@ class bitfinex2 extends bitfinex2$1 {
335
335
  // convert 'EXCHANGE LIMIT' to lowercase 'limit'
336
336
  // everything else remains uppercase
337
337
  'exchangeTypes': {
338
- // 'MARKET': undefined,
338
+ 'MARKET': 'market',
339
339
  'EXCHANGE MARKET': 'market',
340
- // 'LIMIT': undefined,
340
+ 'LIMIT': 'limit',
341
341
  'EXCHANGE LIMIT': 'limit',
342
342
  // 'STOP': undefined,
343
343
  'EXCHANGE STOP': 'market',
@@ -4243,10 +4243,10 @@ class gate extends gate$1 {
4243
4243
  }
4244
4244
  else {
4245
4245
  if (side === 'sell') {
4246
- request['size'] = Precise["default"].stringNeg(this.amountToPrecision(symbol, amount));
4246
+ request['size'] = this.parseToNumeric(Precise["default"].stringNeg(this.amountToPrecision(symbol, amount)));
4247
4247
  }
4248
4248
  else {
4249
- request['size'] = this.amountToPrecision(symbol, amount);
4249
+ request['size'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
4250
4250
  }
4251
4251
  }
4252
4252
  }
@@ -2525,14 +2525,12 @@ class kraken extends kraken$1 {
2525
2525
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2526
2526
  */
2527
2527
  // https://www.kraken.com/en-us/help/api#deposit-status
2528
- if (code === undefined) {
2529
- throw new errors.ArgumentsRequired(this.id + ' fetchDeposits() requires a currency code argument');
2530
- }
2531
2528
  await this.loadMarkets();
2532
- const currency = this.currency(code);
2533
- const request = {
2534
- 'asset': currency['id'],
2535
- };
2529
+ const request = {};
2530
+ if (code !== undefined) {
2531
+ const currency = this.currency(code);
2532
+ request['asset'] = currency['id'];
2533
+ }
2536
2534
  if (since !== undefined) {
2537
2535
  request['start'] = since;
2538
2536
  }
@@ -3008,7 +3008,7 @@ class phemex extends phemex$1 {
3008
3008
  response = await this.privateGetApiDataGFuturesOrdersByOrderId(this.extend(request, params));
3009
3009
  }
3010
3010
  else if (market['spot']) {
3011
- response = await this.privateGetSpotOrdersActive(this.extend(request, params));
3011
+ response = await this.privateGetApiDataSpotsOrdersByOrderId(this.extend(request, params));
3012
3012
  }
3013
3013
  else {
3014
3014
  response = await this.privateGetExchangeOrder(this.extend(request, params));
@@ -3025,7 +3025,11 @@ class phemex extends phemex$1 {
3025
3025
  throw new errors.OrderNotFound(this.id + ' fetchOrder() ' + symbol + ' order with id ' + id + ' not found');
3026
3026
  }
3027
3027
  }
3028
- order = this.safeValue(data, 0, {});
3028
+ order = this.safeDict(data, 0, {});
3029
+ }
3030
+ else if (market['spot']) {
3031
+ const rows = this.safeList(data, 'rows', []);
3032
+ order = this.safeDict(rows, 0, {});
3029
3033
  }
3030
3034
  return this.parseOrder(order, market);
3031
3035
  }
@@ -3064,7 +3068,7 @@ class phemex extends phemex$1 {
3064
3068
  response = await this.privateGetExchangeOrderList(this.extend(request, params));
3065
3069
  }
3066
3070
  else {
3067
- response = await this.privateGetSpotOrders(this.extend(request, params));
3071
+ response = await this.privateGetApiDataSpotsOrders(this.extend(request, params));
3068
3072
  }
3069
3073
  const data = this.safeValue(response, 'data', {});
3070
3074
  const rows = this.safeList(data, 'rows', data);
@@ -1217,6 +1217,9 @@ class binance extends binance$1 {
1217
1217
  * @param {object} [params.timezone] if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00'
1218
1218
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1219
1219
  */
1220
+ await this.loadMarkets();
1221
+ const market = this.market(symbol);
1222
+ symbol = market['symbol'];
1220
1223
  params['callerMethodName'] = 'watchOHLCV';
1221
1224
  const result = await this.watchOHLCVForSymbols([[symbol, timeframe]], since, limit, params);
1222
1225
  return result[symbol][timeframe];
@@ -1267,7 +1270,7 @@ class binance extends binance$1 {
1267
1270
  const suffix = '@+08:00';
1268
1271
  const utcSuffix = shouldUseUTC8 ? suffix : '';
1269
1272
  rawHashes.push(marketId + '@' + klineType + '_' + interval + utcSuffix);
1270
- messageHashes.push('ohlcv::' + symbolString + '::' + timeframeString);
1273
+ messageHashes.push('ohlcv::' + market['symbol'] + '::' + timeframeString);
1271
1274
  }
1272
1275
  const url = this.urls['api']['ws'][type] + '/' + this.stream(type, 'multipleOHLCV');
1273
1276
  const requestId = this.requestId(url);
@@ -1543,6 +1546,8 @@ class binance extends binance$1 {
1543
1546
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1544
1547
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1545
1548
  */
1549
+ await this.loadMarkets();
1550
+ symbols = this.marketSymbols(symbols, undefined, true, false, true);
1546
1551
  const result = await this.watchMultiTickerHelper('watchBidsAsks', 'bookTicker', symbols, params);
1547
1552
  if (this.newUpdates) {
1548
1553
  return result;
@@ -411,15 +411,7 @@ class bitrue extends bitrue$1 {
411
411
  async authenticate(params = {}) {
412
412
  const listenKey = this.safeValue(this.options, 'listenKey');
413
413
  if (listenKey === undefined) {
414
- let response = undefined;
415
- try {
416
- response = await this.openPrivatePostPoseidonApiV1ListenKey(params);
417
- }
418
- catch (error) {
419
- this.options['listenKey'] = undefined;
420
- this.options['listenKeyUrl'] = undefined;
421
- return undefined;
422
- }
414
+ const response = await this.openPrivatePostPoseidonApiV1ListenKey(params);
423
415
  //
424
416
  // {
425
417
  // "msg": "succ",
@@ -1514,7 +1514,7 @@ class gate extends gate$1 {
1514
1514
  const errs = this.safeDict(data, 'errs');
1515
1515
  const error = this.safeDict(message, 'error', errs);
1516
1516
  const code = this.safeString2(error, 'code', 'label');
1517
- const id = this.safeString2(message, 'id', 'requestId');
1517
+ const id = this.safeStringN(message, ['id', 'requestId', 'request_id']);
1518
1518
  if (error !== undefined) {
1519
1519
  const messageHash = this.safeString(client.subscriptions, id);
1520
1520
  try {
@@ -1530,7 +1530,7 @@ class gate extends gate$1 {
1530
1530
  delete client.subscriptions[messageHash];
1531
1531
  }
1532
1532
  }
1533
- if (id !== undefined) {
1533
+ if ((id !== undefined) && (id in client.subscriptions)) {
1534
1534
  delete client.subscriptions[id];
1535
1535
  }
1536
1536
  return true;
@@ -1818,7 +1818,7 @@ class gate extends gate$1 {
1818
1818
  'event': event,
1819
1819
  'payload': payload,
1820
1820
  };
1821
- return await this.watch(url, messageHash, request, messageHash);
1821
+ return await this.watch(url, messageHash, request, messageHash, requestId);
1822
1822
  }
1823
1823
  async subscribePrivate(url, messageHash, payload, channel, params, requiresUid = false) {
1824
1824
  this.checkRequiredCredentials();
@@ -1862,7 +1862,7 @@ class gate extends gate$1 {
1862
1862
  client.subscriptions[tempSubscriptionHash] = messageHash;
1863
1863
  }
1864
1864
  const message = this.extend(request, params);
1865
- return await this.watch(url, messageHash, message, messageHash);
1865
+ return await this.watch(url, messageHash, message, messageHash, messageHash);
1866
1866
  }
1867
1867
  }
1868
1868
 
@@ -347,6 +347,8 @@ class okx extends okx$1 {
347
347
  let channel = undefined;
348
348
  [channel, params] = this.handleOptionAndParams(params, 'watchTicker', 'channel', 'tickers');
349
349
  params['channel'] = channel;
350
+ const market = this.market(symbol);
351
+ symbol = market['symbol'];
350
352
  const ticker = await this.watchTickers([symbol], params);
351
353
  return this.safeValue(ticker, symbol);
352
354
  }
@@ -25,6 +25,7 @@ class phemex extends phemex$1 {
25
25
  'watchOrderBookForSymbols': false,
26
26
  'watchTradesForSymbols': false,
27
27
  'watchOHLCVForSymbols': false,
28
+ 'watchBalance': true,
28
29
  },
29
30
  'urls': {
30
31
  'test': {
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, 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 } from './src/base/errors.js';
7
- declare const version = "4.3.81";
7
+ declare const version = "4.3.83";
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, 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 } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.82';
41
+ const version = '4.3.84';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/binance.js CHANGED
@@ -3436,7 +3436,15 @@ export default class binance extends Exchange {
3436
3436
  }
3437
3437
  else if (this.isLinear(type, subType)) {
3438
3438
  type = 'linear';
3439
- response = await this.fapiPrivateV3GetAccount(this.extend(request, query));
3439
+ let useV2 = undefined;
3440
+ [useV2, params] = this.handleOptionAndParams(params, 'fetchBalance', 'useV2', false);
3441
+ params = this.extend(request, query);
3442
+ if (!useV2) {
3443
+ response = await this.fapiPrivateV3GetAccount(params);
3444
+ }
3445
+ else {
3446
+ response = await this.fapiPrivateV2GetAccount(params);
3447
+ }
3440
3448
  }
3441
3449
  else if (this.isInverse(type, subType)) {
3442
3450
  type = 'inverse';
@@ -10287,6 +10295,7 @@ export default class binance extends Exchange {
10287
10295
  * @param {string[]} [symbols] list of unified market symbols
10288
10296
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10289
10297
  * @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
10298
+ * @param {bool} [params.useV2] set to true if you want to use the obsolete endpoint, where some more additional fields were provided
10290
10299
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
10291
10300
  */
10292
10301
  let defaultMethod = undefined;
@@ -10460,6 +10469,7 @@ export default class binance extends Exchange {
10460
10469
  * @param {object} [params] extra parameters specific to the exchange API endpoint
10461
10470
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch positions for a portfolio margin account
10462
10471
  * @param {string} [params.subType] "linear" or "inverse"
10472
+ * @param {bool} [params.useV2] set to true if you want to use the obsolete endpoint, where some more additional fields were provided
10463
10473
  * @returns {object} data on the positions risk
10464
10474
  */
10465
10475
  if (symbols !== undefined) {
@@ -10484,7 +10494,15 @@ export default class binance extends Exchange {
10484
10494
  response = await this.papiGetUmPositionRisk(this.extend(request, params));
10485
10495
  }
10486
10496
  else {
10487
- response = await this.fapiPrivateV3GetPositionRisk(this.extend(request, params));
10497
+ let useV2 = undefined;
10498
+ [useV2, params] = this.handleOptionAndParams(params, 'fetchPositionsRisk', 'useV2', false);
10499
+ params = this.extend(request, params);
10500
+ if (!useV2) {
10501
+ response = await this.fapiPrivateV3GetPositionRisk(params);
10502
+ }
10503
+ else {
10504
+ response = await this.fapiPrivateV2GetPositionRisk(params);
10505
+ }
10488
10506
  //
10489
10507
  // [
10490
10508
  // {
@@ -10928,7 +10946,7 @@ export default class binance extends Exchange {
10928
10946
  let longLeverage = undefined;
10929
10947
  let shortLeverage = undefined;
10930
10948
  const leverageValue = this.safeInteger(leverage, 'leverage');
10931
- if (side === 'both') {
10949
+ if ((side === undefined) || (side === 'both')) {
10932
10950
  longLeverage = leverageValue;
10933
10951
  shortLeverage = leverageValue;
10934
10952
  }
@@ -11391,7 +11409,7 @@ export default class binance extends Exchange {
11391
11409
  if ((api === 'sapi') && (path === 'asset/dust')) {
11392
11410
  query = this.urlencodeWithArrayRepeat(extendedParams);
11393
11411
  }
11394
- else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0)) {
11412
+ else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0) || (path.indexOf('simple-earn') >= 0)) {
11395
11413
  if ((method === 'DELETE') && (path === 'batchOrders')) {
11396
11414
  const orderidlist = this.safeList(extendedParams, 'orderidlist', []);
11397
11415
  const origclientorderidlist = this.safeList(extendedParams, 'origclientorderidlist', []);
@@ -13302,7 +13320,7 @@ export default class binance extends Exchange {
13302
13320
  else {
13303
13321
  request['startTime'] = now - msInThirtyDays;
13304
13322
  }
13305
- const endTime = this.safeString2(params, 'endTime', 'until');
13323
+ const endTime = this.safeInteger2(params, 'endTime', 'until');
13306
13324
  if (endTime !== undefined) {
13307
13325
  request['endTime'] = endTime;
13308
13326
  }
@@ -13344,6 +13362,9 @@ export default class binance extends Exchange {
13344
13362
  //
13345
13363
  }
13346
13364
  else {
13365
+ if ((request['endTime'] - request['startTime']) > msInThirtyDays) {
13366
+ throw new BadRequest(this.id + ' fetchConvertTradeHistory () the max interval between startTime and endTime is 30 days.');
13367
+ }
13347
13368
  if (limit !== undefined) {
13348
13369
  request['limit'] = limit;
13349
13370
  }
@@ -338,9 +338,9 @@ export default class bitfinex2 extends Exchange {
338
338
  // convert 'EXCHANGE LIMIT' to lowercase 'limit'
339
339
  // everything else remains uppercase
340
340
  'exchangeTypes': {
341
- // 'MARKET': undefined,
341
+ 'MARKET': 'market',
342
342
  'EXCHANGE MARKET': 'market',
343
- // 'LIMIT': undefined,
343
+ 'LIMIT': 'limit',
344
344
  'EXCHANGE LIMIT': 'limit',
345
345
  // 'STOP': undefined,
346
346
  'EXCHANGE STOP': 'market',
package/js/src/gate.js CHANGED
@@ -4246,10 +4246,10 @@ export default class gate extends Exchange {
4246
4246
  }
4247
4247
  else {
4248
4248
  if (side === 'sell') {
4249
- request['size'] = Precise.stringNeg(this.amountToPrecision(symbol, amount));
4249
+ request['size'] = this.parseToNumeric(Precise.stringNeg(this.amountToPrecision(symbol, amount)));
4250
4250
  }
4251
4251
  else {
4252
- request['size'] = this.amountToPrecision(symbol, amount);
4252
+ request['size'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
4253
4253
  }
4254
4254
  }
4255
4255
  }
package/js/src/kraken.js CHANGED
@@ -2528,14 +2528,12 @@ export default class kraken extends Exchange {
2528
2528
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2529
2529
  */
2530
2530
  // https://www.kraken.com/en-us/help/api#deposit-status
2531
- if (code === undefined) {
2532
- throw new ArgumentsRequired(this.id + ' fetchDeposits() requires a currency code argument');
2533
- }
2534
2531
  await this.loadMarkets();
2535
- const currency = this.currency(code);
2536
- const request = {
2537
- 'asset': currency['id'],
2538
- };
2532
+ const request = {};
2533
+ if (code !== undefined) {
2534
+ const currency = this.currency(code);
2535
+ request['asset'] = currency['id'];
2536
+ }
2539
2537
  if (since !== undefined) {
2540
2538
  request['start'] = since;
2541
2539
  }
package/js/src/phemex.js CHANGED
@@ -3011,7 +3011,7 @@ export default class phemex extends Exchange {
3011
3011
  response = await this.privateGetApiDataGFuturesOrdersByOrderId(this.extend(request, params));
3012
3012
  }
3013
3013
  else if (market['spot']) {
3014
- response = await this.privateGetSpotOrdersActive(this.extend(request, params));
3014
+ response = await this.privateGetApiDataSpotsOrdersByOrderId(this.extend(request, params));
3015
3015
  }
3016
3016
  else {
3017
3017
  response = await this.privateGetExchangeOrder(this.extend(request, params));
@@ -3028,7 +3028,11 @@ export default class phemex extends Exchange {
3028
3028
  throw new OrderNotFound(this.id + ' fetchOrder() ' + symbol + ' order with id ' + id + ' not found');
3029
3029
  }
3030
3030
  }
3031
- order = this.safeValue(data, 0, {});
3031
+ order = this.safeDict(data, 0, {});
3032
+ }
3033
+ else if (market['spot']) {
3034
+ const rows = this.safeList(data, 'rows', []);
3035
+ order = this.safeDict(rows, 0, {});
3032
3036
  }
3033
3037
  return this.parseOrder(order, market);
3034
3038
  }
@@ -3067,7 +3071,7 @@ export default class phemex extends Exchange {
3067
3071
  response = await this.privateGetExchangeOrderList(this.extend(request, params));
3068
3072
  }
3069
3073
  else {
3070
- response = await this.privateGetSpotOrders(this.extend(request, params));
3074
+ response = await this.privateGetApiDataSpotsOrders(this.extend(request, params));
3071
3075
  }
3072
3076
  const data = this.safeValue(response, 'data', {});
3073
3077
  const rows = this.safeList(data, 'rows', data);
@@ -1220,6 +1220,9 @@ export default class binance extends binanceRest {
1220
1220
  * @param {object} [params.timezone] if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00'
1221
1221
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1222
1222
  */
1223
+ await this.loadMarkets();
1224
+ const market = this.market(symbol);
1225
+ symbol = market['symbol'];
1223
1226
  params['callerMethodName'] = 'watchOHLCV';
1224
1227
  const result = await this.watchOHLCVForSymbols([[symbol, timeframe]], since, limit, params);
1225
1228
  return result[symbol][timeframe];
@@ -1270,7 +1273,7 @@ export default class binance extends binanceRest {
1270
1273
  const suffix = '@+08:00';
1271
1274
  const utcSuffix = shouldUseUTC8 ? suffix : '';
1272
1275
  rawHashes.push(marketId + '@' + klineType + '_' + interval + utcSuffix);
1273
- messageHashes.push('ohlcv::' + symbolString + '::' + timeframeString);
1276
+ messageHashes.push('ohlcv::' + market['symbol'] + '::' + timeframeString);
1274
1277
  }
1275
1278
  const url = this.urls['api']['ws'][type] + '/' + this.stream(type, 'multipleOHLCV');
1276
1279
  const requestId = this.requestId(url);
@@ -1546,6 +1549,8 @@ export default class binance extends binanceRest {
1546
1549
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1547
1550
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1548
1551
  */
1552
+ await this.loadMarkets();
1553
+ symbols = this.marketSymbols(symbols, undefined, true, false, true);
1549
1554
  const result = await this.watchMultiTickerHelper('watchBidsAsks', 'bookTicker', symbols, params);
1550
1555
  if (this.newUpdates) {
1551
1556
  return result;
@@ -414,15 +414,7 @@ export default class bitrue extends bitrueRest {
414
414
  async authenticate(params = {}) {
415
415
  const listenKey = this.safeValue(this.options, 'listenKey');
416
416
  if (listenKey === undefined) {
417
- let response = undefined;
418
- try {
419
- response = await this.openPrivatePostPoseidonApiV1ListenKey(params);
420
- }
421
- catch (error) {
422
- this.options['listenKey'] = undefined;
423
- this.options['listenKeyUrl'] = undefined;
424
- return undefined;
425
- }
417
+ const response = await this.openPrivatePostPoseidonApiV1ListenKey(params);
426
418
  //
427
419
  // {
428
420
  // "msg": "succ",
@@ -1517,7 +1517,7 @@ export default class gate extends gateRest {
1517
1517
  const errs = this.safeDict(data, 'errs');
1518
1518
  const error = this.safeDict(message, 'error', errs);
1519
1519
  const code = this.safeString2(error, 'code', 'label');
1520
- const id = this.safeString2(message, 'id', 'requestId');
1520
+ const id = this.safeStringN(message, ['id', 'requestId', 'request_id']);
1521
1521
  if (error !== undefined) {
1522
1522
  const messageHash = this.safeString(client.subscriptions, id);
1523
1523
  try {
@@ -1533,7 +1533,7 @@ export default class gate extends gateRest {
1533
1533
  delete client.subscriptions[messageHash];
1534
1534
  }
1535
1535
  }
1536
- if (id !== undefined) {
1536
+ if ((id !== undefined) && (id in client.subscriptions)) {
1537
1537
  delete client.subscriptions[id];
1538
1538
  }
1539
1539
  return true;
@@ -1821,7 +1821,7 @@ export default class gate extends gateRest {
1821
1821
  'event': event,
1822
1822
  'payload': payload,
1823
1823
  };
1824
- return await this.watch(url, messageHash, request, messageHash);
1824
+ return await this.watch(url, messageHash, request, messageHash, requestId);
1825
1825
  }
1826
1826
  async subscribePrivate(url, messageHash, payload, channel, params, requiresUid = false) {
1827
1827
  this.checkRequiredCredentials();
@@ -1865,6 +1865,6 @@ export default class gate extends gateRest {
1865
1865
  client.subscriptions[tempSubscriptionHash] = messageHash;
1866
1866
  }
1867
1867
  const message = this.extend(request, params);
1868
- return await this.watch(url, messageHash, message, messageHash);
1868
+ return await this.watch(url, messageHash, message, messageHash, messageHash);
1869
1869
  }
1870
1870
  }
package/js/src/pro/okx.js CHANGED
@@ -350,6 +350,8 @@ export default class okx extends okxRest {
350
350
  let channel = undefined;
351
351
  [channel, params] = this.handleOptionAndParams(params, 'watchTicker', 'channel', 'tickers');
352
352
  params['channel'] = channel;
353
+ const market = this.market(symbol);
354
+ symbol = market['symbol'];
353
355
  const ticker = await this.watchTickers([symbol], params);
354
356
  return this.safeValue(ticker, symbol);
355
357
  }
@@ -28,6 +28,7 @@ export default class phemex extends phemexRest {
28
28
  'watchOrderBookForSymbols': false,
29
29
  'watchTradesForSymbols': false,
30
30
  'watchOHLCVForSymbols': false,
31
+ 'watchBalance': true,
31
32
  },
32
33
  'urls': {
33
34
  'test': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.82",
3
+ "version": "4.3.84",
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",