ccxt 4.3.82 → 4.3.83

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.83';
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
  }
@@ -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
  }
@@ -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
  }
@@ -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);
@@ -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.82";
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.83';
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
  }
@@ -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
  }
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/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);
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.83",
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",