ccxt 4.1.63 → 4.1.64

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.
@@ -26540,10 +26540,39 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
26540
26540
  'has': {
26541
26541
  'CORS': undefined,
26542
26542
  'spot': true,
26543
- 'margin': undefined,
26544
- 'swap': undefined,
26545
- 'future': undefined,
26546
- 'option': undefined,
26543
+ 'margin': false,
26544
+ 'swap': false,
26545
+ 'option': false,
26546
+ 'addMargin': false,
26547
+ 'borrowMargin': false,
26548
+ 'createReduceOnlyOrder': false,
26549
+ 'fetchBorrowInterest': false,
26550
+ 'fetchBorrowRate': false,
26551
+ 'fetchBorrowRateHistories': false,
26552
+ 'fetchBorrowRateHistory': false,
26553
+ 'fetchBorrowRates': false,
26554
+ 'fetchBorrowRatesPerSymbol': false,
26555
+ 'fetchFundingHistory': false,
26556
+ 'fetchFundingRate': false,
26557
+ 'fetchFundingRateHistory': false,
26558
+ 'fetchFundingRates': false,
26559
+ 'fetchIndexOHLCV': false,
26560
+ 'fetchIsolatedPositions': false,
26561
+ 'fetchLeverage': false,
26562
+ 'fetchLeverageTiers': false,
26563
+ 'fetchMarketLeverageTiers': false,
26564
+ 'fetchMarkOHLCV': false,
26565
+ 'fetchOpenInterestHistory': false,
26566
+ 'fetchPosition': false,
26567
+ 'fetchPositions': false,
26568
+ 'fetchPositionsRisk': false,
26569
+ 'fetchPremiumIndexOHLCV': false,
26570
+ 'reduceMargin': false,
26571
+ 'repayMargin': false,
26572
+ 'setLeverage': false,
26573
+ 'setMargin': false,
26574
+ 'setMarginMode': false,
26575
+ 'setPositionMode': false,
26547
26576
  },
26548
26577
  });
26549
26578
  }
@@ -150761,8 +150790,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150761
150790
  //
150762
150791
  // market
150763
150792
  // limit (price = limit price)
150764
- // stop-loss (price = stop loss price)
150765
- // take-profit (price = take profit price)
150793
+ // stop-loss (price = stop loss trigger price)
150794
+ // take-profit (price = take profit trigger price)
150766
150795
  // stop-loss-limit (price = stop loss trigger price, price2 = triggered limit price)
150767
150796
  // take-profit-limit (price = take profit trigger price, price2 = triggered limit price)
150768
150797
  // settle-position
@@ -151033,6 +151062,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
151033
151062
  return result;
151034
151063
  }
151035
151064
  async fetchOrdersByIds(ids, symbol = undefined, params = {}) {
151065
+ /**
151066
+ * @method
151067
+ * @name kraken#fetchOrdersByIds
151068
+ * @description fetch orders by the list of order id
151069
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
151070
+ * @param {string[]|undefined} ids list of order id
151071
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
151072
+ * @returns {object[]} a list of [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
151073
+ */
151036
151074
  await this.loadMarkets();
151037
151075
  const response = await this.privatePostQueryOrders(this.extend({
151038
151076
  'trades': true,
@@ -151528,6 +151566,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
151528
151566
  return await this.fetchDepositAddress(code, this.extend(request, params));
151529
151567
  }
151530
151568
  async fetchDepositMethods(code, params = {}) {
151569
+ /**
151570
+ * @method
151571
+ * @name kraken#fetchDepositMethods
151572
+ * @description fetch deposit methods for a currency associated with this account
151573
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositMethods
151574
+ * @param {string} code unified currency code
151575
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
151576
+ * @returns {object} of deposit methods
151577
+ */
151531
151578
  await this.loadMarkets();
151532
151579
  const currency = this.currency(code);
151533
151580
  const request = {
@@ -152023,7 +152070,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
152023
152070
  },
152024
152071
  'www': 'https://futures.kraken.com/',
152025
152072
  'doc': [
152026
- 'https://support.kraken.com/hc/en-us/categories/360001806372-Futures-API',
152073
+ 'https://docs.futures.kraken.com/#introduction',
152027
152074
  ],
152028
152075
  'fees': 'https://support.kraken.com/hc/en-us/articles/360022835771-Transaction-fees-and-rebates-for-Kraken-Futures',
152029
152076
  'referral': undefined,
@@ -154166,26 +154213,26 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
154166
154213
  */
154167
154214
  await this.loadMarkets();
154168
154215
  const currency = this.currency(code);
154169
- let method = 'privatePostTransfer';
154170
- const request = {
154171
- 'amount': amount,
154172
- };
154173
154216
  if (fromAccount === 'spot') {
154174
154217
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' transfer does not yet support transfers from spot');
154175
154218
  }
154219
+ const request = {
154220
+ 'amount': amount,
154221
+ };
154222
+ let response = undefined;
154176
154223
  if (toAccount === 'spot') {
154177
154224
  if (this.parseAccount(fromAccount) !== 'cash') {
154178
154225
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' transfer cannot transfer from ' + fromAccount + ' to ' + toAccount);
154179
154226
  }
154180
- method = 'privatePostWithdrawal';
154181
154227
  request['currency'] = currency['id'];
154228
+ response = await this.privatePostWithdrawal(this.extend(request, params));
154182
154229
  }
154183
154230
  else {
154184
154231
  request['fromAccount'] = this.parseAccount(fromAccount);
154185
154232
  request['toAccount'] = this.parseAccount(toAccount);
154186
154233
  request['unit'] = currency['id'];
154234
+ response = await this.privatePostTransfer(this.extend(request, params));
154187
154235
  }
154188
- const response = await this[method](this.extend(request, params));
154189
154236
  //
154190
154237
  // {
154191
154238
  // "result": "success",
@@ -167987,17 +168034,17 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
167987
168034
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
167988
168035
  */
167989
168036
  await this.loadMarkets();
167990
- let method = 'publicGetOrderbook';
167991
- if (limit !== undefined) {
167992
- if (limit <= 100) {
167993
- method += 'Top'; // get just the top of the orderbook when limit is low
167994
- }
167995
- }
167996
168037
  const market = this.market(symbol);
167997
168038
  const request = {
167998
168039
  'pair': market['id'],
167999
168040
  };
168000
- const response = await this[method](this.extend(request, params));
168041
+ let response = undefined;
168042
+ if (limit !== undefined && limit <= 100) {
168043
+ response = await this.publicGetOrderbookTop(this.extend(request, params));
168044
+ }
168045
+ else {
168046
+ response = await this.publicGetOrderbook(this.extend(request, params));
168047
+ }
168001
168048
  const timestamp = this.safeInteger(response, 'timestamp');
168002
168049
  return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
168003
168050
  }
@@ -168465,13 +168512,12 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
168465
168512
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
168466
168513
  */
168467
168514
  await this.loadMarkets();
168468
- let method = 'privatePost';
168469
168515
  const market = this.market(symbol);
168470
168516
  const request = {
168471
168517
  'pair': market['id'],
168472
168518
  };
168519
+ let response = undefined;
168473
168520
  if (type === 'market') {
168474
- method += 'Marketorder';
168475
168521
  request['type'] = side.toUpperCase();
168476
168522
  // todo add createMarketBuyOrderRequires price logic as it is implemented in the other exchanges
168477
168523
  if (side === 'buy') {
@@ -168480,14 +168526,14 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
168480
168526
  else {
168481
168527
  request['base_volume'] = this.amountToPrecision(market['symbol'], amount);
168482
168528
  }
168529
+ response = await this.privatePostMarketorder(this.extend(request, params));
168483
168530
  }
168484
168531
  else {
168485
- method += 'Postorder';
168486
168532
  request['volume'] = this.amountToPrecision(market['symbol'], amount);
168487
168533
  request['price'] = this.priceToPrecision(market['symbol'], price);
168488
168534
  request['type'] = (side === 'buy') ? 'BID' : 'ASK';
168535
+ response = await this.privatePostPostorder(this.extend(request, params));
168489
168536
  }
168490
- const response = await this[method](this.extend(request, params));
168491
168537
  return this.safeOrder({
168492
168538
  'info': response,
168493
168539
  'id': response['order_id'],
@@ -194259,11 +194305,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
194259
194305
  'symbol': market['id'],
194260
194306
  // 'id': 123456789, // optional request id
194261
194307
  };
194262
- let method = 'v1GetMdOrderbook';
194308
+ let response = undefined;
194263
194309
  if (market['linear'] && market['settle'] === 'USDT') {
194264
- method = 'v2GetMdV2Orderbook';
194310
+ response = await this.v2GetMdV2Orderbook(this.extend(request, params));
194311
+ }
194312
+ else {
194313
+ response = await this.v1GetMdOrderbook(this.extend(request, params));
194265
194314
  }
194266
- const response = await this[method](this.extend(request, params));
194267
194315
  //
194268
194316
  // {
194269
194317
  // "error": null,
@@ -194568,16 +194616,18 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
194568
194616
  'symbol': market['id'],
194569
194617
  // 'id': 123456789, // optional request id
194570
194618
  };
194571
- let method = 'v1GetMdSpotTicker24hr';
194619
+ let response = undefined;
194572
194620
  if (market['swap']) {
194573
194621
  if (market['inverse'] || market['settle'] === 'USD') {
194574
- method = 'v1GetMdTicker24hr';
194622
+ response = await this.v1GetMdTicker24hr(this.extend(request, params));
194575
194623
  }
194576
194624
  else {
194577
- method = 'v2GetMdV2Ticker24hr';
194625
+ response = await this.v2GetMdV2Ticker24hr(this.extend(request, params));
194578
194626
  }
194579
194627
  }
194580
- const response = await this[method](this.extend(request, params));
194628
+ else {
194629
+ response = await this.v1GetMdSpotTicker24hr(this.extend(request, params));
194630
+ }
194581
194631
  //
194582
194632
  // spot
194583
194633
  //
@@ -194648,18 +194698,16 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
194648
194698
  let subType = undefined;
194649
194699
  [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
194650
194700
  const query = this.omit(params, 'type');
194651
- let defaultMethod;
194701
+ let response = undefined;
194652
194702
  if (type === 'spot') {
194653
- defaultMethod = 'v1GetMdSpotTicker24hrAll';
194703
+ response = await this.v1GetMdSpotTicker24hrAll(query);
194654
194704
  }
194655
- else if (subType === 'inverse') {
194656
- defaultMethod = 'v1GetMdTicker24hrAll';
194705
+ else if (subType === 'inverse' || market['settle'] === 'USD') {
194706
+ response = await this.v1GetMdTicker24hrAll(query);
194657
194707
  }
194658
194708
  else {
194659
- defaultMethod = 'v2GetMdV2Ticker24hrAll';
194709
+ response = await this.v2GetMdV2Ticker24hrAll(query);
194660
194710
  }
194661
- const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
194662
- const response = await this[method](query);
194663
194711
  const result = this.safeValue(response, 'result', []);
194664
194712
  return this.parseTickers(result, symbols);
194665
194713
  }
@@ -194681,11 +194729,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
194681
194729
  'symbol': market['id'],
194682
194730
  // 'id': 123456789, // optional request id
194683
194731
  };
194684
- let method = 'v1GetMdTrade';
194732
+ let response = undefined;
194685
194733
  if (market['linear'] && market['settle'] === 'USDT') {
194686
- method = 'v2GetMdV2Trade';
194734
+ response = await this.v2GetMdV2Trade(this.extend(request, params));
194735
+ }
194736
+ else {
194737
+ response = await this.v1GetMdTrade(this.extend(request, params));
194687
194738
  }
194688
- const response = await this[method](this.extend(request, params));
194689
194739
  //
194690
194740
  // {
194691
194741
  // "error": null,
@@ -195082,18 +195132,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195082
195132
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
195083
195133
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
195084
195134
  * @param {object} [params] extra parameters specific to the phemex api endpoint
195135
+ * @param {string} [params.type] spot or swap
195085
195136
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
195086
195137
  */
195087
195138
  await this.loadMarkets();
195088
195139
  let type = undefined;
195089
195140
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
195090
- let method = 'privateGetSpotWallets';
195141
+ const code = this.safeString(params, 'code');
195142
+ params = this.omit(params, ['type', 'code']);
195143
+ let response = undefined;
195091
195144
  const request = {};
195092
195145
  if ((type !== 'spot') && (type !== 'swap')) {
195093
195146
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' does not support ' + type + ' markets, only spot and swap');
195094
195147
  }
195095
195148
  if (type === 'swap') {
195096
- const code = this.safeString(params, 'code');
195097
195149
  let settle = undefined;
195098
195150
  [settle, params] = this.handleOptionAndParams(params, 'fetchBalance', 'settle');
195099
195151
  if (code !== undefined || settle !== undefined) {
@@ -195107,10 +195159,10 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195107
195159
  const currency = this.currency(coin);
195108
195160
  request['currency'] = currency['id'];
195109
195161
  if (currency['id'] === 'USDT') {
195110
- method = 'privateGetGAccountsAccountPositions';
195162
+ response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
195111
195163
  }
195112
195164
  else {
195113
- method = 'privateGetAccountsAccountPositions';
195165
+ response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
195114
195166
  }
195115
195167
  }
195116
195168
  else {
@@ -195118,10 +195170,12 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195118
195170
  if (currency === undefined) {
195119
195171
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchBalance() requires a code parameter or a currency or settle parameter for ' + type + ' type');
195120
195172
  }
195173
+ response = await this.privateGetSpotWallets(this.extend(request, params));
195121
195174
  }
195122
195175
  }
195123
- params = this.omit(params, ['type', 'code']);
195124
- const response = await this[method](this.extend(request, params));
195176
+ else {
195177
+ response = await this.privateGetSpotWallets(this.extend(request, params));
195178
+ }
195125
195179
  //
195126
195180
  // usdt
195127
195181
  // {
@@ -195648,7 +195702,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195648
195702
  request['clOrdID'] = clientOrderId;
195649
195703
  params = this.omit(params, ['clOrdID', 'clientOrderId']);
195650
195704
  }
195651
- const stopPrice = this.safeString2(params, 'stopPx', 'stopPrice');
195705
+ const stopPrice = this.safeStringN(params, ['stopPx', 'stopPrice', 'triggerPrice']);
195652
195706
  if (stopPrice !== undefined) {
195653
195707
  if (market['settle'] === 'USDT') {
195654
195708
  request['stopPxRp'] = this.priceToPrecision(symbol, stopPrice);
@@ -195657,7 +195711,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195657
195711
  request['stopPxEp'] = this.toEp(stopPrice, market);
195658
195712
  }
195659
195713
  }
195660
- params = this.omit(params, ['stopPx', 'stopPrice', 'stopLoss', 'takeProfit']);
195714
+ params = this.omit(params, ['stopPx', 'stopPrice', 'stopLoss', 'takeProfit', 'triggerPrice']);
195661
195715
  if (market['spot']) {
195662
195716
  let qtyType = this.safeValue(params, 'qtyType', 'ByBase');
195663
195717
  if ((type === 'Market') || (type === 'Stop') || (type === 'MarketIfTouched')) {
@@ -195793,15 +195847,17 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195793
195847
  }
195794
195848
  params = this.omit(params, 'stopLossPrice');
195795
195849
  }
195796
- let method = 'privatePostSpotOrders';
195850
+ params = this.omit(params, 'reduceOnly');
195851
+ let response = undefined;
195797
195852
  if (market['settle'] === 'USDT') {
195798
- method = 'privatePostGOrders';
195853
+ response = await this.privatePostGOrders(this.extend(request, params));
195799
195854
  }
195800
195855
  else if (market['contract']) {
195801
- method = 'privatePostOrders';
195856
+ response = await this.privatePostOrders(this.extend(request, params));
195857
+ }
195858
+ else {
195859
+ response = await this.privatePostSpotOrders(this.extend(request, params));
195802
195860
  }
195803
- params = this.omit(params, 'reduceOnly');
195804
- const response = await this[method](this.extend(request, params));
195805
195861
  //
195806
195862
  // spot
195807
195863
  //
@@ -195943,18 +195999,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195943
195999
  }
195944
196000
  }
195945
196001
  params = this.omit(params, ['stopPx', 'stopPrice']);
195946
- let method = 'privatePutSpotOrders';
196002
+ let response = undefined;
195947
196003
  if (isUSDTSettled) {
195948
- method = 'privatePutGOrdersReplace';
195949
196004
  const posSide = this.safeString(params, 'posSide');
195950
196005
  if (posSide === undefined) {
195951
196006
  request['posSide'] = 'Merged';
195952
196007
  }
196008
+ response = await this.privatePutGOrdersReplace(this.extend(request, params));
195953
196009
  }
195954
196010
  else if (market['swap']) {
195955
- method = 'privatePutOrdersReplace';
196011
+ response = await this.privatePutOrdersReplace(this.extend(request, params));
196012
+ }
196013
+ else {
196014
+ response = await this.privatePutSpotOrders(this.extend(request, params));
195956
196015
  }
195957
- const response = await this[method](this.extend(request, params));
195958
196016
  const data = this.safeValue(response, 'data', {});
195959
196017
  return this.parseOrder(data, market);
195960
196018
  }
@@ -195986,18 +196044,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
195986
196044
  else {
195987
196045
  request['orderID'] = id;
195988
196046
  }
195989
- let method = 'privateDeleteSpotOrders';
196047
+ let response = undefined;
195990
196048
  if (market['settle'] === 'USDT') {
195991
- method = 'privateDeleteGOrdersCancel';
195992
196049
  const posSide = this.safeString(params, 'posSide');
195993
196050
  if (posSide === undefined) {
195994
196051
  request['posSide'] = 'Merged';
195995
196052
  }
196053
+ response = await this.privateDeleteGOrdersCancel(this.extend(request, params));
195996
196054
  }
195997
196055
  else if (market['swap']) {
195998
- method = 'privateDeleteOrdersCancel';
196056
+ response = await this.privateDeleteOrdersCancel(this.extend(request, params));
196057
+ }
196058
+ else {
196059
+ response = await this.privateDeleteSpotOrders(this.extend(request, params));
195999
196060
  }
196000
- const response = await this[method](this.extend(request, params));
196001
196061
  const data = this.safeValue(response, 'data', {});
196002
196062
  return this.parseOrder(data, market);
196003
196063
  }
@@ -196015,21 +196075,23 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196015
196075
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
196016
196076
  }
196017
196077
  await this.loadMarkets();
196078
+ const market = this.market(symbol);
196018
196079
  const request = {
196019
- // 'symbol': market['id'],
196020
- // 'untriggerred': false, // false to cancel non-conditional orders, true to cancel conditional orders
196021
- // 'text': 'up to 40 characters max',
196080
+ 'symbol': market['id'],
196081
+ // 'untriggerred': false, // false to cancel non-conditional orders, true to cancel conditional orders
196082
+ // 'text': 'up to 40 characters max',
196022
196083
  };
196023
- const market = this.market(symbol);
196024
- let method = 'privateDeleteSpotOrdersAll';
196084
+ let response = undefined;
196025
196085
  if (market['settle'] === 'USDT') {
196026
- method = 'privateDeleteGOrdersAll';
196086
+ response = await this.privateDeleteGOrdersAll(this.extend(request, params));
196027
196087
  }
196028
196088
  else if (market['swap']) {
196029
- method = 'privateDeleteOrdersAll';
196089
+ response = await this.privateDeleteOrdersAll(this.extend(request, params));
196030
196090
  }
196031
- request['symbol'] = market['id'];
196032
- return await this[method](this.extend(request, params));
196091
+ else {
196092
+ response = await this.privateDeleteSpotOrdersAll(this.extend(request, params));
196093
+ }
196094
+ return response;
196033
196095
  }
196034
196096
  async fetchOrder(id, symbol = undefined, params = {}) {
196035
196097
  /**
@@ -196048,7 +196110,6 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196048
196110
  if (market['settle'] === 'USDT') {
196049
196111
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + 'fetchOrder() is not supported yet for USDT settled swap markets'); // https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-order-by-orderid-or-query-user-order-by-client-order-id
196050
196112
  }
196051
- const method = market['spot'] ? 'privateGetSpotOrdersActive' : 'privateGetExchangeOrder';
196052
196113
  const request = {
196053
196114
  'symbol': market['id'],
196054
196115
  };
@@ -196060,7 +196121,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196060
196121
  else {
196061
196122
  request['orderID'] = id;
196062
196123
  }
196063
- const response = await this[method](this.extend(request, params));
196124
+ let response = undefined;
196125
+ if (market['spot']) {
196126
+ response = await this.privateGetSpotOrdersActive(this.extend(request, params));
196127
+ }
196128
+ else {
196129
+ response = await this.privateGetExchangeOrder(this.extend(request, params));
196130
+ }
196064
196131
  const data = this.safeValue(response, 'data', {});
196065
196132
  let order = data;
196066
196133
  if (Array.isArray(data)) {
@@ -196097,21 +196164,23 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196097
196164
  const request = {
196098
196165
  'symbol': market['id'],
196099
196166
  };
196100
- let method = 'privateGetSpotOrders';
196101
- if (market['settle'] === 'USDT') {
196102
- request['currency'] = market['settle'];
196103
- method = 'privateGetExchangeOrderV2OrderList';
196104
- }
196105
- else if (market['swap']) {
196106
- method = 'privateGetExchangeOrderList';
196107
- }
196108
196167
  if (since !== undefined) {
196109
196168
  request['start'] = since;
196110
196169
  }
196111
196170
  if (limit !== undefined) {
196112
196171
  request['limit'] = limit;
196113
196172
  }
196114
- const response = await this[method](this.extend(request, params));
196173
+ let response = undefined;
196174
+ if (market['settle'] === 'USDT') {
196175
+ request['currency'] = market['settle'];
196176
+ response = await this.privateGetExchangeOrderV2OrderList(this.extend(request, params));
196177
+ }
196178
+ else if (market['swap']) {
196179
+ response = await this.privateGetExchangeOrderList(this.extend(request, params));
196180
+ }
196181
+ else {
196182
+ response = await this.privateGetSpotOrders(this.extend(request, params));
196183
+ }
196115
196184
  const data = this.safeValue(response, 'data', {});
196116
196185
  const rows = this.safeValue(data, 'rows', data);
196117
196186
  return this.parseOrders(rows, market, since, limit);
@@ -196134,19 +196203,20 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196134
196203
  }
196135
196204
  await this.loadMarkets();
196136
196205
  const market = this.market(symbol);
196137
- let method = 'privateGetSpotOrders';
196138
- if (market['settle'] === 'USDT') {
196139
- method = 'privateGetGOrdersActiveList';
196140
- }
196141
- else if (market['swap']) {
196142
- method = 'privateGetOrdersActiveList';
196143
- }
196144
196206
  const request = {
196145
196207
  'symbol': market['id'],
196146
196208
  };
196147
196209
  let response = undefined;
196148
196210
  try {
196149
- response = await this[method](this.extend(request, params));
196211
+ if (market['settle'] === 'USDT') {
196212
+ response = await this.privateGetGOrdersActiveList(this.extend(request, params));
196213
+ }
196214
+ else if (market['swap']) {
196215
+ response = await this.privateGetOrdersActiveList(this.extend(request, params));
196216
+ }
196217
+ else {
196218
+ response = await this.privateGetSpotOrders(this.extend(request, params));
196219
+ }
196150
196220
  }
196151
196221
  catch (e) {
196152
196222
  if (e instanceof _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound) {
@@ -196183,21 +196253,23 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196183
196253
  const request = {
196184
196254
  'symbol': market['id'],
196185
196255
  };
196186
- let method = 'privateGetExchangeSpotOrder';
196187
- if (market['settle'] === 'USDT') {
196188
- request['currency'] = market['settle'];
196189
- method = 'privateGetExchangeOrderV2OrderList';
196190
- }
196191
- else if (market['swap']) {
196192
- method = 'privateGetExchangeOrderList';
196193
- }
196194
196256
  if (since !== undefined) {
196195
196257
  request['start'] = since;
196196
196258
  }
196197
196259
  if (limit !== undefined) {
196198
196260
  request['limit'] = limit;
196199
196261
  }
196200
- const response = await this[method](this.extend(request, params));
196262
+ let response = undefined;
196263
+ if (market['settle'] === 'USDT') {
196264
+ request['currency'] = market['settle'];
196265
+ response = await this.privateGetExchangeOrderV2OrderList(this.extend(request, params));
196266
+ }
196267
+ else if (market['swap']) {
196268
+ response = await this.privateGetExchangeOrderList(this.extend(request, params));
196269
+ }
196270
+ else {
196271
+ response = await this.privateGetExchangeSpotOrder(this.extend(request, params));
196272
+ }
196201
196273
  //
196202
196274
  // spot
196203
196275
  //
@@ -196261,13 +196333,6 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196261
196333
  }
196262
196334
  await this.loadMarkets();
196263
196335
  const market = this.market(symbol);
196264
- let method = 'privateGetExchangeSpotOrderTrades';
196265
- if (market['swap']) {
196266
- method = 'privateGetExchangeOrderTrade';
196267
- if (market['settle'] === 'USDT') {
196268
- method = 'privateGetExchangeOrderV2TradingList';
196269
- }
196270
- }
196271
196336
  const request = {};
196272
196337
  if (limit !== undefined) {
196273
196338
  limit = Math.min(200, limit);
@@ -196289,7 +196354,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196289
196354
  if (market['swap'] && (limit !== undefined)) {
196290
196355
  request['limit'] = limit;
196291
196356
  }
196292
- const response = await this[method](this.extend(request, params));
196357
+ const isUSDTSettled = market['settle'] === 'USDT';
196358
+ let response = undefined;
196359
+ if (market['swap']) {
196360
+ if (isUSDTSettled) {
196361
+ response = await this.privateGetExchangeOrderV2TradingList(this.extend(request, params));
196362
+ }
196363
+ else {
196364
+ response = await this.privateGetExchangeOrderTrade(this.extend(request, params));
196365
+ }
196366
+ }
196367
+ else {
196368
+ response = await this.privateGetExchangeSpotOrderTrades(this.extend(request, params));
196369
+ }
196293
196370
  //
196294
196371
  // spot
196295
196372
  //
@@ -196394,10 +196471,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196394
196471
  // }
196395
196472
  // }
196396
196473
  //
196397
- const data = this.safeValue(response, 'data', {});
196398
- if (method !== 'privateGetExchangeOrderV2TradingList') {
196399
- const rows = this.safeValue(data, 'rows', []);
196400
- return this.parseTrades(rows, market, since, limit);
196474
+ let data = undefined;
196475
+ if (isUSDTSettled) {
196476
+ data = this.safeValue(response, 'data', []);
196477
+ }
196478
+ else {
196479
+ data = this.safeValue(response, 'data', {});
196480
+ data = this.safeValue(data, 'rows', []);
196401
196481
  }
196402
196482
  return this.parseTrades(data, market, since, limit);
196403
196483
  }
@@ -196629,7 +196709,6 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196629
196709
  await this.loadMarkets();
196630
196710
  symbols = this.marketSymbols(symbols);
196631
196711
  let subType = undefined;
196632
- let method = 'privateGetAccountsAccountPositions';
196633
196712
  let code = this.safeString(params, 'currency');
196634
196713
  let settle = undefined;
196635
196714
  let market = undefined;
@@ -196643,9 +196722,9 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196643
196722
  [settle, params] = this.handleOptionAndParams(params, 'fetchPositions', 'settle', 'USD');
196644
196723
  }
196645
196724
  [subType, params] = this.handleSubTypeAndParams('fetchPositions', market, params);
196646
- if (settle === 'USDT') {
196725
+ const isUSDTSettled = settle === 'USDT';
196726
+ if (isUSDTSettled) {
196647
196727
  code = 'USDT';
196648
- method = 'privateGetGAccountsAccountPositions';
196649
196728
  }
196650
196729
  else if (code === undefined) {
196651
196730
  code = (subType === 'linear') ? 'USD' : 'BTC';
@@ -196657,7 +196736,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
196657
196736
  const request = {
196658
196737
  'currency': currency['id'],
196659
196738
  };
196660
- const response = await this[method](this.extend(request, params));
196739
+ let response = undefined;
196740
+ if (isUSDTSettled) {
196741
+ response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
196742
+ }
196743
+ else {
196744
+ response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
196745
+ }
196661
196746
  //
196662
196747
  // {
196663
196748
  // "code":0,"msg":"",
@@ -236963,7 +237048,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
236963
237048
  * @param {int} [limit] not used by krakenfutures watchBalance
236964
237049
  * @param {object} [params] extra parameters specific to the krakenfutures api endpoint
236965
237050
  * @param {string} [params.account] can be either 'futures' or 'flex_futures'
236966
- * @returns {object[]} a list of [balance structures]{@link https://docs.ccxt.com/#/?id=balance-structure}
237051
+ * @returns {object} a object of wallet types each with a balance structure {@link https://docs.ccxt.com/#/?id=balance-structure}
236967
237052
  */
236968
237053
  await this.loadMarkets();
236969
237054
  const name = 'balances';
@@ -237828,6 +237913,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
237828
237913
  holdingResult[code] = newAccount;
237829
237914
  }
237830
237915
  this.balance['cash'] = holdingResult;
237916
+ this.balance['cash'] = this.safeBalance(this.balance['cash']);
237831
237917
  client.resolve(holdingResult, messageHash);
237832
237918
  }
237833
237919
  if (futures !== undefined) {
@@ -237851,6 +237937,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
237851
237937
  futuresResult[symbol][code] = newAccount;
237852
237938
  }
237853
237939
  this.balance['margin'] = futuresResult;
237940
+ this.balance['margin'] = this.safeBalance(this.balance['margin']);
237854
237941
  client.resolve(this.balance['margin'], messageHash + 'futures');
237855
237942
  }
237856
237943
  if (flexFutures !== undefined) {
@@ -237872,6 +237959,7 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
237872
237959
  flexFuturesResult[code] = newAccount;
237873
237960
  }
237874
237961
  this.balance['flex'] = flexFuturesResult;
237962
+ this.balance['flex'] = this.safeBalance(this.balance['flex']);
237875
237963
  client.resolve(this.balance['flex'], messageHash + 'flex_futures');
237876
237964
  }
237877
237965
  client.resolve(this.balance, messageHash);
@@ -266244,9 +266332,7 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
266244
266332
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
266245
266333
  */
266246
266334
  await this.loadMarkets();
266247
- const defaultMethod = 'binanceGetTicker24hr';
266248
- const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
266249
- const response = await this[method](params);
266335
+ const response = await this.binanceGetTicker24hr(params);
266250
266336
  return this.parseTickers(response, symbols);
266251
266337
  }
266252
266338
  getMarketIdByType(market) {
@@ -272546,7 +272632,13 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
272546
272632
  request['limit'] = Math.min(limit, 1000); // Default 500; max 1000.
272547
272633
  }
272548
272634
  const method = this.safeString(this.options, 'fetchTradesMethod', 'publicGetTrades');
272549
- const response = await this[method](this.extend(request, params));
272635
+ let response = undefined;
272636
+ if (method === 'privateGetHistoricalTrades') {
272637
+ response = await this.privateGetHistoricalTrades(this.extend(request, params));
272638
+ }
272639
+ else {
272640
+ response = await this.publicGetTrades(this.extend(request, params));
272641
+ }
272550
272642
  // [
272551
272643
  // {
272552
272644
  // "id":322307791,
@@ -287467,7 +287559,7 @@ SOFTWARE.
287467
287559
 
287468
287560
  //-----------------------------------------------------------------------------
287469
287561
  // this is updated by vss.js when building
287470
- const version = '4.1.63';
287562
+ const version = '4.1.64';
287471
287563
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
287472
287564
  //-----------------------------------------------------------------------------
287473
287565