ccxt 4.2.22 → 4.2.23

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/README.md CHANGED
@@ -209,13 +209,13 @@ console.log(version, Object.keys(exchanges));
209
209
 
210
210
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
211
211
 
212
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.22/dist/ccxt.browser.js
213
- * unpkg: https://unpkg.com/ccxt@4.2.22/dist/ccxt.browser.js
212
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.23/dist/ccxt.browser.js
213
+ * unpkg: https://unpkg.com/ccxt@4.2.23/dist/ccxt.browser.js
214
214
 
215
215
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
216
216
 
217
217
  ```HTML
218
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.22/dist/ccxt.browser.js"></script>
218
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.23/dist/ccxt.browser.js"></script>
219
219
  ```
220
220
 
221
221
  Creates a global `ccxt` object:
@@ -36689,6 +36689,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
36689
36689
  'fetchMarkOHLCV': false,
36690
36690
  'fetchMyTrades': true,
36691
36691
  'fetchOHLCV': true,
36692
+ 'fetchOpenInterest': true,
36692
36693
  'fetchOpenOrder': true,
36693
36694
  'fetchOpenOrders': true,
36694
36695
  'fetchOrder': true,
@@ -39620,6 +39621,94 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
39620
39621
  'previousFundingDatetime': undefined,
39621
39622
  };
39622
39623
  }
39624
+ async fetchOpenInterest(symbol, params = {}) {
39625
+ /**
39626
+ * @method
39627
+ * @name bitfinex2#fetchOpenInterest
39628
+ * @description retrieves the open interest of a contract trading pair
39629
+ * @see https://docs.bitfinex.com/reference/rest-public-derivatives-status
39630
+ * @param {string} symbol unified CCXT market symbol
39631
+ * @param {object} [params] exchange specific parameters
39632
+ * @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
39633
+ */
39634
+ await this.loadMarkets();
39635
+ const market = this.market(symbol);
39636
+ const request = {
39637
+ 'keys': market['id'],
39638
+ };
39639
+ const response = await this.publicGetStatusDeriv(this.extend(request, params));
39640
+ //
39641
+ // [
39642
+ // [
39643
+ // "tXRPF0:USTF0", // market id
39644
+ // 1706256986000, // millisecond timestamp
39645
+ // null,
39646
+ // 0.512705, // derivative mid price
39647
+ // 0.512395, // underlying spot mid price
39648
+ // null,
39649
+ // 37671483.04, // insurance fund balance
39650
+ // null,
39651
+ // 1706284800000, // timestamp of next funding
39652
+ // 0.00002353, // accrued funding for next period
39653
+ // 317, // next funding step
39654
+ // null,
39655
+ // 0, // current funding
39656
+ // null,
39657
+ // null,
39658
+ // 0.5123016, // mark price
39659
+ // null,
39660
+ // null,
39661
+ // 2233562.03115, // open interest in contracts
39662
+ // null,
39663
+ // null,
39664
+ // null,
39665
+ // 0.0005, // average spread without funding payment
39666
+ // 0.0025 // funding payment cap
39667
+ // ]
39668
+ // ]
39669
+ //
39670
+ return this.parseOpenInterest(response[0], market);
39671
+ }
39672
+ parseOpenInterest(interest, market = undefined) {
39673
+ //
39674
+ // [
39675
+ // "tXRPF0:USTF0", // market id
39676
+ // 1706256986000, // millisecond timestamp
39677
+ // null,
39678
+ // 0.512705, // derivative mid price
39679
+ // 0.512395, // underlying spot mid price
39680
+ // null,
39681
+ // 37671483.04, // insurance fund balance
39682
+ // null,
39683
+ // 1706284800000, // timestamp of next funding
39684
+ // 0.00002353, // accrued funding for next period
39685
+ // 317, // next funding step
39686
+ // null,
39687
+ // 0, // current funding
39688
+ // null,
39689
+ // null,
39690
+ // 0.5123016, // mark price
39691
+ // null,
39692
+ // null,
39693
+ // 2233562.03115, // open interest in contracts
39694
+ // null,
39695
+ // null,
39696
+ // null,
39697
+ // 0.0005, // average spread without funding payment
39698
+ // 0.0025 // funding payment cap
39699
+ // ]
39700
+ //
39701
+ const timestamp = this.safeInteger(interest, 1);
39702
+ const marketId = this.safeString(interest, 0);
39703
+ return this.safeOpenInterest({
39704
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
39705
+ 'openInterestAmount': this.safeNumber(interest, 18),
39706
+ 'openInterestValue': undefined,
39707
+ 'timestamp': timestamp,
39708
+ 'datetime': this.iso8601(timestamp),
39709
+ 'info': interest,
39710
+ }, market);
39711
+ }
39623
39712
  }
39624
39713
 
39625
39714
 
@@ -41595,16 +41684,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41595
41684
  'createOrder': true,
41596
41685
  'createOrders': true,
41597
41686
  'createOrderWithTakeProfitAndStopLoss': true,
41598
- 'createReduceOnlyOrder': false,
41599
- 'createStopLossOrder': true,
41600
- 'createTakeProfitOrder': true,
41601
41687
  'createPostOnlyOrder': true,
41602
- 'createStopOrder': true,
41688
+ 'createReduceOnlyOrder': false,
41603
41689
  'createStopLimitOrder': true,
41690
+ 'createStopLossOrder': true,
41604
41691
  'createStopMarketOrder': true,
41692
+ 'createStopOrder': true,
41693
+ 'createTakeProfitOrder': true,
41694
+ 'createTrailingAmountOrder': false,
41605
41695
  'createTrailingPercentOrder': true,
41606
41696
  'createTriggerOrder': true,
41607
- 'signIn': false,
41608
41697
  'editOrder': true,
41609
41698
  'fetchAccounts': false,
41610
41699
  'fetchBalance': true,
@@ -41620,12 +41709,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41620
41709
  'fetchDepositAddress': true,
41621
41710
  'fetchDepositAddresses': false,
41622
41711
  'fetchDeposits': true,
41712
+ 'fetchDepositsWithdrawals': false,
41623
41713
  'fetchDepositWithdrawFee': 'emulated',
41624
41714
  'fetchDepositWithdrawFees': true,
41625
- 'fetchDepositsWithdrawals': false,
41626
41715
  'fetchFundingHistory': true,
41627
- 'fetchWithdrawAddresses': false,
41628
- 'fetchTransactions': false,
41629
41716
  'fetchFundingRate': true,
41630
41717
  'fetchFundingRateHistory': true,
41631
41718
  'fetchFundingRates': false,
@@ -41649,7 +41736,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41649
41736
  'fetchOrder': true,
41650
41737
  'fetchOrderBook': true,
41651
41738
  'fetchOrders': false,
41652
- 'createTrailingAmountOrder': false,
41653
41739
  'fetchOrderTrades': false,
41654
41740
  'fetchPosition': true,
41655
41741
  'fetchPositionMode': false,
@@ -41662,8 +41748,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41662
41748
  'fetchTrades': true,
41663
41749
  'fetchTradingFee': true,
41664
41750
  'fetchTradingFees': true,
41751
+ 'fetchTransactions': false,
41665
41752
  'fetchTransfer': false,
41666
41753
  'fetchTransfers': true,
41754
+ 'fetchWithdrawAddresses': false,
41667
41755
  'fetchWithdrawal': false,
41668
41756
  'fetchWithdrawals': true,
41669
41757
  'reduceMargin': true,
@@ -41672,6 +41760,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41672
41760
  'setLeverage': true,
41673
41761
  'setMarginMode': true,
41674
41762
  'setPositionMode': true,
41763
+ 'signIn': false,
41675
41764
  'transfer': true,
41676
41765
  'withdraw': true,
41677
41766
  },
@@ -89883,8 +89972,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
89883
89972
  'fetchDepositAddress': false,
89884
89973
  'fetchDeposits': true,
89885
89974
  'fetchDepositsWithdrawals': true,
89886
- 'fetchLedger': true,
89887
89975
  'fetchFundingRate': false,
89976
+ 'fetchLedger': true,
89888
89977
  'fetchMarginMode': false,
89889
89978
  'fetchMarkets': true,
89890
89979
  'fetchMyTrades': true,
@@ -96086,11 +96175,17 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96086
96175
  * @name coinex#fetchPositions
96087
96176
  * @description fetch all open positions
96088
96177
  * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
96089
- * @param {string[]|undefined} symbols list of unified market symbols
96178
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
96179
+ * @param {string[]} [symbols] list of unified market symbols
96090
96180
  * @param {object} [params] extra parameters specific to the exchange API endpoint
96181
+ * @param {string} [params.method] the method to use 'perpetualPrivateGetPositionPending' or 'perpetualPrivateGetPositionFinished' default is 'perpetualPrivateGetPositionPending'
96182
+ * @param {int} [params.side] *history endpoint only* 0: All, 1: Sell, 2: Buy, default is 0
96091
96183
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
96092
96184
  */
96093
96185
  await this.loadMarkets();
96186
+ let defaultMethod = undefined;
96187
+ [defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'perpetualPrivateGetPositionPending');
96188
+ const isHistory = (defaultMethod === 'perpetualPrivateGetPositionFinished');
96094
96189
  symbols = this.marketSymbols(symbols);
96095
96190
  const request = {};
96096
96191
  let market = undefined;
@@ -96109,7 +96204,22 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96109
96204
  market = this.market(symbol);
96110
96205
  request['market'] = market['id'];
96111
96206
  }
96112
- const response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
96207
+ else {
96208
+ if (isHistory) {
96209
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchPositions() requires a symbol argument for closed positions');
96210
+ }
96211
+ }
96212
+ if (isHistory) {
96213
+ request['limit'] = 100;
96214
+ request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
96215
+ }
96216
+ let response = undefined;
96217
+ if (defaultMethod === 'perpetualPrivateGetPositionPending') {
96218
+ response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
96219
+ }
96220
+ else {
96221
+ response = await this.perpetualPrivateGetPositionFinished(this.extend(request, params));
96222
+ }
96113
96223
  //
96114
96224
  // {
96115
96225
  // "code": 0,
@@ -191858,12 +191968,26 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
191858
191968
  const request = {
191859
191969
  'instId': market['id'],
191860
191970
  };
191971
+ let isAlgoOrder = undefined;
191972
+ if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
191973
+ isAlgoOrder = true;
191974
+ }
191861
191975
  const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
191862
191976
  if (clientOrderId !== undefined) {
191863
- request['clOrdId'] = clientOrderId;
191977
+ if (isAlgoOrder) {
191978
+ request['algoClOrdId'] = clientOrderId;
191979
+ }
191980
+ else {
191981
+ request['clOrdId'] = clientOrderId;
191982
+ }
191864
191983
  }
191865
191984
  else {
191866
- request['ordId'] = id;
191985
+ if (isAlgoOrder) {
191986
+ request['algoId'] = id;
191987
+ }
191988
+ else {
191989
+ request['ordId'] = id;
191990
+ }
191867
191991
  }
191868
191992
  let stopLossTriggerPrice = this.safeValue2(params, 'stopLossPrice', 'newSlTriggerPx');
191869
191993
  let stopLossPrice = this.safeValue(params, 'newSlOrdPx');
@@ -191875,37 +191999,62 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
191875
191999
  const takeProfit = this.safeValue(params, 'takeProfit');
191876
192000
  const stopLossDefined = (stopLoss !== undefined);
191877
192001
  const takeProfitDefined = (takeProfit !== undefined);
191878
- if (stopLossTriggerPrice !== undefined) {
191879
- request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
191880
- request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
191881
- request['newSlTriggerPxType'] = stopLossTriggerPriceType;
191882
- }
191883
- if (takeProfitTriggerPrice !== undefined) {
191884
- request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
191885
- request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
191886
- request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
191887
- }
191888
- if (stopLossDefined) {
191889
- stopLossTriggerPrice = this.safeValue(stopLoss, 'triggerPrice');
191890
- stopLossPrice = this.safeValue(stopLoss, 'price');
191891
- const stopLossType = this.safeString(stopLoss, 'type');
191892
- request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
191893
- request['newSlOrdPx'] = (stopLossType === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
191894
- request['newSlTriggerPxType'] = stopLossTriggerPriceType;
191895
- }
191896
- if (takeProfitDefined) {
191897
- takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
191898
- takeProfitPrice = this.safeValue(takeProfit, 'price');
191899
- const takeProfitType = this.safeString(takeProfit, 'type');
191900
- request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
191901
- request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
191902
- request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
192002
+ if (isAlgoOrder) {
192003
+ if ((stopLossTriggerPrice === undefined) && (takeProfitTriggerPrice === undefined)) {
192004
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a stopLossPrice or takeProfitPrice parameter for editing an algo order');
192005
+ }
192006
+ if (stopLossTriggerPrice !== undefined) {
192007
+ if (stopLossPrice === undefined) {
192008
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a newSlOrdPx parameter for editing an algo order');
192009
+ }
192010
+ request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
192011
+ request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
192012
+ request['newSlTriggerPxType'] = stopLossTriggerPriceType;
192013
+ }
192014
+ if (takeProfitTriggerPrice !== undefined) {
192015
+ if (takeProfitPrice === undefined) {
192016
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a newTpOrdPx parameter for editing an algo order');
192017
+ }
192018
+ request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
192019
+ request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
192020
+ request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
192021
+ }
192022
+ }
192023
+ else {
192024
+ if (stopLossTriggerPrice !== undefined) {
192025
+ request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
192026
+ request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
192027
+ request['newSlTriggerPxType'] = stopLossTriggerPriceType;
192028
+ }
192029
+ if (takeProfitTriggerPrice !== undefined) {
192030
+ request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
192031
+ request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
192032
+ request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
192033
+ }
192034
+ if (stopLossDefined) {
192035
+ stopLossTriggerPrice = this.safeValue(stopLoss, 'triggerPrice');
192036
+ stopLossPrice = this.safeValue(stopLoss, 'price');
192037
+ const stopLossType = this.safeString(stopLoss, 'type');
192038
+ request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
192039
+ request['newSlOrdPx'] = (stopLossType === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
192040
+ request['newSlTriggerPxType'] = stopLossTriggerPriceType;
192041
+ }
192042
+ if (takeProfitDefined) {
192043
+ takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
192044
+ takeProfitPrice = this.safeValue(takeProfit, 'price');
192045
+ const takeProfitType = this.safeString(takeProfit, 'type');
192046
+ request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
192047
+ request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
192048
+ request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
192049
+ }
191903
192050
  }
191904
192051
  if (amount !== undefined) {
191905
192052
  request['newSz'] = this.amountToPrecision(symbol, amount);
191906
192053
  }
191907
- if (price !== undefined) {
191908
- request['newPx'] = this.priceToPrecision(symbol, price);
192054
+ if (!isAlgoOrder) {
192055
+ if (price !== undefined) {
192056
+ request['newPx'] = this.priceToPrecision(symbol, price);
192057
+ }
191909
192058
  }
191910
192059
  params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
191911
192060
  return this.extend(request, params);
@@ -191915,7 +192064,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
191915
192064
  * @method
191916
192065
  * @name okx#editOrder
191917
192066
  * @description edit a trade order
191918
- * @see https://www.okx.com/docs-v5/en/#rest-api-trade-amend-order
192067
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
192068
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
191919
192069
  * @param {string} id order id
191920
192070
  * @param {string} symbol unified symbol of the market to create an order in
191921
192071
  * @param {string} type 'market' or 'limit'
@@ -191943,7 +192093,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
191943
192093
  await this.loadMarkets();
191944
192094
  const market = this.market(symbol);
191945
192095
  const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
191946
- const response = await this.privatePostTradeAmendOrder(this.extend(request, params));
192096
+ let isAlgoOrder = undefined;
192097
+ if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
192098
+ isAlgoOrder = true;
192099
+ }
192100
+ let response = undefined;
192101
+ if (isAlgoOrder) {
192102
+ response = await this.privatePostTradeAmendAlgos(this.extend(request, params));
192103
+ }
192104
+ else {
192105
+ response = await this.privatePostTradeAmendOrder(this.extend(request, params));
192106
+ }
191947
192107
  //
191948
192108
  // {
191949
192109
  // "code": "0",
@@ -203682,8 +203842,10 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
203682
203842
  * @description fetch all open positions
203683
203843
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
203684
203844
  * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
203685
- * @param {string[]|undefined} symbols list of unified market symbols
203845
+ * @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
203846
+ * @param {string[]} [symbols] list of unified market symbols
203686
203847
  * @param {object} [params] extra parameters specific to the exchange API endpoint
203848
+ * @param {string} [param.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
203687
203849
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
203688
203850
  */
203689
203851
  await this.loadMarkets();
@@ -203718,7 +203880,14 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
203718
203880
  };
203719
203881
  let response = undefined;
203720
203882
  if (isUSDTSettled) {
203721
- response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
203883
+ let method = undefined;
203884
+ [method, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'privateGetGAccountsAccountPositions');
203885
+ if (method === 'privateGetGAccountsAccountPositions') {
203886
+ response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
203887
+ }
203888
+ else {
203889
+ response = await this.privateGetAccountsPositions(this.extend(request, params));
203890
+ }
203722
203891
  }
203723
203892
  else {
203724
203893
  response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
@@ -203894,7 +204063,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
203894
204063
  const contracts = this.safeString(position, 'size');
203895
204064
  const contractSize = this.safeValue(market, 'contractSize');
203896
204065
  const contractSizeString = this.numberToString(contractSize);
203897
- const leverage = this.safeNumber2(position, 'leverage', 'leverageRr');
204066
+ const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.safeString(position, 'leverage', 'leverageRr'))));
203898
204067
  const entryPriceString = this.safeString2(position, 'avgEntryPrice', 'avgEntryPriceRp');
203899
204068
  const rawSide = this.safeString(position, 'side');
203900
204069
  let side = undefined;
@@ -204921,6 +205090,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
204921
205090
  'fetchDepositsWithdrawals': true,
204922
205091
  'fetchDepositWithdrawFee': 'emulated',
204923
205092
  'fetchDepositWithdrawFees': true,
205093
+ 'fetchFundingRate': false,
204924
205094
  'fetchMarginMode': false,
204925
205095
  'fetchMarkets': true,
204926
205096
  'fetchMyTrades': true,
@@ -204931,7 +205101,6 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
204931
205101
  'fetchOrder': true,
204932
205102
  'fetchOrderBook': true,
204933
205103
  'fetchOrderBooks': false,
204934
- 'fetchFundingRate': false,
204935
205104
  'fetchOrderTrades': true,
204936
205105
  'fetchPosition': false,
204937
205106
  'fetchPositionMode': false,
@@ -211770,7 +211939,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
211770
211939
  }
211771
211940
  else {
211772
211941
  // take the timestamp of the closing price for candlestick streams
211773
- timestamp = this.safeInteger(message, 'C');
211942
+ timestamp = this.safeInteger2(message, 'C', 'E');
211774
211943
  }
211775
211944
  const marketId = this.safeString(message, 's');
211776
211945
  const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
@@ -236756,6 +236925,12 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
236756
236925
  'private': 'wss://api.hitbtc.com/api/3/ws/trading',
236757
236926
  },
236758
236927
  },
236928
+ 'test': {
236929
+ 'ws': {
236930
+ 'public': 'wss://api.demo.hitbtc.com/api/3/ws/public',
236931
+ 'private': 'wss://api.demo.hitbtc.com/api/3/ws/trading',
236932
+ },
236933
+ },
236759
236934
  },
236760
236935
  'options': {
236761
236936
  'tradesLimit': 1000,
@@ -252202,13 +252377,15 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
252202
252377
  /**
252203
252378
  * @method
252204
252379
  * @name okx#watchMyTrades
252205
- * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
252206
252380
  * @description watches information on multiple trades made by the user
252381
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
252207
252382
  * @param {string} [symbol] unified market symbol of the market trades were made in
252208
252383
  * @param {int} [since] the earliest time in ms to fetch trades for
252209
252384
  * @param {int} [limit] the maximum number of trade structures to retrieve
252210
252385
  * @param {object} [params] extra parameters specific to the exchange API endpoint
252211
252386
  * @param {bool} [params.stop] true if fetching trigger or conditional trades
252387
+ * @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
252388
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
252212
252389
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
252213
252390
  */
252214
252391
  // By default, receive order updates from any instrument type
@@ -252230,7 +252407,14 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
252230
252407
  if (type === 'future') {
252231
252408
  type = 'futures';
252232
252409
  }
252233
- const uppercaseType = type.toUpperCase();
252410
+ let uppercaseType = type.toUpperCase();
252411
+ let marginMode = undefined;
252412
+ [marginMode, params] = this.handleMarginModeAndParams('watchMyTrades', params);
252413
+ if (uppercaseType === 'SPOT') {
252414
+ if (marginMode !== undefined) {
252415
+ uppercaseType = 'MARGIN';
252416
+ }
252417
+ }
252234
252418
  const request = {
252235
252419
  'instType': uppercaseType,
252236
252420
  };
@@ -252376,7 +252560,6 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
252376
252560
  */
252377
252561
  let type = undefined;
252378
252562
  // By default, receive order updates from any instrument type
252379
- [type, params] = this.handleOptionAndParams(params, 'watchOrders', 'defaultType');
252380
252563
  [type, params] = this.handleOptionAndParams(params, 'watchOrders', 'type', 'ANY');
252381
252564
  const isStop = this.safeValue2(params, 'stop', 'trigger', false);
252382
252565
  params = this.omit(params, ['stop', 'trigger']);
@@ -296581,7 +296764,7 @@ SOFTWARE.
296581
296764
 
296582
296765
  //-----------------------------------------------------------------------------
296583
296766
  // this is updated by vss.js when building
296584
- const version = '4.2.22';
296767
+ const version = '4.2.23';
296585
296768
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
296586
296769
  //-----------------------------------------------------------------------------
296587
296770