ccxt 4.1.76 → 4.1.78

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.
Files changed (64) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +574 -185
  3. package/dist/ccxt.browser.min.js +5 -5
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bingx.js +4 -1
  6. package/dist/cjs/src/bitget.js +71 -0
  7. package/dist/cjs/src/bitmart.js +9 -13
  8. package/dist/cjs/src/bitmex.js +6 -0
  9. package/dist/cjs/src/bitrue.js +27 -1
  10. package/dist/cjs/src/bitstamp.js +3 -2
  11. package/dist/cjs/src/bybit.js +2 -0
  12. package/dist/cjs/src/coinbase.js +47 -9
  13. package/dist/cjs/src/coinex.js +7 -11
  14. package/dist/cjs/src/gate.js +5 -0
  15. package/dist/cjs/src/hitbtc.js +326 -123
  16. package/dist/cjs/src/idex.js +10 -1
  17. package/dist/cjs/src/mexc.js +33 -5
  18. package/dist/cjs/src/okx.js +6 -10
  19. package/dist/cjs/src/pro/binance.js +10 -2
  20. package/dist/cjs/src/pro/binanceus.js +1 -0
  21. package/dist/cjs/src/pro/gate.js +1 -1
  22. package/dist/cjs/src/upbit.js +5 -5
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/bybit.d.ts +2 -0
  26. package/js/src/abstract/gate.d.ts +3 -0
  27. package/js/src/abstract/gateio.d.ts +3 -0
  28. package/js/src/abstract/okx.d.ts +2 -0
  29. package/js/src/base/Exchange.d.ts +1 -1
  30. package/js/src/bingx.js +4 -1
  31. package/js/src/bitget.d.ts +5 -4
  32. package/js/src/bitget.js +71 -0
  33. package/js/src/bitmart.js +9 -13
  34. package/js/src/bitmex.d.ts +1 -1
  35. package/js/src/bitmex.js +6 -0
  36. package/js/src/bitrue.d.ts +1 -0
  37. package/js/src/bitrue.js +27 -1
  38. package/js/src/bitstamp.js +3 -2
  39. package/js/src/bybit.js +2 -0
  40. package/js/src/coinbase.d.ts +1 -0
  41. package/js/src/coinbase.js +47 -9
  42. package/js/src/coinex.js +7 -11
  43. package/js/src/gate.js +5 -0
  44. package/js/src/hitbtc.js +326 -123
  45. package/js/src/idex.js +10 -1
  46. package/js/src/mexc.d.ts +1 -0
  47. package/js/src/mexc.js +33 -5
  48. package/js/src/okx.js +6 -10
  49. package/js/src/pro/binance.js +10 -2
  50. package/js/src/pro/binanceus.js +1 -0
  51. package/js/src/pro/gate.js +1 -1
  52. package/js/src/upbit.js +5 -5
  53. package/package.json +1 -1
  54. package/skip-tests.json +2 -1
  55. package/js/src/huobipro.d.ts +0 -4
  56. package/js/src/huobipro.js +0 -20
  57. package/js/src/mexc3.d.ts +0 -4
  58. package/js/src/mexc3.js +0 -17
  59. package/js/src/okex.d.ts +0 -4
  60. package/js/src/okex.js +0 -17
  61. package/js/src/okex5.d.ts +0 -4
  62. package/js/src/okex5.js +0 -17
  63. package/js/src/tidex.d.ts +0 -36
  64. package/js/src/tidex.js +0 -1068
@@ -26939,6 +26939,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26939
26939
  'cancelAllOrders': true,
26940
26940
  'cancelOrder': true,
26941
26941
  'cancelOrders': true,
26942
+ 'closeAllPositions': true,
26943
+ 'closePosition': false,
26942
26944
  'createMarketBuyOrderWithCost': true,
26943
26945
  'createMarketOrderWithCost': true,
26944
26946
  'createMarketSellOrderWithCost': true,
@@ -28283,7 +28285,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28283
28285
  const close = this.safeString(ticker, 'lastPrice');
28284
28286
  const quoteVolume = this.safeString(ticker, 'quoteVolume');
28285
28287
  const baseVolume = this.safeString(ticker, 'volume');
28286
- const percentage = this.safeString(ticker, 'priceChangePercent');
28288
+ let percentage = this.safeString(ticker, 'priceChangePercent', ''); // priceChangePercent: '5.66%',
28289
+ percentage = percentage.replace('%', '');
28287
28290
  const ts = this.safeInteger(ticker, 'closeTime');
28288
28291
  const datetime = this.iso8601(ts);
28289
28292
  const bid = this.safeString(ticker, 'bidPrice');
@@ -40297,6 +40300,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40297
40300
  'cancelAllOrders': true,
40298
40301
  'cancelOrder': true,
40299
40302
  'cancelOrders': true,
40303
+ 'closeAllPositions': true,
40304
+ 'closePosition': false,
40300
40305
  'createOrder': true,
40301
40306
  'createOrders': true,
40302
40307
  'createReduceOnlyOrder': false,
@@ -45709,6 +45714,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
45709
45714
  // "utime": "1689300238205"
45710
45715
  // }
45711
45716
  //
45717
+ // closeAllPositions
45718
+ //
45719
+ // {
45720
+ // "symbol": "XRPUSDT_UMCBL",
45721
+ // "orderId": "1111861847410757635",
45722
+ // "clientOid": "1111861847410757637"
45723
+ // }
45724
+ //
45712
45725
  const marketId = this.safeString(position, 'symbol');
45713
45726
  market = this.safeMarket(marketId, market);
45714
45727
  const symbol = market['symbol'];
@@ -47259,6 +47272,67 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47259
47272
  'info': info,
47260
47273
  };
47261
47274
  }
47275
+ async closeAllPositions(params = {}) {
47276
+ /**
47277
+ * @method
47278
+ * @name bitget#closePositions
47279
+ * @description closes open positions for a market
47280
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
47281
+ * @param {object} [params] extra parameters specific to the okx api endpoint
47282
+ * @param {string} [params.subType] 'linear' or 'inverse'
47283
+ * @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
47284
+ * @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
47285
+ */
47286
+ await this.loadMarkets();
47287
+ let subType = undefined;
47288
+ let settle = undefined;
47289
+ [subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
47290
+ settle = this.safeString(params, 'settle', 'USDT');
47291
+ params = this.omit(params, ['settle']);
47292
+ const productType = this.safeString(params, 'productType');
47293
+ const request = {};
47294
+ if (productType === undefined) {
47295
+ const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
47296
+ let localProductType = undefined;
47297
+ if (subType === 'inverse') {
47298
+ localProductType = 'dmcbl';
47299
+ }
47300
+ else {
47301
+ if (settle === 'USDT') {
47302
+ localProductType = 'umcbl';
47303
+ }
47304
+ else if (settle === 'USDC') {
47305
+ localProductType = 'cmcbl';
47306
+ }
47307
+ }
47308
+ if (sandboxMode) {
47309
+ localProductType = 's' + localProductType;
47310
+ }
47311
+ request['productType'] = localProductType;
47312
+ }
47313
+ const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
47314
+ //
47315
+ // {
47316
+ // "code": "00000",
47317
+ // "msg": "success",
47318
+ // "requestTime": 1700814442466,
47319
+ // "data": {
47320
+ // "orderInfo": [
47321
+ // {
47322
+ // "symbol": "XRPUSDT_UMCBL",
47323
+ // "orderId": "1111861847410757635",
47324
+ // "clientOid": "1111861847410757637"
47325
+ // },
47326
+ // ],
47327
+ // "failure": [],
47328
+ // "result": true
47329
+ // }
47330
+ // }
47331
+ //
47332
+ const data = this.safeValue(response, 'data', {});
47333
+ const orderInfo = this.safeValue(data, 'orderInfo', []);
47334
+ return this.parsePositions(orderInfo, undefined, params);
47335
+ }
47262
47336
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
47263
47337
  if (!response) {
47264
47338
  return undefined; // fallback to default error handler
@@ -51802,19 +51876,15 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
51802
51876
  };
51803
51877
  }
51804
51878
  async fetchIsolatedBorrowRate(symbol, params = {}) {
51805
- //
51806
- // @method
51807
- // @name bitmart#fetchIsolatedBorrowRate
51808
- // @description fetch the rate of interest to borrow a currency for margin trading
51809
- // @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
51810
- // @param {string} symbol unified symbol of the market to fetch the borrow rate for
51811
- // @param {object} [params] extra parameters specific to the exchange API endpoint
51812
- // <<<<<<< HEAD
51813
- // @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
51814
- // =======
51815
- // @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
51816
- // >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
51817
- //
51879
+ /**
51880
+ * @method
51881
+ * @name bitmart#fetchIsolatedBorrowRate
51882
+ * @description fetch the rate of interest to borrow a currency for margin trading
51883
+ * @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
51884
+ * @param {string} symbol unified symbol of the market to fetch the borrow rate for
51885
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
51886
+ * @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
51887
+ */
51818
51888
  await this.loadMarkets();
51819
51889
  const market = this.market(symbol);
51820
51890
  const request = {
@@ -53134,6 +53204,12 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
53134
53204
  return this.parseNumber(finalAmount);
53135
53205
  }
53136
53206
  convertToRealAmount(code, amount) {
53207
+ if (code === undefined) {
53208
+ return amount;
53209
+ }
53210
+ else if (amount === undefined) {
53211
+ return undefined;
53212
+ }
53137
53213
  const currency = this.currency(code);
53138
53214
  const precision = this.safeString(currency, 'precision');
53139
53215
  return _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amount, precision);
@@ -59346,6 +59422,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
59346
59422
  'option': false,
59347
59423
  'cancelAllOrders': true,
59348
59424
  'cancelOrder': true,
59425
+ 'createMarketBuyOrderWithCost': true,
59426
+ 'createMarketOrderWithCost': false,
59427
+ 'createMarketSellOrderWithCost': false,
59349
59428
  'createOrder': true,
59350
59429
  'createStopLimitOrder': true,
59351
59430
  'createStopMarketOrder': true,
@@ -61200,6 +61279,26 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
61200
61279
  'trades': fills,
61201
61280
  }, market);
61202
61281
  }
61282
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
61283
+ /**
61284
+ * @method
61285
+ * @name bitrue#createMarketBuyOrderWithCost
61286
+ * @description create a market buy order by providing the symbol and cost
61287
+ * @see https://www.bitrue.com/api-docs#new-order-trade-hmac-sha256
61288
+ * @see https://www.bitrue.com/api_docs_includes_file/delivery.html#new-order-trade-hmac-sha256
61289
+ * @param {string} symbol unified symbol of the market to create an order in
61290
+ * @param {float} cost how much you want to trade in units of the quote currency
61291
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
61292
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
61293
+ */
61294
+ await this.loadMarkets();
61295
+ const market = this.market(symbol);
61296
+ if (!market['swap']) {
61297
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports swap orders only');
61298
+ }
61299
+ params['createMarketBuyOrderRequiresPrice'] = false;
61300
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
61301
+ }
61203
61302
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
61204
61303
  /**
61205
61304
  * @method
@@ -61223,6 +61322,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
61223
61322
  * EXCHANGE SPECIFIC PARAMETERS
61224
61323
  * @param {decimal} [params.icebergQty]
61225
61324
  * @param {long} [params.recvWindow]
61325
+ * @param {float} [params.cost] *swap market buy only* the quote quantity that can be used as an alternative for the amount
61226
61326
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
61227
61327
  */
61228
61328
  await this.loadMarkets();
@@ -61259,7 +61359,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
61259
61359
  request['type'] = 'IOC';
61260
61360
  }
61261
61361
  request['contractName'] = market['id'];
61262
- if (isMarket && (side === 'buy') && (this.options['createMarketBuyOrderRequiresPrice'])) {
61362
+ let createMarketBuyOrderRequiresPrice = true;
61363
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
61364
+ if (isMarket && (side === 'buy') && createMarketBuyOrderRequiresPrice) {
61263
61365
  const cost = this.safeString(params, 'cost');
61264
61366
  params = this.omit(params, 'cost');
61265
61367
  if (price === undefined && cost === undefined) {
@@ -65362,6 +65464,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
65362
65464
  * @method
65363
65465
  * @name bitstamp#fetchOHLCV
65364
65466
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
65467
+ * @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
65365
65468
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
65366
65469
  * @param {string} timeframe the length of time each candle represents
65367
65470
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -65384,7 +65487,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
65384
65487
  limit = 1000;
65385
65488
  const start = this.parseToInt(since / 1000);
65386
65489
  request['start'] = start;
65387
- request['end'] = this.sum(start, limit * duration);
65490
+ request['end'] = this.sum(start, duration * (limit - 1));
65388
65491
  request['limit'] = limit;
65389
65492
  }
65390
65493
  }
@@ -65392,7 +65495,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
65392
65495
  if (since !== undefined) {
65393
65496
  const start = this.parseToInt(since / 1000);
65394
65497
  request['start'] = start;
65395
- request['end'] = this.sum(start, limit * duration);
65498
+ request['end'] = this.sum(start, duration * (limit - 1));
65396
65499
  }
65397
65500
  request['limit'] = Math.min(limit, 1000); // min 1, max 1000
65398
65501
  }
@@ -76465,6 +76568,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76465
76568
  'v5/lending/account': 5,
76466
76569
  // broker
76467
76570
  'v5/broker/earning-record': 5,
76571
+ 'v5/broker/earnings-info': 5,
76572
+ 'v5/broker/account-info': 5,
76468
76573
  },
76469
76574
  'post': {
76470
76575
  // Legacy option USDC
@@ -85462,7 +85567,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
85462
85567
  'createLimitBuyOrder': true,
85463
85568
  'createLimitSellOrder': true,
85464
85569
  'createMarketBuyOrder': true,
85570
+ 'createMarketBuyOrderWithCost': true,
85571
+ 'createMarketOrderWithCost': false,
85465
85572
  'createMarketSellOrder': true,
85573
+ 'createMarketSellOrderWithCost': false,
85466
85574
  'createOrder': true,
85467
85575
  'createPostOnlyOrder': true,
85468
85576
  'createReduceOnlyOrder': false,
@@ -86325,7 +86433,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
86325
86433
  else {
86326
86434
  cost = costString;
86327
86435
  }
86328
- const feeCurrencyId = this.safeString(feeObject, 'currency');
86436
+ let feeCurrencyId = this.safeString(feeObject, 'currency');
86437
+ const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
86438
+ if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
86439
+ feeCurrencyId = market['quote'];
86440
+ }
86329
86441
  const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
86330
86442
  const side = this.safeStringLower2(trade, 'resource', 'side');
86331
86443
  const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
@@ -86343,7 +86455,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
86343
86455
  'amount': amountString,
86344
86456
  'cost': cost,
86345
86457
  'fee': {
86346
- 'cost': this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost)),
86458
+ 'cost': feeCost,
86347
86459
  'currency': this.safeCurrencyCode(feeCurrencyId),
86348
86460
  },
86349
86461
  });
@@ -87501,6 +87613,25 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87501
87613
  }
87502
87614
  return request;
87503
87615
  }
87616
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
87617
+ /**
87618
+ * @method
87619
+ * @name coinbase#createMarketBuyOrderWithCost
87620
+ * @description create a market buy order by providing the symbol and cost
87621
+ * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_postorder
87622
+ * @param {string} symbol unified symbol of the market to create an order in
87623
+ * @param {float} cost how much you want to trade in units of the quote currency
87624
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
87625
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
87626
+ */
87627
+ await this.loadMarkets();
87628
+ const market = this.market(symbol);
87629
+ if (!market['spot']) {
87630
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
87631
+ }
87632
+ params['createMarketBuyOrderRequiresPrice'] = false;
87633
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
87634
+ }
87504
87635
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
87505
87636
  /**
87506
87637
  * @method
@@ -87521,6 +87652,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87521
87652
  * @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO'
87522
87653
  * @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
87523
87654
  * @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
87655
+ * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
87524
87656
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
87525
87657
  */
87526
87658
  await this.loadMarkets();
@@ -87623,21 +87755,27 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87623
87755
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrder() only stop limit orders are supported');
87624
87756
  }
87625
87757
  if (side === 'buy') {
87626
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
87627
87758
  let total = undefined;
87628
- if (createMarketBuyOrderRequiresPrice) {
87759
+ let createMarketBuyOrderRequiresPrice = true;
87760
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
87761
+ const cost = this.safeNumber(params, 'cost');
87762
+ params = this.omit(params, 'cost');
87763
+ if (cost !== undefined) {
87764
+ total = this.costToPrecision(symbol, cost);
87765
+ }
87766
+ else if (createMarketBuyOrderRequiresPrice) {
87629
87767
  if (price === undefined) {
87630
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
87768
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
87631
87769
  }
87632
87770
  else {
87633
87771
  const amountString = this.numberToString(amount);
87634
87772
  const priceString = this.numberToString(price);
87635
- const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
87636
- total = this.priceToPrecision(symbol, cost);
87773
+ const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
87774
+ total = this.costToPrecision(symbol, costRequest);
87637
87775
  }
87638
87776
  }
87639
87777
  else {
87640
- total = this.priceToPrecision(symbol, amount);
87778
+ total = this.costToPrecision(symbol, amount);
87641
87779
  }
87642
87780
  request['order_configuration'] = {
87643
87781
  'market_market_ioc': {
@@ -87767,6 +87905,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87767
87905
  amount = this.safeString(marketIOC, 'base_size');
87768
87906
  }
87769
87907
  const datetime = this.safeString(order, 'created_time');
87908
+ const totalFees = this.safeString(order, 'total_fees');
87909
+ let currencyFee = undefined;
87910
+ if ((totalFees !== undefined) && (market !== undefined)) {
87911
+ currencyFee = market['quote'];
87912
+ }
87770
87913
  return this.safeOrder({
87771
87914
  'info': order,
87772
87915
  'id': this.safeString(order, 'order_id'),
@@ -87790,7 +87933,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
87790
87933
  'status': this.parseOrderStatus(this.safeString(order, 'status')),
87791
87934
  'fee': {
87792
87935
  'cost': this.safeString(order, 'total_fees'),
87793
- 'currency': undefined,
87936
+ 'currency': currencyFee,
87794
87937
  },
87795
87938
  'trades': undefined,
87796
87939
  }, market);
@@ -96247,17 +96390,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96247
96390
  return this.parseIsolatedBorrowRate(data, market);
96248
96391
  }
96249
96392
  async fetchIsolatedBorrowRates(params = {}) {
96250
- //
96251
- // @method
96252
- // @name coinex#fetchIsolatedBorrowRates
96253
- // @description fetch the borrow interest rates of all currencies
96254
- // @param {object} [params] extra parameters specific to the exchange API endpoint
96255
- // <<<<<<< HEAD
96256
- // @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
96257
- // =======
96258
- // @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
96259
- // >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
96260
- //
96393
+ /**
96394
+ * @method
96395
+ * @name coinex#fetchIsolatedBorrowRates
96396
+ * @description fetch the borrow interest rates of all currencies
96397
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
96398
+ * @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
96399
+ */
96261
96400
  await this.loadMarkets();
96262
96401
  const response = await this.privateGetMarginConfig(params);
96263
96402
  //
@@ -121962,6 +122101,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121962
122101
  'spot': 'https://api.gateio.ws/api/v4',
121963
122102
  'options': 'https://api.gateio.ws/api/v4',
121964
122103
  'subAccounts': 'https://api.gateio.ws/api/v4',
122104
+ 'portfolio': 'https://api.gateio.ws/api/v4',
121965
122105
  'rebate': 'https://api.gateio.ws/api/v4',
121966
122106
  'earn': 'https://api.gateio.ws/api/v4',
121967
122107
  'account': 'https://api.gateio.ws/api/v4',
@@ -122399,10 +122539,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122399
122539
  },
122400
122540
  'earn': {
122401
122541
  'get': {
122542
+ 'uni/currencies': 20 / 15,
122543
+ 'uni/currencies/{currency}': 20 / 15,
122402
122544
  'uni/lends': 20 / 15,
122403
122545
  'uni/lend_records': 20 / 15,
122404
122546
  'uni/interests/{currency}': 20 / 15,
122405
122547
  'uni/interest_records': 20 / 15,
122548
+ 'uni/interest_status/{currency}': 20 / 15,
122406
122549
  },
122407
122550
  'post': {
122408
122551
  'uni/lends': 20 / 15,
@@ -122459,6 +122602,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122459
122602
  '15m': '15m',
122460
122603
  '30m': '30m',
122461
122604
  '1h': '1h',
122605
+ '2h': '2h',
122462
122606
  '4h': '4h',
122463
122607
  '8h': '8h',
122464
122608
  '1d': '1d',
@@ -131378,6 +131522,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131378
131522
  * @method
131379
131523
  * @name hitbtc#fetchMarkets
131380
131524
  * @description retrieves data on all markets for hitbtc
131525
+ * @see https://api.hitbtc.com/#symbols
131381
131526
  * @param {object} [params] extra parameters specific to the exchange API endpoint
131382
131527
  * @returns {object[]} an array of objects representing market data
131383
131528
  */
@@ -131521,6 +131666,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131521
131666
  * @method
131522
131667
  * @name hitbtc#fetchCurrencies
131523
131668
  * @description fetches all available currencies on an exchange
131669
+ * @see https://api.hitbtc.com/#currencies
131524
131670
  * @param {object} [params] extra parameters specific to the exchange API endpoint
131525
131671
  * @returns {object} an associative dictionary of currencies
131526
131672
  */
@@ -131641,6 +131787,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131641
131787
  * @method
131642
131788
  * @name hitbtc#createDepositAddress
131643
131789
  * @description create a currency deposit address
131790
+ * @see https://api.hitbtc.com/#generate-deposit-crypto-address
131644
131791
  * @param {string} code unified currency code of the currency for the deposit address
131645
131792
  * @param {object} [params] extra parameters specific to the exchange API endpoint
131646
131793
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -131677,6 +131824,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131677
131824
  * @method
131678
131825
  * @name hitbtc#fetchDepositAddress
131679
131826
  * @description fetch the deposit address for a currency associated with this account
131827
+ * @see https://api.hitbtc.com/#get-deposit-crypto-address
131680
131828
  * @param {string} code unified currency code
131681
131829
  * @param {object} [params] extra parameters specific to the exchange API endpoint
131682
131830
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -131731,6 +131879,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131731
131879
  * @method
131732
131880
  * @name hitbtc#fetchBalance
131733
131881
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
131882
+ * @see https://api.hitbtc.com/#wallet-balance
131883
+ * @see https://api.hitbtc.com/#get-spot-trading-balance
131884
+ * @see https://api.hitbtc.com/#get-trading-balance
131734
131885
  * @param {object} [params] extra parameters specific to the exchange API endpoint
131735
131886
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
131736
131887
  */
@@ -131933,6 +132084,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131933
132084
  * @method
131934
132085
  * @name hitbtc#fetchMyTrades
131935
132086
  * @description fetch all trades made by the user
132087
+ * @see https://api.hitbtc.com/#spot-trades-history
132088
+ * @see https://api.hitbtc.com/#futures-trades-history
132089
+ * @see https://api.hitbtc.com/#margin-trades-history
131936
132090
  * @param {string} symbol unified market symbol
131937
132091
  * @param {int} [since] the earliest time in ms to fetch trades for
131938
132092
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -131955,17 +132109,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
131955
132109
  request['from'] = since;
131956
132110
  }
131957
132111
  let marketType = undefined;
132112
+ let marginMode = undefined;
132113
+ let response = undefined;
131958
132114
  [marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
131959
- let method = this.getSupportedMapping(marketType, {
131960
- 'spot': 'privateGetSpotHistoryTrade',
131961
- 'swap': 'privateGetFuturesHistoryTrade',
131962
- 'margin': 'privateGetMarginHistoryTrade',
131963
- });
131964
- const [marginMode, query] = this.handleMarginModeAndParams('fetchMyTrades', params);
132115
+ [marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
132116
+ params = this.omit(params, ['marginMode', 'margin']);
131965
132117
  if (marginMode !== undefined) {
131966
- method = 'privateGetMarginHistoryTrade';
132118
+ response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
132119
+ }
132120
+ else {
132121
+ if (marketType === 'spot') {
132122
+ response = await this.privateGetSpotHistoryTrade(this.extend(request, params));
132123
+ }
132124
+ else if (marketType === 'swap') {
132125
+ response = await this.privateGetFuturesHistoryTrade(this.extend(request, params));
132126
+ }
132127
+ else if (marketType === 'margin') {
132128
+ response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
132129
+ }
132130
+ else {
132131
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() not support this market type');
132132
+ }
131967
132133
  }
131968
- const response = await this[method](this.extend(request, query));
131969
132134
  return this.parseTrades(response, market, since, limit);
131970
132135
  }
131971
132136
  parseTrade(trade, market = undefined) {
@@ -132219,6 +132384,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132219
132384
  * @method
132220
132385
  * @name hitbtc#fetchDepositsWithdrawals
132221
132386
  * @description fetch history of deposits and withdrawals
132387
+ * @see https://api.hitbtc.com/#get-transactions-history
132222
132388
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
132223
132389
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
132224
132390
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -132232,6 +132398,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132232
132398
  * @method
132233
132399
  * @name hitbtc#fetchDeposits
132234
132400
  * @description fetch all deposits made to an account
132401
+ * @see https://api.hitbtc.com/#get-transactions-history
132235
132402
  * @param {string} code unified currency code
132236
132403
  * @param {int} [since] the earliest time in ms to fetch deposits for
132237
132404
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -132245,6 +132412,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132245
132412
  * @method
132246
132413
  * @name hitbtc#fetchWithdrawals
132247
132414
  * @description fetch all withdrawals made from an account
132415
+ * @see https://api.hitbtc.com/#get-transactions-history
132248
132416
  * @param {string} code unified currency code
132249
132417
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
132250
132418
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -132332,6 +132500,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132332
132500
  * @method
132333
132501
  * @name hitbtc#fetchTradingFee
132334
132502
  * @description fetch the trading fees for a market
132503
+ * @see https://api.hitbtc.com/#get-trading-commission
132504
+ * @see https://api.hitbtc.com/#get-trading-commission-2
132335
132505
  * @param {string} symbol unified market symbol
132336
132506
  * @param {object} [params] extra parameters specific to the exchange API endpoint
132337
132507
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -132341,11 +132511,16 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132341
132511
  const request = {
132342
132512
  'symbol': market['id'],
132343
132513
  };
132344
- const method = this.getSupportedMapping(market['type'], {
132345
- 'spot': 'privateGetSpotFeeSymbol',
132346
- 'swap': 'privateGetFuturesFeeSymbol',
132347
- });
132348
- const response = await this[method](this.extend(request, params));
132514
+ let response = undefined;
132515
+ if (market['type'] === 'spot') {
132516
+ response = await this.privateGetSpotFeeSymbol(this.extend(request, params));
132517
+ }
132518
+ else if (market['type'] === 'swap') {
132519
+ response = await this.privateGetFuturesFeeSymbol(this.extend(request, params));
132520
+ }
132521
+ else {
132522
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTradingFee() not support this market type');
132523
+ }
132349
132524
  //
132350
132525
  // {
132351
132526
  // "take_rate":"0.0009",
@@ -132359,16 +132534,23 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132359
132534
  * @method
132360
132535
  * @name hitbtc#fetchTradingFees
132361
132536
  * @description fetch the trading fees for multiple markets
132537
+ * @see https://api.hitbtc.com/#get-all-trading-commissions
132538
+ * @see https://api.hitbtc.com/#get-all-trading-commissions-2
132362
132539
  * @param {object} [params] extra parameters specific to the exchange API endpoint
132363
132540
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
132364
132541
  */
132365
132542
  await this.loadMarkets();
132366
132543
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
132367
- const method = this.getSupportedMapping(marketType, {
132368
- 'spot': 'privateGetSpotFee',
132369
- 'swap': 'privateGetFuturesFee',
132370
- });
132371
- const response = await this[method](query);
132544
+ let response = undefined;
132545
+ if (marketType === 'spot') {
132546
+ response = await this.privateGetSpotFee(query);
132547
+ }
132548
+ else if (marketType === 'swap') {
132549
+ response = await this.privateGetFuturesFee(query);
132550
+ }
132551
+ else {
132552
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTradingFees() not support this market type');
132553
+ }
132372
132554
  //
132373
132555
  // [
132374
132556
  // {
@@ -132504,6 +132686,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132504
132686
  * @method
132505
132687
  * @name hitbtc#fetchClosedOrders
132506
132688
  * @description fetches information on multiple closed orders made by the user
132689
+ * @see https://api.hitbtc.com/#spot-orders-history
132690
+ * @see https://api.hitbtc.com/#futures-orders-history
132691
+ * @see https://api.hitbtc.com/#margin-orders-history
132507
132692
  * @param {string} symbol unified market symbol of the market orders were made in
132508
132693
  * @param {int} [since] the earliest time in ms to fetch orders for
132509
132694
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -132526,17 +132711,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132526
132711
  request['limit'] = limit;
132527
132712
  }
132528
132713
  let marketType = undefined;
132714
+ let marginMode = undefined;
132529
132715
  [marketType, params] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
132530
- let method = this.getSupportedMapping(marketType, {
132531
- 'spot': 'privateGetSpotHistoryOrder',
132532
- 'swap': 'privateGetFuturesHistoryOrder',
132533
- 'margin': 'privateGetMarginHistoryOrder',
132534
- });
132535
- const [marginMode, query] = this.handleMarginModeAndParams('fetchClosedOrders', params);
132716
+ [marginMode, params] = this.handleMarginModeAndParams('fetchClosedOrders', params);
132717
+ params = this.omit(params, ['marginMode', 'margin']);
132718
+ let response = undefined;
132536
132719
  if (marginMode !== undefined) {
132537
- method = 'privateGetMarginHistoryOrder';
132720
+ response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
132721
+ }
132722
+ else {
132723
+ if (marketType === 'spot') {
132724
+ response = await this.privateGetSpotHistoryOrder(this.extend(request, params));
132725
+ }
132726
+ else if (marketType === 'swap') {
132727
+ response = await this.privateGetFuturesHistoryOrder(this.extend(request, params));
132728
+ }
132729
+ else if (marketType === 'margin') {
132730
+ response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
132731
+ }
132732
+ else {
132733
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchClosedOrders() not support this market type');
132734
+ }
132538
132735
  }
132539
- const response = await this[method](this.extend(request, query));
132540
132736
  const parsed = this.parseOrders(response, market, since, limit);
132541
132737
  return this.filterByArray(parsed, 'status', ['closed', 'canceled'], false);
132542
132738
  }
@@ -132545,6 +132741,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132545
132741
  * @method
132546
132742
  * @name hitbtc#fetchOrder
132547
132743
  * @description fetches information on an order made by the user
132744
+ * @see https://api.hitbtc.com/#spot-orders-history
132745
+ * @see https://api.hitbtc.com/#futures-orders-history
132746
+ * @see https://api.hitbtc.com/#margin-orders-history
132548
132747
  * @param {string} symbol unified symbol of the market the order was made in
132549
132748
  * @param {object} [params] extra parameters specific to the exchange API endpoint
132550
132749
  * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
@@ -132556,21 +132755,32 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132556
132755
  if (symbol !== undefined) {
132557
132756
  market = this.market(symbol);
132558
132757
  }
132758
+ const request = {
132759
+ 'client_order_id': id,
132760
+ };
132559
132761
  let marketType = undefined;
132762
+ let marginMode = undefined;
132560
132763
  [marketType, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
132561
- let method = this.getSupportedMapping(marketType, {
132562
- 'spot': 'privateGetSpotHistoryOrder',
132563
- 'swap': 'privateGetFuturesHistoryOrder',
132564
- 'margin': 'privateGetMarginHistoryOrder',
132565
- });
132566
- const [marginMode, query] = this.handleMarginModeAndParams('fetchOrder', params);
132764
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOrder', params);
132765
+ params = this.omit(params, ['marginMode', 'margin']);
132766
+ let response = undefined;
132567
132767
  if (marginMode !== undefined) {
132568
- method = 'privateGetMarginHistoryOrder';
132768
+ response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
132769
+ }
132770
+ else {
132771
+ if (marketType === 'spot') {
132772
+ response = await this.privateGetSpotHistoryOrder(this.extend(request, params));
132773
+ }
132774
+ else if (marketType === 'swap') {
132775
+ response = await this.privateGetFuturesHistoryOrder(this.extend(request, params));
132776
+ }
132777
+ else if (marketType === 'margin') {
132778
+ response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
132779
+ }
132780
+ else {
132781
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrder() not support this market type');
132782
+ }
132569
132783
  }
132570
- const request = {
132571
- 'client_order_id': id,
132572
- };
132573
- const response = await this[method](this.extend(request, query));
132574
132784
  //
132575
132785
  // [
132576
132786
  // {
@@ -132598,6 +132808,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132598
132808
  * @method
132599
132809
  * @name hitbtc#fetchOrderTrades
132600
132810
  * @description fetch all the trades made from a single order
132811
+ * @see https://api.hitbtc.com/#spot-trades-history
132812
+ * @see https://api.hitbtc.com/#futures-trades-history
132813
+ * @see https://api.hitbtc.com/#margin-trades-history
132601
132814
  * @param {string} id order id
132602
132815
  * @param {string} symbol unified market symbol
132603
132816
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -132616,17 +132829,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132616
132829
  'order_id': id, // exchange assigned order id as oppose to the client order id
132617
132830
  };
132618
132831
  let marketType = undefined;
132832
+ let marginMode = undefined;
132619
132833
  [marketType, params] = this.handleMarketTypeAndParams('fetchOrderTrades', market, params);
132620
- let method = this.getSupportedMapping(marketType, {
132621
- 'spot': 'privateGetSpotHistoryTrade',
132622
- 'swap': 'privateGetFuturesHistoryTrade',
132623
- 'margin': 'privateGetMarginHistoryTrade',
132624
- });
132625
- const [marginMode, query] = this.handleMarginModeAndParams('fetchOrderTrades', params);
132834
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOrderTrades', params);
132835
+ params = this.omit(params, ['marginMode', 'margin']);
132836
+ let response = undefined;
132626
132837
  if (marginMode !== undefined) {
132627
- method = 'privateGetMarginHistoryTrade';
132838
+ response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
132839
+ }
132840
+ else {
132841
+ if (marketType === 'spot') {
132842
+ response = await this.privateGetSpotHistoryTrade(this.extend(request, params));
132843
+ }
132844
+ else if (marketType === 'swap') {
132845
+ response = await this.privateGetFuturesHistoryTrade(this.extend(request, params));
132846
+ }
132847
+ else if (marketType === 'margin') {
132848
+ response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
132849
+ }
132850
+ else {
132851
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrderTrades() not support this market type');
132852
+ }
132628
132853
  }
132629
- const response = await this[method](this.extend(request, query));
132630
132854
  //
132631
132855
  // Spot
132632
132856
  //
@@ -132672,6 +132896,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132672
132896
  * @method
132673
132897
  * @name hitbtc#fetchOpenOrders
132674
132898
  * @description fetch all unfilled currently open orders
132899
+ * @see https://api.hitbtc.com/#get-all-active-spot-orders
132900
+ * @see https://api.hitbtc.com/#get-active-futures-orders
132901
+ * @see https://api.hitbtc.com/#get-active-margin-orders
132675
132902
  * @param {string} symbol unified market symbol
132676
132903
  * @param {int} [since] the earliest time in ms to fetch open orders for
132677
132904
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -132688,17 +132915,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132688
132915
  request['symbol'] = market['id'];
132689
132916
  }
132690
132917
  let marketType = undefined;
132918
+ let marginMode = undefined;
132691
132919
  [marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
132692
- let method = this.getSupportedMapping(marketType, {
132693
- 'spot': 'privateGetSpotOrder',
132694
- 'swap': 'privateGetFuturesOrder',
132695
- 'margin': 'privateGetMarginOrder',
132696
- });
132697
- const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrders', params);
132920
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
132921
+ params = this.omit(params, ['marginMode', 'margin']);
132922
+ let response = undefined;
132698
132923
  if (marginMode !== undefined) {
132699
- method = 'privateGetMarginOrder';
132924
+ response = await this.privateGetMarginOrder(this.extend(request, params));
132925
+ }
132926
+ else {
132927
+ if (marketType === 'spot') {
132928
+ response = await this.privateGetSpotOrder(this.extend(request, params));
132929
+ }
132930
+ else if (marketType === 'swap') {
132931
+ response = await this.privateGetFuturesOrder(this.extend(request, params));
132932
+ }
132933
+ else if (marketType === 'margin') {
132934
+ response = await this.privateGetMarginOrder(this.extend(request, params));
132935
+ }
132936
+ else {
132937
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrders() not support this market type');
132938
+ }
132700
132939
  }
132701
- const response = await this[method](this.extend(request, query));
132702
132940
  //
132703
132941
  // [
132704
132942
  // {
@@ -132725,6 +132963,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132725
132963
  * @method
132726
132964
  * @name hitbtc#fetchOpenOrder
132727
132965
  * @description fetch an open order by it's id
132966
+ * @see https://api.hitbtc.com/#get-active-spot-order
132967
+ * @see https://api.hitbtc.com/#get-active-futures-order
132968
+ * @see https://api.hitbtc.com/#get-active-margin-order
132728
132969
  * @param {string} id order id
132729
132970
  * @param {string} symbol unified market symbol, default is undefined
132730
132971
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -132737,21 +132978,32 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132737
132978
  if (symbol !== undefined) {
132738
132979
  market = this.market(symbol);
132739
132980
  }
132981
+ const request = {
132982
+ 'client_order_id': id,
132983
+ };
132740
132984
  let marketType = undefined;
132985
+ let marginMode = undefined;
132741
132986
  [marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrder', market, params);
132742
- let method = this.getSupportedMapping(marketType, {
132743
- 'spot': 'privateGetSpotOrderClientOrderId',
132744
- 'swap': 'privateGetFuturesOrderClientOrderId',
132745
- 'margin': 'privateGetMarginOrderClientOrderId',
132746
- });
132747
- const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrder', params);
132987
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrder', params);
132988
+ params = this.omit(params, ['marginMode', 'margin']);
132989
+ let response = undefined;
132748
132990
  if (marginMode !== undefined) {
132749
- method = 'privateGetMarginOrderClientOrderId';
132991
+ response = await this.privateGetMarginOrderClientOrderId(this.extend(request, params));
132992
+ }
132993
+ else {
132994
+ if (marketType === 'spot') {
132995
+ response = await this.privateGetSpotOrderClientOrderId(this.extend(request, params));
132996
+ }
132997
+ else if (marketType === 'swap') {
132998
+ response = await this.privateGetFuturesOrderClientOrderId(this.extend(request, params));
132999
+ }
133000
+ else if (marketType === 'margin') {
133001
+ response = await this.privateGetMarginOrderClientOrderId(this.extend(request, params));
133002
+ }
133003
+ else {
133004
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrder() not support this market type');
133005
+ }
132750
133006
  }
132751
- const request = {
132752
- 'client_order_id': id,
132753
- };
132754
- const response = await this[method](this.extend(request, query));
132755
133007
  return this.parseOrder(response, market);
132756
133008
  }
132757
133009
  async cancelAllOrders(symbol = undefined, params = {}) {
@@ -132759,6 +133011,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132759
133011
  * @method
132760
133012
  * @name hitbtc#cancelAllOrders
132761
133013
  * @description cancel all open orders
133014
+ * @see https://api.hitbtc.com/#cancel-all-spot-orders
133015
+ * @see https://api.hitbtc.com/#cancel-futures-orders
133016
+ * @see https://api.hitbtc.com/#cancel-all-margin-orders
132762
133017
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
132763
133018
  * @param {object} [params] extra parameters specific to the exchange API endpoint
132764
133019
  * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
@@ -132773,17 +133028,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132773
133028
  request['symbol'] = market['id'];
132774
133029
  }
132775
133030
  let marketType = undefined;
133031
+ let marginMode = undefined;
132776
133032
  [marketType, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
132777
- let method = this.getSupportedMapping(marketType, {
132778
- 'spot': 'privateDeleteSpotOrder',
132779
- 'swap': 'privateDeleteFuturesOrder',
132780
- 'margin': 'privateDeleteMarginOrder',
132781
- });
132782
- const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
133033
+ [marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
133034
+ params = this.omit(params, ['marginMode', 'margin']);
133035
+ let response = undefined;
132783
133036
  if (marginMode !== undefined) {
132784
- method = 'privateDeleteMarginOrder';
133037
+ response = await this.privateDeleteMarginOrder(this.extend(request, params));
133038
+ }
133039
+ else {
133040
+ if (marketType === 'spot') {
133041
+ response = await this.privateDeleteSpotOrder(this.extend(request, params));
133042
+ }
133043
+ else if (marketType === 'swap') {
133044
+ response = await this.privateDeleteFuturesOrder(this.extend(request, params));
133045
+ }
133046
+ else if (marketType === 'margin') {
133047
+ response = await this.privateDeleteMarginOrder(this.extend(request, params));
133048
+ }
133049
+ else {
133050
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelAllOrders() not support this market type');
133051
+ }
132785
133052
  }
132786
- const response = await this[method](this.extend(request, query));
132787
133053
  return this.parseOrders(response, market);
132788
133054
  }
132789
133055
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -132791,6 +133057,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132791
133057
  * @method
132792
133058
  * @name hitbtc#cancelOrder
132793
133059
  * @description cancels an open order
133060
+ * @see https://api.hitbtc.com/#cancel-spot-order
133061
+ * @see https://api.hitbtc.com/#cancel-futures-order
133062
+ * @see https://api.hitbtc.com/#cancel-margin-order
132794
133063
  * @param {string} id order id
132795
133064
  * @param {string} symbol unified symbol of the market the order was made in
132796
133065
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -132807,17 +133076,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132807
133076
  market = this.market(symbol);
132808
133077
  }
132809
133078
  let marketType = undefined;
133079
+ let marginMode = undefined;
132810
133080
  [marketType, params] = this.handleMarketTypeAndParams('cancelOrder', market, params);
132811
- let method = this.getSupportedMapping(marketType, {
132812
- 'spot': 'privateDeleteSpotOrderClientOrderId',
132813
- 'swap': 'privateDeleteFuturesOrderClientOrderId',
132814
- 'margin': 'privateDeleteMarginOrderClientOrderId',
132815
- });
132816
- const [marginMode, query] = this.handleMarginModeAndParams('cancelOrder', params);
133081
+ [marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
133082
+ params = this.omit(params, ['marginMode', 'margin']);
133083
+ let response = undefined;
132817
133084
  if (marginMode !== undefined) {
132818
- method = 'privateDeleteMarginOrderClientOrderId';
133085
+ response = await this.privateDeleteMarginOrderClientOrderId(this.extend(request, params));
133086
+ }
133087
+ else {
133088
+ if (marketType === 'spot') {
133089
+ response = await this.privateDeleteSpotOrderClientOrderId(this.extend(request, params));
133090
+ }
133091
+ else if (marketType === 'swap') {
133092
+ response = await this.privateDeleteFuturesOrderClientOrderId(this.extend(request, params));
133093
+ }
133094
+ else if (marketType === 'margin') {
133095
+ response = await this.privateDeleteMarginOrderClientOrderId(this.extend(request, params));
133096
+ }
133097
+ else {
133098
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelOrder() not support this market type');
133099
+ }
132819
133100
  }
132820
- const response = await this[method](this.extend(request, query));
132821
133101
  return this.parseOrder(response, market);
132822
133102
  }
132823
133103
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
@@ -132837,17 +133117,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
132837
133117
  market = this.market(symbol);
132838
133118
  }
132839
133119
  let marketType = undefined;
133120
+ let marginMode = undefined;
132840
133121
  [marketType, params] = this.handleMarketTypeAndParams('editOrder', market, params);
132841
- let method = this.getSupportedMapping(marketType, {
132842
- 'spot': 'privatePatchSpotOrderClientOrderId',
132843
- 'swap': 'privatePatchFuturesOrderClientOrderId',
132844
- 'margin': 'privatePatchMarginOrderClientOrderId',
132845
- });
132846
- const [marginMode, query] = this.handleMarginModeAndParams('editOrder', params);
133122
+ [marginMode, params] = this.handleMarginModeAndParams('editOrder', params);
133123
+ params = this.omit(params, ['marginMode', 'margin']);
133124
+ let response = undefined;
132847
133125
  if (marginMode !== undefined) {
132848
- method = 'privatePatchMarginOrderClientOrderId';
133126
+ response = await this.privatePatchMarginOrderClientOrderId(this.extend(request, params));
133127
+ }
133128
+ else {
133129
+ if (marketType === 'spot') {
133130
+ response = await this.privatePatchSpotOrderClientOrderId(this.extend(request, params));
133131
+ }
133132
+ else if (marketType === 'swap') {
133133
+ response = await this.privatePatchFuturesOrderClientOrderId(this.extend(request, params));
133134
+ }
133135
+ else if (marketType === 'margin') {
133136
+ response = await this.privatePatchMarginOrderClientOrderId(this.extend(request, params));
133137
+ }
133138
+ else {
133139
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' editOrder() not support this market type');
133140
+ }
132849
133141
  }
132850
- const response = await this[method](this.extend(request, query));
132851
133142
  return this.parseOrder(response, market);
132852
133143
  }
132853
133144
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -133176,6 +133467,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133176
133467
  * @method
133177
133468
  * @name hitbtc#transfer
133178
133469
  * @description transfer currency internally between wallets on the same account
133470
+ * @see https://api.hitbtc.com/#transfer-between-wallet-and-exchange
133179
133471
  * @param {string} code unified currency code
133180
133472
  * @param {float} amount amount to transfer
133181
133473
  * @param {string} fromAccount account to transfer from
@@ -133263,6 +133555,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133263
133555
  * @method
133264
133556
  * @name hitbtc#withdraw
133265
133557
  * @description make a withdrawal
133558
+ * @see https://api.hitbtc.com/#withdraw-crypto
133266
133559
  * @param {string} code unified currency code
133267
133560
  * @param {float} amount the amount to withdraw
133268
133561
  * @param {string} address the address to withdraw to
@@ -133444,6 +133737,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133444
133737
  * @method
133445
133738
  * @name hitbtc#fetchPositions
133446
133739
  * @description fetch all open positions
133740
+ * @see https://api.hitbtc.com/#get-futures-margin-accounts
133741
+ * @see https://api.hitbtc.com/#get-all-margin-accounts
133447
133742
  * @param {string[]|undefined} symbols not used by hitbtc fetchPositions ()
133448
133743
  * @param {object} [params] extra parameters specific to the exchange API endpoint
133449
133744
  * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
@@ -133453,16 +133748,25 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133453
133748
  await this.loadMarkets();
133454
133749
  const request = {};
133455
133750
  let marketType = undefined;
133751
+ let marginMode = undefined;
133456
133752
  [marketType, params] = this.handleMarketTypeAndParams('fetchPositions', undefined, params);
133457
- let method = this.getSupportedMapping(marketType, {
133458
- 'swap': 'privateGetFuturesAccount',
133459
- 'margin': 'privateGetMarginAccount',
133460
- });
133461
- const [marginMode, query] = this.handleMarginModeAndParams('fetchPositions', params);
133753
+ [marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params);
133754
+ params = this.omit(params, ['marginMode', 'margin']);
133755
+ let response = undefined;
133462
133756
  if (marginMode !== undefined) {
133463
- method = 'privateGetMarginAccount';
133757
+ response = await this.privateGetMarginAccount(this.extend(request, params));
133758
+ }
133759
+ else {
133760
+ if (marketType === 'swap') {
133761
+ response = await this.privateGetFuturesAccount(this.extend(request, params));
133762
+ }
133763
+ else if (marketType === 'margin') {
133764
+ response = await this.privateGetMarginAccount(this.extend(request, params));
133765
+ }
133766
+ else {
133767
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() not support this market type');
133768
+ }
133464
133769
  }
133465
- const response = await this[method](this.extend(request, query));
133466
133770
  //
133467
133771
  // [
133468
133772
  // {
@@ -133506,6 +133810,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133506
133810
  * @method
133507
133811
  * @name hitbtc#fetchPosition
133508
133812
  * @description fetch data on a single open contract trade position
133813
+ * @see https://api.hitbtc.com/#get-futures-margin-account
133814
+ * @see https://api.hitbtc.com/#get-isolated-margin-account
133509
133815
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
133510
133816
  * @param {object} [params] extra parameters specific to the exchange API endpoint
133511
133817
  * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
@@ -133513,21 +133819,30 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133513
133819
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
133514
133820
  */
133515
133821
  await this.loadMarkets();
133516
- let marketType = undefined;
133517
- [marketType, params] = this.handleMarketTypeAndParams('fetchPosition', undefined, params);
133518
- let method = this.getSupportedMapping(marketType, {
133519
- 'swap': 'privateGetFuturesAccountIsolatedSymbol',
133520
- 'margin': 'privateGetMarginAccountIsolatedSymbol',
133521
- });
133522
- const [marginMode, query] = this.handleMarginModeAndParams('fetchPosition', params);
133523
- if (marginMode !== undefined) {
133524
- method = 'privateGetMarginAccountIsolatedSymbol';
133525
- }
133526
133822
  const market = this.market(symbol);
133527
133823
  const request = {
133528
133824
  'symbol': market['id'],
133529
133825
  };
133530
- const response = await this[method](this.extend(request, query));
133826
+ let marketType = undefined;
133827
+ let marginMode = undefined;
133828
+ [marketType, params] = this.handleMarketTypeAndParams('fetchPosition', undefined, params);
133829
+ [marginMode, params] = this.handleMarginModeAndParams('fetchPosition', params);
133830
+ params = this.omit(params, ['marginMode', 'margin']);
133831
+ let response = undefined;
133832
+ if (marginMode !== undefined) {
133833
+ response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
133834
+ }
133835
+ else {
133836
+ if (marketType === 'swap') {
133837
+ response = await this.privateGetFuturesAccountIsolatedSymbol(this.extend(request, params));
133838
+ }
133839
+ else if (marketType === 'margin') {
133840
+ response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
133841
+ }
133842
+ else {
133843
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPosition() not support this market type');
133844
+ }
133845
+ }
133531
133846
  //
133532
133847
  // [
133533
133848
  // {
@@ -133794,7 +134109,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133794
134109
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' modifyMarginHelper() requires a leverage parameter for swap markets');
133795
134110
  }
133796
134111
  }
133797
- amount = this.amountToPrecision(symbol, amount);
134112
+ if (amount !== 0) {
134113
+ amount = this.amountToPrecision(symbol, amount);
134114
+ }
134115
+ else {
134116
+ amount = '0';
134117
+ }
133798
134118
  const request = {
133799
134119
  'symbol': market['id'],
133800
134120
  'margin_balance': amount, // swap and margin
@@ -133805,16 +134125,25 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133805
134125
  request['leverage'] = leverage;
133806
134126
  }
133807
134127
  let marketType = undefined;
133808
- [marketType, params] = this.handleMarketTypeAndParams('modifyMarginHelper', undefined, params);
133809
- let method = this.getSupportedMapping(marketType, {
133810
- 'swap': 'privatePutFuturesAccountIsolatedSymbol',
133811
- 'margin': 'privatePutMarginAccountIsolatedSymbol',
133812
- });
133813
- const [marginMode, query] = this.handleMarginModeAndParams('modifyMarginHelper', params);
134128
+ let marginMode = undefined;
134129
+ [marketType, params] = this.handleMarketTypeAndParams('modifyMarginHelper', market, params);
134130
+ [marginMode, params] = this.handleMarginModeAndParams('modifyMarginHelper', params);
134131
+ params = this.omit(params, ['marginMode', 'margin']);
134132
+ let response = undefined;
133814
134133
  if (marginMode !== undefined) {
133815
- method = 'privatePutMarginAccountIsolatedSymbol';
134134
+ response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
134135
+ }
134136
+ else {
134137
+ if (marketType === 'swap') {
134138
+ response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
134139
+ }
134140
+ else if (marketType === 'margin') {
134141
+ response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
134142
+ }
134143
+ else {
134144
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' modifyMarginHelper() not support this market type');
134145
+ }
133816
134146
  }
133817
- const response = await this[method](this.extend(request, query));
133818
134147
  //
133819
134148
  // {
133820
134149
  // "symbol": "BTCUSDT_PERP",
@@ -133855,6 +134184,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133855
134184
  * @method
133856
134185
  * @name hitbtc#reduceMargin
133857
134186
  * @description remove margin from a position
134187
+ * @see https://api.hitbtc.com/#create-update-margin-account-2
134188
+ * @see https://api.hitbtc.com/#create-update-margin-account
133858
134189
  * @param {string} symbol unified market symbol
133859
134190
  * @param {float} amount the amount of margin to remove
133860
134191
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -133872,6 +134203,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133872
134203
  * @method
133873
134204
  * @name hitbtc#addMargin
133874
134205
  * @description add margin
134206
+ * @see https://api.hitbtc.com/#create-update-margin-account-2
134207
+ * @see https://api.hitbtc.com/#create-update-margin-account
133875
134208
  * @param {string} symbol unified market symbol
133876
134209
  * @param {float} amount amount of margin to add
133877
134210
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -133886,6 +134219,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133886
134219
  * @method
133887
134220
  * @name hitbtc#fetchLeverage
133888
134221
  * @description fetch the set leverage for a market
134222
+ * @see https://api.hitbtc.com/#get-futures-margin-account
134223
+ * @see https://api.hitbtc.com/#get-isolated-margin-account
133889
134224
  * @param {string} symbol unified market symbol
133890
134225
  * @param {object} [params] extra parameters specific to the exchange API endpoint
133891
134226
  * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if this is set
@@ -133897,16 +134232,27 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133897
134232
  const request = {
133898
134233
  'symbol': market['id'],
133899
134234
  };
133900
- let method = this.getSupportedMapping(market['type'], {
133901
- 'spot': 'privateGetMarginAccountIsolatedSymbol',
133902
- 'margin': 'privateGetMarginAccountIsolatedSymbol',
133903
- 'swap': 'privateGetFuturesAccountIsolatedSymbol',
133904
- });
133905
- const [marginMode, query] = this.handleMarginModeAndParams('modifyMarginHelper', params);
134235
+ let marginMode = undefined;
134236
+ [marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params);
134237
+ params = this.omit(params, ['marginMode', 'margin']);
134238
+ let response = undefined;
133906
134239
  if (marginMode !== undefined) {
133907
- method = 'privateGetMarginAccountIsolatedSymbol';
134240
+ response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
134241
+ }
134242
+ else {
134243
+ if (market['type'] === 'spot') {
134244
+ response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
134245
+ }
134246
+ else if (market['type'] === 'swap') {
134247
+ response = await this.privateGetFuturesAccountIsolatedSymbol(this.extend(request, params));
134248
+ }
134249
+ else if (market['type'] === 'margin') {
134250
+ response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
134251
+ }
134252
+ else {
134253
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverage() not support this market type');
134254
+ }
133908
134255
  }
133909
- const response = await this[method](this.extend(request, query));
133910
134256
  //
133911
134257
  // {
133912
134258
  // "symbol": "BTCUSDT",
@@ -133944,6 +134290,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
133944
134290
  * @method
133945
134291
  * @name hitbtc#setLeverage
133946
134292
  * @description set the level of leverage for a market
134293
+ * @see https://api.hitbtc.com/#create-update-margin-account-2
133947
134294
  * @param {float} leverage the rate of leverage
133948
134295
  * @param {string} symbol unified market symbol
133949
134296
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -148331,7 +148678,16 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
148331
148678
  // ]
148332
148679
  const method = params['method'];
148333
148680
  params = this.omit(params, 'method');
148334
- const response = await this[method](this.extend(request, params));
148681
+ let response = undefined;
148682
+ if (method === 'privateGetDeposits') {
148683
+ response = await this.privateGetDeposits(this.extend(request, params));
148684
+ }
148685
+ else if (method === 'privateGetWithdrawals') {
148686
+ response = await this.privateGetWithdrawals(this.extend(request, params));
148687
+ }
148688
+ else {
148689
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTransactionsHelper() not support this method');
148690
+ }
148335
148691
  return this.parseTransactions(response, currency, since, limit);
148336
148692
  }
148337
148693
  parseTransactionStatus(status) {
@@ -172253,6 +172609,9 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
172253
172609
  'closeAllPositions': false,
172254
172610
  'closePosition': false,
172255
172611
  'createDepositAddress': true,
172612
+ 'createMarketBuyOrderWithCost': true,
172613
+ 'createMarketOrderWithCost': false,
172614
+ 'createMarketSellOrderWithCost': false,
172256
172615
  'createOrder': true,
172257
172616
  'createOrders': true,
172258
172617
  'createReduceOnlyOrder': true,
@@ -174275,11 +174634,33 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
174275
174634
  }
174276
174635
  return this.parseTickers(tickers, symbols);
174277
174636
  }
174637
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
174638
+ /**
174639
+ * @method
174640
+ * @name mexc#createMarketBuyOrderWithCost
174641
+ * @description create a market buy order by providing the symbol and cost
174642
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
174643
+ * @param {string} symbol unified symbol of the market to create an order in
174644
+ * @param {float} cost how much you want to trade in units of the quote currency
174645
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
174646
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
174647
+ */
174648
+ await this.loadMarkets();
174649
+ const market = this.market(symbol);
174650
+ if (!market['spot']) {
174651
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
174652
+ }
174653
+ params['createMarketBuyOrderRequiresPrice'] = false;
174654
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
174655
+ }
174278
174656
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
174279
174657
  /**
174280
174658
  * @method
174281
174659
  * @name mexc3#createOrder
174282
174660
  * @description create a trade order
174661
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
174662
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
174663
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
174283
174664
  * @param {string} symbol unified symbol of the market to create an order in
174284
174665
  * @param {string} type 'market' or 'limit'
174285
174666
  * @param {string} side 'buy' or 'sell'
@@ -174308,13 +174689,16 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
174308
174689
  'type': type.toUpperCase(),
174309
174690
  };
174310
174691
  if (orderSide === 'BUY' && type === 'market') {
174311
- const quoteOrderQty = this.safeNumber(params, 'quoteOrderQty');
174312
- if (quoteOrderQty !== undefined) {
174313
- amount = quoteOrderQty;
174692
+ let createMarketBuyOrderRequiresPrice = true;
174693
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
174694
+ const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
174695
+ params = this.omit(params, 'cost');
174696
+ if (cost !== undefined) {
174697
+ amount = cost;
174314
174698
  }
174315
- else if (this.options['createMarketBuyOrderRequiresPrice']) {
174699
+ else if (createMarketBuyOrderRequiresPrice) {
174316
174700
  if (price === undefined) {
174317
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + " createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false to supply the cost in the amount argument (the exchange-specific behaviour)");
174701
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
174318
174702
  }
174319
174703
  else {
174320
174704
  const amountString = this.numberToString(amount);
@@ -185626,7 +186010,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
185626
186010
  'name': 'OKX',
185627
186011
  'countries': ['CN', 'US'],
185628
186012
  'version': 'v5',
185629
- 'rateLimit': 100,
186013
+ 'rateLimit': 100 * 1.03,
185630
186014
  'pro': true,
185631
186015
  'certified': true,
185632
186016
  'has': {
@@ -185895,6 +186279,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
185895
186279
  'asset/convert/currencies': 5 / 3,
185896
186280
  'asset/convert/currency-pair': 5 / 3,
185897
186281
  'asset/convert/history': 5 / 3,
186282
+ 'asset/monthly-statement': 2,
185898
186283
  // account
185899
186284
  'account/balance': 2,
185900
186285
  'account/positions': 2,
@@ -186028,6 +186413,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
186028
186413
  'asset/convert-dust-assets': 10,
186029
186414
  'asset/convert/estimate-quote': 1,
186030
186415
  'asset/convert/trade': 1,
186416
+ 'asset/monthly-statement': 1,
186031
186417
  // account
186032
186418
  'account/set-position-mode': 4,
186033
186419
  'account/set-leverage': 1,
@@ -186661,14 +187047,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
186661
187047
  'commonCurrencies': {
186662
187048
  // the exchange refers to ERC20 version of Aeternity (AEToken)
186663
187049
  'AE': 'AET',
186664
- 'BOX': 'DefiBox',
186665
- 'HOT': 'Hydro Protocol',
186666
- 'HSR': 'HC',
186667
- 'MAG': 'Maggie',
186668
- 'SBTC': 'Super Bitcoin',
186669
- 'TRADE': 'Unitrade',
186670
- 'YOYO': 'YOYOW',
186671
- 'WIN': 'WinToken', // https://github.com/ccxt/ccxt/issues/5701
187050
+ 'WIN': 'WINTOKEN', // https://github.com/ccxt/ccxt/issues/5701
186672
187051
  },
186673
187052
  });
186674
187053
  }
@@ -188694,6 +189073,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
188694
189073
  * @param {string[]} ids order ids
188695
189074
  * @param {string} symbol unified market symbol
188696
189075
  * @param {object} [params] extra parameters specific to the exchange API endpoint
189076
+ * @param {boolean} [params.trigger] whether the order is a stop/trigger order
188697
189077
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
188698
189078
  */
188699
189079
  // TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
@@ -188708,7 +189088,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
188708
189088
  let method = this.safeString(params, 'method', defaultMethod);
188709
189089
  const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
188710
189090
  const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
188711
- const stop = this.safeValue(params, 'stop');
189091
+ const stop = this.safeValue2(params, 'stop', 'trigger');
188712
189092
  if (stop) {
188713
189093
  method = 'privatePostTradeCancelAlgos';
188714
189094
  }
@@ -206669,18 +207049,26 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206669
207049
  const url = this.urls['api']['ws']['ws'];
206670
207050
  const requestId = this.requestId(url);
206671
207051
  const messageHash = requestId.toString();
207052
+ const sor = this.safeValue2(params, 'sor', 'SOR', false);
207053
+ params = this.omit(params, 'sor', 'SOR');
206672
207054
  const payload = this.createOrderRequest(symbol, type, side, amount, price, params);
206673
207055
  let returnRateLimits = false;
206674
207056
  [returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
206675
207057
  payload['returnRateLimits'] = returnRateLimits;
207058
+ const test = this.safeValue(params, 'test', false);
207059
+ params = this.omit(params, 'test');
206676
207060
  const message = {
206677
207061
  'id': messageHash,
206678
207062
  'method': 'order.place',
206679
207063
  'params': this.signParams(this.extend(payload, params)),
206680
207064
  };
206681
- const test = this.safeValue(params, 'test', false);
206682
207065
  if (test) {
206683
- message['method'] = 'order.test';
207066
+ if (sor) {
207067
+ message['method'] = 'sor.order.test';
207068
+ }
207069
+ else {
207070
+ message['method'] = 'order.test';
207071
+ }
206684
207072
  }
206685
207073
  const subscription = {
206686
207074
  'method': this.handleOrderWs,
@@ -208007,6 +208395,7 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
208007
208395
  'spot': 'wss://stream.binance.us:9443/ws',
208008
208396
  },
208009
208397
  'web': 'https://www.binance.us',
208398
+ 'sapi': 'https://api.binance.us/sapi/v1',
208010
208399
  'wapi': 'https://api.binance.us/wapi/v3',
208011
208400
  'public': 'https://api.binance.us/api/v1',
208012
208401
  'private': 'https://api.binance.us/api/v3',
@@ -229313,7 +229702,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
229313
229702
  const marketId = market['id'];
229314
229703
  const url = this.getUrlByMarket(market);
229315
229704
  const messageType = this.getTypeByMarket(market);
229316
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'method', 'tickers');
229705
+ const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
229317
229706
  const channel = messageType + '.' + topic;
229318
229707
  const messageHash = 'ticker:' + symbol;
229319
229708
  const payload = [marketId];
@@ -270047,6 +270436,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
270047
270436
  /**
270048
270437
  * @method
270049
270438
  * @name upbit#withdraw
270439
+ * @see https://docs.upbit.com/reference/디지털자산-출금하기
270050
270440
  * @see https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
270051
270441
  * @description make a withdrawal
270052
270442
  * @param {string} code unified currency code
@@ -270057,14 +270447,14 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
270057
270447
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
270058
270448
  */
270059
270449
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
270060
- this.checkAddress(address);
270061
270450
  await this.loadMarkets();
270062
270451
  const currency = this.currency(code);
270063
270452
  const request = {
270064
270453
  'amount': amount,
270065
270454
  };
270066
- let method = 'privatePostWithdraws';
270455
+ let response = undefined;
270067
270456
  if (code !== 'KRW') {
270457
+ this.checkAddress(address);
270068
270458
  // 2023-05-23 Change to required parameters for digital assets
270069
270459
  const network = this.safeStringUpper2(params, 'network', 'net_type');
270070
270460
  if (network === undefined) {
@@ -270072,18 +270462,17 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
270072
270462
  }
270073
270463
  params = this.omit(params, ['network']);
270074
270464
  request['net_type'] = network;
270075
- method += 'Coin';
270076
270465
  request['currency'] = currency['id'];
270077
270466
  request['address'] = address;
270078
270467
  if (tag !== undefined) {
270079
270468
  request['secondary_address'] = tag;
270080
270469
  }
270081
270470
  params = this.omit(params, 'network');
270471
+ response = await this.privatePostWithdrawsCoin(this.extend(request, params));
270082
270472
  }
270083
270473
  else {
270084
- method += 'Krw';
270474
+ response = await this.privatePostWithdrawsKrw(this.extend(request, params));
270085
270475
  }
270086
- const response = await this[method](this.extend(request, params));
270087
270476
  //
270088
270477
  // {
270089
270478
  // "type": "withdraw",
@@ -288200,7 +288589,7 @@ SOFTWARE.
288200
288589
 
288201
288590
  //-----------------------------------------------------------------------------
288202
288591
  // this is updated by vss.js when building
288203
- const version = '4.1.76';
288592
+ const version = '4.1.78';
288204
288593
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
288205
288594
  //-----------------------------------------------------------------------------
288206
288595