ccxt 4.1.33 → 4.1.35

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 (44) hide show
  1. package/README.md +8 -3
  2. package/dist/ccxt.browser.js +691 -349
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/errors.js +15 -1
  6. package/dist/cjs/src/binance.js +3 -3
  7. package/dist/cjs/src/bingx.js +16 -16
  8. package/dist/cjs/src/bitforex.js +1 -1
  9. package/dist/cjs/src/digifinex.js +176 -4
  10. package/dist/cjs/src/huobi.js +206 -39
  11. package/dist/cjs/src/kraken.js +15 -8
  12. package/dist/cjs/src/krakenfutures.js +2 -2
  13. package/dist/cjs/src/kucoin.js +233 -257
  14. package/dist/cjs/src/pro/bitget.js +1 -1
  15. package/dist/cjs/src/pro/coinex.js +1 -1
  16. package/dist/cjs/src/pro/hitbtc.js +4 -6
  17. package/dist/cjs/src/pro/okx.js +1 -1
  18. package/dist/cjs/src/woo.js +16 -8
  19. package/examples2md.js +79 -0
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/kucoin.d.ts +81 -83
  23. package/js/src/abstract/kucoinfutures.d.ts +90 -86
  24. package/js/src/base/errorHierarchy.d.ts +2 -0
  25. package/js/src/base/errorHierarchy.js +2 -0
  26. package/js/src/base/errors.d.ts +9 -1
  27. package/js/src/base/errors.js +14 -2
  28. package/js/src/binance.js +3 -3
  29. package/js/src/bingx.js +16 -16
  30. package/js/src/bitforex.js +1 -1
  31. package/js/src/digifinex.d.ts +23 -0
  32. package/js/src/digifinex.js +176 -4
  33. package/js/src/huobi.js +206 -39
  34. package/js/src/kraken.js +15 -8
  35. package/js/src/krakenfutures.js +2 -2
  36. package/js/src/kucoin.d.ts +0 -1
  37. package/js/src/kucoin.js +233 -257
  38. package/js/src/pro/bitget.js +1 -1
  39. package/js/src/pro/coinex.js +1 -1
  40. package/js/src/pro/hitbtc.js +4 -6
  41. package/js/src/pro/okx.js +1 -1
  42. package/js/src/woo.d.ts +1 -0
  43. package/js/src/woo.js +16 -8
  44. package/package.json +5 -3
@@ -11458,6 +11458,8 @@ __webpack_require__.r(__webpack_exports__);
11458
11458
  /* harmony export */ "NotSupported": () => (/* binding */ NotSupported),
11459
11459
  /* harmony export */ "NullResponse": () => (/* binding */ NullResponse),
11460
11460
  /* harmony export */ "OnMaintenance": () => (/* binding */ OnMaintenance),
11461
+ /* harmony export */ "OperationFailed": () => (/* binding */ OperationFailed),
11462
+ /* harmony export */ "OperationRejected": () => (/* binding */ OperationRejected),
11461
11463
  /* harmony export */ "OrderImmediatelyFillable": () => (/* binding */ OrderImmediatelyFillable),
11462
11464
  /* harmony export */ "OrderNotCached": () => (/* binding */ OrderNotCached),
11463
11465
  /* harmony export */ "OrderNotFillable": () => (/* binding */ OrderNotFillable),
@@ -11511,6 +11513,12 @@ class ExchangeError extends Error {
11511
11513
  this.name = 'ExchangeError';
11512
11514
  }
11513
11515
  }
11516
+ class OperationFailed extends ExchangeError {
11517
+ constructor(message) {
11518
+ super(message);
11519
+ this.name = 'OperationFailed';
11520
+ }
11521
+ }
11514
11522
  class AuthenticationError extends ExchangeError {
11515
11523
  constructor(message) {
11516
11524
  super(message);
@@ -11547,6 +11555,12 @@ class BadRequest extends ExchangeError {
11547
11555
  this.name = 'BadRequest';
11548
11556
  }
11549
11557
  }
11558
+ class OperationRejected extends BadRequest {
11559
+ constructor(message) {
11560
+ super(message);
11561
+ this.name = 'OperationRejected';
11562
+ }
11563
+ }
11550
11564
  class BadSymbol extends BadRequest {
11551
11565
  constructor(message) {
11552
11566
  super(message);
@@ -11699,7 +11713,7 @@ class RequestTimeout extends NetworkError {
11699
11713
  // // Derived class hierarchy
11700
11714
  // errorHierarchy
11701
11715
  // )
11702
- const errors = { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange };
11716
+ const errors = { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange, OperationRejected, OperationFailed };
11703
11717
 
11704
11718
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (errors);
11705
11719
 
@@ -21401,13 +21415,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
21401
21415
  * @description cancel multiple orders
21402
21416
  * @see https://binance-docs.github.io/apidocs/futures/en/#cancel-multiple-orders-trade
21403
21417
  * @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-multiple-orders-trade
21404
- * @param {[string]} ids order ids
21418
+ * @param {string[]} ids order ids
21405
21419
  * @param {string} [symbol] unified market symbol
21406
21420
  * @param {object} [params] extra parameters specific to the bingx api endpoint
21407
21421
  *
21408
21422
  * EXCHANGE SPECIFIC PARAMETERS
21409
- * @param {[string]} [params.origClientOrderIdList] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
21410
- * @param {[int]} [params.recvWindow]
21423
+ * @param {string[]} [params.origClientOrderIdList] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
21424
+ * @param {int[]} [params.recvWindow]
21411
21425
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
21412
21426
  */
21413
21427
  this.checkRequiredSymbol('cancelOrders', symbol);
@@ -26596,7 +26610,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26596
26610
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
26597
26611
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
26598
26612
  * @param {object} [params] extra parameters specific to the exchange api endpoint
26599
- * @returns {[object]} an array of objects representing market data
26613
+ * @returns {object[]} an array of objects representing market data
26600
26614
  */
26601
26615
  const requests = [this.fetchSpotMarkets(params), this.fetchSwapMarkets(params)];
26602
26616
  const promises = await Promise.all(requests);
@@ -26619,7 +26633,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26619
26633
  * @param {object} [params] extra parameters specific to the bingx api endpoint
26620
26634
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
26621
26635
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
26622
- * @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
26636
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
26623
26637
  */
26624
26638
  await this.loadMarkets();
26625
26639
  let paginate = false;
@@ -26725,7 +26739,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26725
26739
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
26726
26740
  * @param {int} [limit] the maximum amount of trades to fetch
26727
26741
  * @param {object} [params] extra parameters specific to the bingx api endpoint
26728
- * @returns {[object]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
26742
+ * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
26729
26743
  */
26730
26744
  await this.loadMarkets();
26731
26745
  const market = this.market(symbol);
@@ -27055,7 +27069,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27055
27069
  * @param {object} [params] extra parameters specific to the bingx api endpoint
27056
27070
  * @param {int} [params.until] timestamp in ms of the latest funding rate to fetch
27057
27071
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
27058
- * @returns {[object]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
27072
+ * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
27059
27073
  */
27060
27074
  this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
27061
27075
  await this.loadMarkets();
@@ -27218,7 +27232,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27218
27232
  * @name bingx#fetchTickers
27219
27233
  * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
27220
27234
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Ticker
27221
- * @param {[string]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
27235
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
27222
27236
  * @param {object} [params] extra parameters specific to the bingx api endpoint
27223
27237
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
27224
27238
  */
@@ -27455,10 +27469,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27455
27469
  * @description fetch all open positions
27456
27470
  * @see https://bingx-api.github.io/docs/#/swapV2/account-api.html#Perpetual%20Swap%20Positions
27457
27471
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Query%20standard%20contract%20balance
27458
- * @param {[string]|undefined} symbols list of unified market symbols
27472
+ * @param {string[]|undefined} symbols list of unified market symbols
27459
27473
  * @param {object} [params] extra parameters specific to the bingx api endpoint
27460
27474
  * @param {boolean} [params.standard] whether to fetch standard contract positions
27461
- * @returns {[object]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
27475
+ * @returns {object[]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
27462
27476
  */
27463
27477
  await this.loadMarkets();
27464
27478
  symbols = this.marketSymbols(symbols);
@@ -27982,7 +27996,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27982
27996
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders
27983
27997
  * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
27984
27998
  * @param {object} [params] extra parameters specific to the bingx api endpoint
27985
- * @returns {[object]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
27999
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
27986
28000
  */
27987
28001
  this.checkRequiredSymbol('cancelAllOrders', symbol);
27988
28002
  await this.loadMarkets();
@@ -28032,7 +28046,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28032
28046
  * @description cancel multiple orders
28033
28047
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20a%20Batch%20of%20Orders
28034
28048
  * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20a%20Batch%20of%20Orders
28035
- * @param {[string]} ids order ids
28049
+ * @param {string[]} ids order ids
28036
28050
  * @param {string} symbol unified market symbol, default is undefined
28037
28051
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28038
28052
  * @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -28181,7 +28195,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28181
28195
  * @param {int} [since] the earliest time in ms to fetch open orders for
28182
28196
  * @param {int} [limit] the maximum number of open order structures to retrieve
28183
28197
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28184
- * @returns {[object]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
28198
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
28185
28199
  */
28186
28200
  this.checkRequiredSymbol('fetchOrders', symbol);
28187
28201
  await this.loadMarkets();
@@ -28270,7 +28284,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28270
28284
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28271
28285
  * @param {int} [params.until] the latest time in ms to fetch orders for
28272
28286
  * @param {boolean} [params.standard] whether to fetch standard contract orders
28273
- * @returns {[object]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
28287
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
28274
28288
  */
28275
28289
  this.checkRequiredSymbol('fetchClosedOrders', symbol);
28276
28290
  await this.loadMarkets();
@@ -28401,7 +28415,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28401
28415
  * @param {int} [since] the earliest time in ms to fetch transfers for
28402
28416
  * @param {int} [limit] the maximum number of transfers structures to retrieve
28403
28417
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28404
- * @returns {[object]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
28418
+ * @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
28405
28419
  */
28406
28420
  await this.loadMarkets();
28407
28421
  let currency = undefined;
@@ -28546,7 +28560,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28546
28560
  * @param {int} [since] the earliest time in ms to fetch deposits for
28547
28561
  * @param {int} [limit] the maximum number of deposits structures to retrieve
28548
28562
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28549
- * @returns {[object]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
28563
+ * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
28550
28564
  */
28551
28565
  await this.loadMarkets();
28552
28566
  const request = {};
@@ -28591,7 +28605,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28591
28605
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
28592
28606
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
28593
28607
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28594
- * @returns {[object]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
28608
+ * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
28595
28609
  */
28596
28610
  await this.loadMarkets();
28597
28611
  const request = {};
@@ -28864,7 +28878,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28864
28878
  * @param {int} [limit] the maximum number of trades structures to retrieve
28865
28879
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28866
28880
  * @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
28867
- * @returns {[object]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
28881
+ * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
28868
28882
  */
28869
28883
  this.checkRequiredArgument('fetchMyTrades', symbol, 'symbol');
28870
28884
  this.checkRequiredArgument('fetchMyTrades', since, 'since');
@@ -28974,7 +28988,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28974
28988
  * @name bingx#fetchDepositWithdrawFees
28975
28989
  * @description fetch deposit and withdraw fees
28976
28990
  * @see https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins'%20Information
28977
- * @param {[string]|undefined} codes list of unified currency codes
28991
+ * @param {string[]|undefined} codes list of unified currency codes
28978
28992
  * @param {object} [params] extra parameters specific to the bingx api endpoint
28979
28993
  * @returns {object} a list of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
28980
28994
  */
@@ -38720,7 +38734,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
38720
38734
  * @method
38721
38735
  * @name bitforex#fetchOrder
38722
38736
  * @description fetches information on an order made by the user
38723
- * @see
38737
+ * @see https://apidoc.bitforex.com/#order-information-user_data
38724
38738
  * @param {string} symbol unified symbol of the market the order was made in
38725
38739
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
38726
38740
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -111046,7 +111060,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
111046
111060
  'swap': true,
111047
111061
  'future': false,
111048
111062
  'option': false,
111049
- 'addMargin': false,
111063
+ 'addMargin': true,
111050
111064
  'cancelOrder': true,
111051
111065
  'cancelOrders': true,
111052
111066
  'createOrder': true,
@@ -111066,7 +111080,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
111066
111080
  'fetchDeposits': true,
111067
111081
  'fetchDepositWithdrawFee': 'emulated',
111068
111082
  'fetchDepositWithdrawFees': true,
111069
- 'fetchFundingHistory': false,
111083
+ 'fetchFundingHistory': true,
111070
111084
  'fetchFundingRate': true,
111071
111085
  'fetchFundingRateHistory': true,
111072
111086
  'fetchFundingRates': false,
@@ -111098,10 +111112,10 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
111098
111112
  'fetchTradingFees': false,
111099
111113
  'fetchTransfers': true,
111100
111114
  'fetchWithdrawals': true,
111101
- 'reduceMargin': false,
111115
+ 'reduceMargin': true,
111102
111116
  'setLeverage': true,
111103
111117
  'setMargin': false,
111104
- 'setMarginMode': false,
111118
+ 'setMarginMode': true,
111105
111119
  'setPositionMode': false,
111106
111120
  'transfer': true,
111107
111121
  'withdraw': true,
@@ -114843,6 +114857,178 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
114843
114857
  }
114844
114858
  return depositWithdrawFees;
114845
114859
  }
114860
+ async addMargin(symbol, amount, params = {}) {
114861
+ /**
114862
+ * @method
114863
+ * @name digifinex#addMargin
114864
+ * @description add margin to a position
114865
+ * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
114866
+ * @param {string} symbol unified market symbol
114867
+ * @param {float} amount amount of margin to add
114868
+ * @param {object} [params] extra parameters specific to the digifinex api endpoint
114869
+ * @param {string} params.side the position side: 'long' or 'short'
114870
+ * @returns {object} a [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#margin-structure}
114871
+ */
114872
+ const side = this.safeString(params, 'side');
114873
+ this.checkRequiredArgument('addMargin', side, 'side', ['long', 'short']);
114874
+ return await this.modifyMarginHelper(symbol, amount, 1, params);
114875
+ }
114876
+ async reduceMargin(symbol, amount, params = {}) {
114877
+ /**
114878
+ * @method
114879
+ * @name digifinex#reduceMargin
114880
+ * @description remove margin from a position
114881
+ * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
114882
+ * @param {string} symbol unified market symbol
114883
+ * @param {float} amount the amount of margin to remove
114884
+ * @param {object} [params] extra parameters specific to the digifinex api endpoint
114885
+ * @param {string} params.side the position side: 'long' or 'short'
114886
+ * @returns {object} a [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#margin-structure}
114887
+ */
114888
+ const side = this.safeString(params, 'side');
114889
+ this.checkRequiredArgument('reduceMargin', side, 'side', ['long', 'short']);
114890
+ return await this.modifyMarginHelper(symbol, amount, 2, params);
114891
+ }
114892
+ async modifyMarginHelper(symbol, amount, type, params = {}) {
114893
+ await this.loadMarkets();
114894
+ const side = this.safeString(params, 'side');
114895
+ const market = this.market(symbol);
114896
+ const request = {
114897
+ 'instrument_id': market['id'],
114898
+ 'amount': this.numberToString(amount),
114899
+ 'type': type,
114900
+ 'side': side,
114901
+ };
114902
+ const response = await this.privateSwapPostAccountPositionMargin(this.extend(request, params));
114903
+ //
114904
+ // {
114905
+ // "code": 0,
114906
+ // "data": {
114907
+ // "instrument_id": "BTCUSDTPERP",
114908
+ // "side": "long",
114909
+ // "type": 1,
114910
+ // "amount": "3.6834"
114911
+ // }
114912
+ // }
114913
+ //
114914
+ const code = this.safeInteger(response, 'code');
114915
+ const status = (code === 0) ? 'ok' : 'failed';
114916
+ const data = this.safeValue(response, 'data', {});
114917
+ return this.extend(this.parseMarginModification(data, market), {
114918
+ 'status': status,
114919
+ });
114920
+ }
114921
+ parseMarginModification(data, market = undefined) {
114922
+ //
114923
+ // {
114924
+ // "instrument_id": "BTCUSDTPERP",
114925
+ // "side": "long",
114926
+ // "type": 1,
114927
+ // "amount": "3.6834"
114928
+ // }
114929
+ //
114930
+ const marketId = this.safeString(data, 'instrument_id');
114931
+ const rawType = this.safeInteger(data, 'type');
114932
+ return {
114933
+ 'info': data,
114934
+ 'type': (rawType === 1) ? 'add' : 'reduce',
114935
+ 'amount': this.safeNumber(data, 'amount'),
114936
+ 'total': undefined,
114937
+ 'code': market['settle'],
114938
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
114939
+ 'status': undefined,
114940
+ };
114941
+ }
114942
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
114943
+ /**
114944
+ * @method
114945
+ * @name digifinex#fetchFundingHistory
114946
+ * @description fetch the history of funding payments paid and received on this account
114947
+ * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#funding-fee
114948
+ * @param {string} [symbol] unified market symbol
114949
+ * @param {int} [since] the earliest time in ms to fetch funding history for
114950
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
114951
+ * @param {object} [params] extra parameters specific to the digifinex api endpoint
114952
+ * @param {int} [params.until] timestamp in ms of the latest funding payment
114953
+ * @returns {object} a [funding history structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-history-structure}
114954
+ */
114955
+ await this.loadMarkets();
114956
+ let request = {};
114957
+ [request, params] = this.handleUntilOption('end_timestamp', request, params);
114958
+ let market = undefined;
114959
+ if (symbol !== undefined) {
114960
+ market = this.market(symbol);
114961
+ request['instrument_id'] = market['id'];
114962
+ }
114963
+ if (limit !== undefined) {
114964
+ request['limit'] = limit;
114965
+ }
114966
+ if (since !== undefined) {
114967
+ request['start_timestamp'] = since;
114968
+ }
114969
+ const response = await this.privateSwapGetAccountFundingFee(this.extend(request, params));
114970
+ //
114971
+ // {
114972
+ // "code": 0,
114973
+ // "data": [
114974
+ // {
114975
+ // "instrument_id": "BTCUSDTPERP",
114976
+ // "currency": "USDT",
114977
+ // "amount": "-0.000342814",
114978
+ // "timestamp": 1698768009440
114979
+ // }
114980
+ // ]
114981
+ // }
114982
+ //
114983
+ const data = this.safeValue(response, 'data', []);
114984
+ return this.parseIncomes(data, market, since, limit);
114985
+ }
114986
+ parseIncome(income, market = undefined) {
114987
+ //
114988
+ // {
114989
+ // "instrument_id": "BTCUSDTPERP",
114990
+ // "currency": "USDT",
114991
+ // "amount": "-0.000342814",
114992
+ // "timestamp": 1698768009440
114993
+ // }
114994
+ //
114995
+ const marketId = this.safeString(income, 'instrument_id');
114996
+ const currencyId = this.safeString(income, 'currency');
114997
+ const timestamp = this.safeInteger(income, 'timestamp');
114998
+ return {
114999
+ 'info': income,
115000
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
115001
+ 'code': this.safeCurrencyCode(currencyId),
115002
+ 'timestamp': timestamp,
115003
+ 'datetime': this.iso8601(timestamp),
115004
+ 'id': undefined,
115005
+ 'amount': this.safeNumber(income, 'amount'),
115006
+ };
115007
+ }
115008
+ async setMarginMode(marginMode, symbol = undefined, params = {}) {
115009
+ /**
115010
+ * @method
115011
+ * @name digifinex#setMarginMode
115012
+ * @description set margin mode to 'cross' or 'isolated'
115013
+ * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmode
115014
+ * @param {string} marginMode 'cross' or 'isolated'
115015
+ * @param {string} symbol unified market symbol
115016
+ * @param {object} [params] extra parameters specific to the digifinex api endpoint
115017
+ * @returns {object} response from the exchange
115018
+ */
115019
+ this.checkRequiredSymbol('setMarginMode', symbol);
115020
+ await this.loadMarkets();
115021
+ const market = this.market(symbol);
115022
+ marginMode = marginMode.toLowerCase();
115023
+ if (marginMode === 'cross') {
115024
+ marginMode = 'crossed';
115025
+ }
115026
+ const request = {
115027
+ 'instrument_id': market['id'],
115028
+ 'margin_mode': marginMode,
115029
+ };
115030
+ return await this.privateSwapPostAccountPositionMode(this.extend(request, params));
115031
+ }
114846
115032
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
114847
115033
  const signed = api[0] === 'private';
114848
115034
  const endpoint = api[1];
@@ -132153,41 +132339,195 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
132153
132339
  },
132154
132340
  'networks': {
132155
132341
  // by displaynames
132156
- 'ALGO': 'ALGO',
132157
- 'ALGORAND': 'ALGO',
132158
- 'BEP20': 'BEP20',
132159
- 'BSC': 'BEP20',
132160
- 'ERC20': 'ERC20',
132161
- 'ETH': 'ERC20',
132162
- 'AVALANCHE': 'AVAXCCHAIN',
132163
- 'AVAX': 'AVAXCCHAIN',
132164
- 'HRC20': 'HECO',
132165
- 'HECO': 'HECO',
132166
- // 'HT': 'HECO', // HT is not acceptable networkcode for unification
132167
- 'TRC20': 'TRC20',
132168
- 'TRX': 'TRC20',
132169
- 'BTC': 'BTC',
132170
- 'BITCOIN': 'BTC',
132171
- 'ARBITRUM': 'ARB',
132172
- 'ARB': 'ARB',
132173
- 'SOLANA': 'SOL',
132174
- 'SOL': 'SOL',
132175
- 'SPL': 'SOL',
132176
- 'PRC20': 'PRC20',
132177
- 'POLYGON': 'PRC20',
132178
- 'MATIC': 'PRC20',
132179
- },
132180
- 'networksById': {
132181
- 'ALGO': 'ALGO',
132182
- 'BEP20': 'BEP20',
132183
- 'ERC20': 'ERC20',
132184
- 'AVAXCCHAIN': 'AVALANCHE',
132185
- 'HECO': 'HRC20',
132186
- 'TRC20': 'TRC20',
132342
+ 'TRC20': 'TRX',
132187
132343
  'BTC': 'BTC',
132188
- 'ARB': 'ARBITRUM',
132344
+ 'ERC20': 'ETH',
132189
132345
  'SOL': 'SOLANA',
132190
- 'PRC20': 'POLYGON',
132346
+ 'HRC20': 'HECO',
132347
+ 'BEP20': 'BSC',
132348
+ 'XMR': 'XMR',
132349
+ 'LTC': 'LTC',
132350
+ 'XRP': 'XRP',
132351
+ 'XLM': 'XLM',
132352
+ 'CRONOS': 'CRO',
132353
+ 'CRO': 'CRO',
132354
+ 'GLMR': 'GLMR',
132355
+ 'POLYGON': 'MATIC',
132356
+ 'MATIC': 'MATIC',
132357
+ 'BTT': 'BTT',
132358
+ 'CUBE': 'CUBE',
132359
+ 'IOST': 'IOST',
132360
+ 'NEO': 'NEO',
132361
+ 'KLAY': 'KLAY',
132362
+ 'EOS': 'EOS',
132363
+ 'THETA': 'THETA',
132364
+ 'NAS': 'NAS',
132365
+ 'NULS': 'NULS',
132366
+ 'QTUM': 'QTUM',
132367
+ 'FTM': 'FTM',
132368
+ 'CELO': 'CELO',
132369
+ 'DOGE': 'DOGE',
132370
+ 'DOGECHAIN': 'DOGECHAIN',
132371
+ 'NEAR': 'NEAR',
132372
+ 'STEP': 'STEP',
132373
+ 'BITCI': 'BITCI',
132374
+ 'CARDANO': 'ADA',
132375
+ 'ADA': 'ADA',
132376
+ 'ETC': 'ETC',
132377
+ 'LUK': 'LUK',
132378
+ 'MINEPLEX': 'MINEPLEX',
132379
+ 'DASH': 'DASH',
132380
+ 'ZEC': 'ZEC',
132381
+ 'IOTA': 'IOTA',
132382
+ 'NEON3': 'NEON3',
132383
+ 'XEM': 'XEM',
132384
+ 'HC': 'HC',
132385
+ 'LSK': 'LSK',
132386
+ 'DCR': 'DCR',
132387
+ 'BTG': 'BTG',
132388
+ 'STEEM': 'STEEM',
132389
+ 'BTS': 'BTS',
132390
+ 'ICX': 'ICX',
132391
+ 'WAVES': 'WAVES',
132392
+ 'CMT': 'CMT',
132393
+ 'BTM': 'BTM',
132394
+ 'VET': 'VET',
132395
+ 'XZC': 'XZC',
132396
+ 'ACT': 'ACT',
132397
+ 'SMT': 'SMT',
132398
+ 'BCD': 'BCD',
132399
+ 'WAX': 'WAX1',
132400
+ 'WICC': 'WICC',
132401
+ 'ELF': 'ELF',
132402
+ 'ZIL': 'ZIL',
132403
+ 'ELA': 'ELA',
132404
+ 'BCX': 'BCX',
132405
+ 'SBTC': 'SBTC',
132406
+ 'BIFI': 'BIFI',
132407
+ 'CTXC': 'CTXC',
132408
+ 'WAN': 'WAN',
132409
+ 'POLYX': 'POLYX',
132410
+ 'PAI': 'PAI',
132411
+ 'WTC': 'WTC',
132412
+ 'DGB': 'DGB',
132413
+ 'XVG': 'XVG',
132414
+ 'AAC': 'AAC',
132415
+ 'AE': 'AE',
132416
+ 'SEELE': 'SEELE',
132417
+ 'BCV': 'BCV',
132418
+ 'GRS': 'GRS',
132419
+ 'ARDR': 'ARDR',
132420
+ 'NANO': 'NANO',
132421
+ 'ZEN': 'ZEN',
132422
+ 'RBTC': 'RBTC',
132423
+ 'BSV': 'BSV',
132424
+ 'GAS': 'GAS',
132425
+ 'XTZ': 'XTZ',
132426
+ 'LAMB': 'LAMB',
132427
+ 'CVNT1': 'CVNT1',
132428
+ 'DOCK': 'DOCK',
132429
+ 'SC': 'SC',
132430
+ 'KMD': 'KMD',
132431
+ 'ETN': 'ETN',
132432
+ 'TOP': 'TOP',
132433
+ 'IRIS': 'IRIS',
132434
+ 'UGAS': 'UGAS',
132435
+ 'TT': 'TT',
132436
+ 'NEWTON': 'NEWTON',
132437
+ 'VSYS': 'VSYS',
132438
+ 'FSN': 'FSN',
132439
+ 'BHD': 'BHD',
132440
+ 'ONE': 'ONE',
132441
+ 'EM': 'EM',
132442
+ 'CKB': 'CKB',
132443
+ 'EOSS': 'EOSS',
132444
+ 'HIVE': 'HIVE',
132445
+ 'RVN': 'RVN',
132446
+ 'DOT': 'DOT',
132447
+ 'KSM': 'KSM',
132448
+ 'BAND': 'BAND',
132449
+ 'OEP4': 'OEP4',
132450
+ 'NBS': 'NBS',
132451
+ 'FIS': 'FIS',
132452
+ 'AR': 'AR',
132453
+ 'HBAR': 'HBAR',
132454
+ 'FIL': 'FIL',
132455
+ 'MASS': 'MASS',
132456
+ 'KAVA': 'KAVA',
132457
+ 'XYM': 'XYM',
132458
+ 'ENJ': 'ENJ',
132459
+ 'CRUST': 'CRUST',
132460
+ 'ICP': 'ICP',
132461
+ 'CSPR': 'CSPR',
132462
+ 'FLOW': 'FLOW',
132463
+ 'IOTX': 'IOTX',
132464
+ 'LAT': 'LAT',
132465
+ 'APT': 'APT',
132466
+ 'XCH': 'XCH',
132467
+ 'MINA': 'MINA',
132468
+ 'XEC': 'ECASH',
132469
+ 'XPRT': 'XPRT',
132470
+ 'CCA': 'ACA',
132471
+ 'AOTI': 'COTI',
132472
+ 'AKT': 'AKT',
132473
+ 'ARS': 'ARS',
132474
+ 'ASTR': 'ASTR',
132475
+ 'AZERO': 'AZERO',
132476
+ 'BLD': 'BLD',
132477
+ 'BRISE': 'BRISE',
132478
+ 'CORE': 'CORE',
132479
+ 'DESO': 'DESO',
132480
+ 'DFI': 'DFI',
132481
+ 'EGLD': 'EGLD',
132482
+ 'ERG': 'ERG',
132483
+ 'ETHF': 'ETHFAIR',
132484
+ 'ETHW': 'ETHW',
132485
+ 'EVMOS': 'EVMOS',
132486
+ 'FIO': 'FIO',
132487
+ 'FLR': 'FLR',
132488
+ 'FINSCHIA': 'FINSCHIA',
132489
+ 'KMA': 'KMA',
132490
+ 'KYVE': 'KYVE',
132491
+ 'MEV': 'MEV',
132492
+ 'MOVR': 'MOVR',
132493
+ 'NODL': 'NODL',
132494
+ 'OAS': 'OAS',
132495
+ 'OSMO': 'OSMO',
132496
+ 'PAYCOIN': 'PAYCOIN',
132497
+ 'POKT': 'POKT',
132498
+ 'PYG': 'PYG',
132499
+ 'REI': 'REI',
132500
+ 'SCRT': 'SCRT',
132501
+ 'SDN': 'SDN',
132502
+ 'SEI': 'SEI',
132503
+ 'SGB': 'SGB',
132504
+ 'SUI': 'SUI',
132505
+ 'SXP': 'SOLAR',
132506
+ 'SYS': 'SYS',
132507
+ 'TENET': 'TENET',
132508
+ 'TON': 'TON',
132509
+ 'UNQ': 'UNQ',
132510
+ 'UYU': 'UYU',
132511
+ 'WEMIX': 'WEMIX',
132512
+ 'XDC': 'XDC',
132513
+ 'XPLA': 'XPLA',
132514
+ // todo: below
132515
+ // 'LUNC': 'LUNC',
132516
+ // 'TERRA': 'TERRA', // tbd
132517
+ // 'LUNA': 'LUNA', tbd
132518
+ // 'FCT2': 'FCT2',
132519
+ // FIL-0X ?
132520
+ // 'COSMOS': 'ATOM1',
132521
+ // 'ATOM': 'ATOM1',
132522
+ // 'CRO': 'CRO',
132523
+ // 'OP': [ 'OPTIMISM', 'OPTIMISMETH' ]
132524
+ // 'ARB': ['ARB', 'ARBITRUMETH']
132525
+ // 'CHZ': [ 'CHZ', 'CZH' ],
132526
+ // todo: AVAXCCHAIN CCHAIN AVAX
132527
+ // 'ALGO': ['ALGO', 'ALGOUSDT']
132528
+ // 'ONT': [ 'ONT', 'ONTOLOGY' ],
132529
+ // 'BCC': 'BCC', BCH's somewhat chain
132530
+ // 'DBC1': 'DBC1',
132191
132531
  },
132192
132532
  // https://github.com/ccxt/ccxt/issues/5376
132193
132533
  'fetchOrdersByStatesMethod': 'spot_private_get_v1_order_orders',
@@ -134138,10 +134478,10 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134138
134478
  for (let j = 0; j < chains.length; j++) {
134139
134479
  const chainEntry = chains[j];
134140
134480
  const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
134141
- const title = this.safeString(chainEntry, 'displayName');
134481
+ const title = this.safeString2(chainEntry, 'baseChain', 'displayName'); // baseChain and baseChainProtocol are together existent or inexistent in entries, but baseChain is preferred. when they are both inexistent, then we use generic displayName
134142
134482
  this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
134143
134483
  this.options['networkNamesByChainIds'][uniqueChainId] = title;
134144
- const networkCode = this.networkIdToCode(title, code);
134484
+ const networkCode = this.networkIdToCode(uniqueChainId);
134145
134485
  minWithdraw = this.safeNumber(chainEntry, 'minWithdrawAmt');
134146
134486
  maxWithdraw = this.safeNumber(chainEntry, 'maxWithdrawAmt');
134147
134487
  const withdrawStatus = this.safeString(chainEntry, 'withdrawStatus');
@@ -134161,6 +134501,10 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134161
134501
  'id': uniqueChainId,
134162
134502
  'network': networkCode,
134163
134503
  'limits': {
134504
+ 'deposit': {
134505
+ 'min': undefined,
134506
+ 'max': undefined,
134507
+ },
134164
134508
  'withdraw': {
134165
134509
  'min': minWithdraw,
134166
134510
  'max': maxWithdraw,
@@ -134191,6 +134535,10 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134191
134535
  'min': minWithdraw,
134192
134536
  'max': maxWithdraw,
134193
134537
  },
134538
+ 'deposit': {
134539
+ 'min': undefined,
134540
+ 'max': undefined,
134541
+ },
134194
134542
  },
134195
134543
  'precision': this.parseNumber(minPrecision),
134196
134544
  'networks': networks,
@@ -134218,8 +134566,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
134218
134566
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' networkCodeToId() - markets need to be loaded at first');
134219
134567
  }
134220
134568
  const uniqueNetworkIds = this.safeValue(this.options['networkChainIdsByNames'], currencyCode, {});
134221
- const networkTitle = super.networkCodeToId(networkCode);
134222
- return this.safeValue(uniqueNetworkIds, networkTitle, networkTitle);
134569
+ if (networkCode in uniqueNetworkIds) {
134570
+ return uniqueNetworkIds[networkCode];
134571
+ }
134572
+ else {
134573
+ const networkTitle = super.networkCodeToId(networkCode);
134574
+ return this.safeValue(uniqueNetworkIds, networkTitle, networkTitle);
134575
+ }
134223
134576
  }
134224
134577
  async fetchBalance(params = {}) {
134225
134578
  /**
@@ -136658,7 +137011,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136658
137011
  'currency': code,
136659
137012
  'address': address,
136660
137013
  'tag': tag,
136661
- 'network': this.networkIdToCode(networkId, code),
137014
+ 'network': this.networkIdToCode(networkId),
136662
137015
  'note': note,
136663
137016
  'info': depositAddress,
136664
137017
  };
@@ -136933,7 +137286,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136933
137286
  'txid': txHash,
136934
137287
  'timestamp': timestamp,
136935
137288
  'datetime': this.iso8601(timestamp),
136936
- 'network': this.networkIdToCode(networkId, code),
137289
+ 'network': this.networkIdToCode(networkId),
136937
137290
  'address': this.safeString(transaction, 'address'),
136938
137291
  'addressTo': undefined,
136939
137292
  'addressFrom': undefined,
@@ -146320,8 +146673,10 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
146320
146673
  for (let i = 0; i < currencyIds.length; i++) {
146321
146674
  const currencyId = currencyIds[i];
146322
146675
  const code = this.safeCurrencyCode(currencyId);
146676
+ const balance = this.safeValue(balances, currencyId, {});
146323
146677
  const account = this.account();
146324
- account['total'] = this.safeString(balances, currencyId);
146678
+ account['used'] = this.safeString(balance, 'hold_trade');
146679
+ account['total'] = this.safeString(balance, 'balance');
146325
146680
  result[code] = account;
146326
146681
  }
146327
146682
  return this.safeBalance(result);
@@ -146331,19 +146686,24 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
146331
146686
  * @method
146332
146687
  * @name kraken#fetchBalance
146333
146688
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
146334
- * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getAccountBalance
146689
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getExtendedBalance
146335
146690
  * @param {object} [params] extra parameters specific to the kraken api endpoint
146336
146691
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
146337
146692
  */
146338
146693
  await this.loadMarkets();
146339
- const response = await this.privatePostBalance(params);
146694
+ const response = await this.privatePostBalanceEx(params);
146340
146695
  //
146341
146696
  // {
146342
- // "error":[],
146343
- // "result":{
146344
- // "ZUSD":"58.8649",
146345
- // "KFEE":"4399.43",
146346
- // "XXBT":"0.0000034506",
146697
+ // "error": [],
146698
+ // "result": {
146699
+ // "ZUSD": {
146700
+ // "balance": 25435.21,
146701
+ // "hold_trade": 8249.76
146702
+ // },
146703
+ // "XXBT": {
146704
+ // "balance": 1.2435,
146705
+ // "hold_trade": 0.8423
146706
+ // }
146347
146707
  // }
146348
146708
  // }
146349
146709
  //
@@ -148836,12 +149196,12 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
148836
149196
  * @name krakenfutures#cancelOrders
148837
149197
  * @description cancel multiple orders
148838
149198
  * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-batch-order-management
148839
- * @param {[string]} ids order ids
149199
+ * @param {string[]} ids order ids
148840
149200
  * @param {string} [symbol] unified market symbol
148841
149201
  * @param {object} [params] extra parameters specific to the bingx api endpoint
148842
149202
  *
148843
149203
  * EXCHANGE SPECIFIC PARAMETERS
148844
- * @param {[string]} [params.clientOrderIds] max length 10 e.g. ["my_id_1","my_id_2"]
149204
+ * @param {string[]} [params.clientOrderIds] max length 10 e.g. ["my_id_1","my_id_2"]
148845
149205
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
148846
149206
  */
148847
149207
  await this.loadMarkets();
@@ -150190,11 +150550,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150190
150550
  'id': 'kucoin',
150191
150551
  'name': 'KuCoin',
150192
150552
  'countries': ['SC'],
150193
- // note "only some endpoints are rate-limited"
150194
- // so I set the 'ratelimit' on those which supposedly 'arent ratelimited'
150195
- // to the limit of the cheapest endpoint
150196
- // 60 requests in 3 seconds = 20 requests per second => ( 1000ms / 20 ) = 50 ms between requests on average
150197
- 'rateLimit': 50,
150553
+ 'rateLimit': 10,
150198
150554
  'version': 'v2',
150199
150555
  'certified': true,
150200
150556
  'pro': true,
@@ -150223,7 +150579,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150223
150579
  'fetchBorrowInterest': true,
150224
150580
  'fetchBorrowRate': false,
150225
150581
  'fetchBorrowRateHistories': false,
150226
- 'fetchBorrowRateHistory': true,
150582
+ 'fetchBorrowRateHistory': false,
150227
150583
  'fetchBorrowRates': false,
150228
150584
  'fetchClosedOrders': true,
150229
150585
  'fetchCurrencies': true,
@@ -150284,13 +150640,6 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150284
150640
  'futuresPublic': 'https://api-futures.kucoin.com',
150285
150641
  'webExchange': 'https://kucoin.com/_api',
150286
150642
  },
150287
- 'test': {
150288
- 'public': 'https://openapi-sandbox.kucoin.com',
150289
- 'private': 'https://openapi-sandbox.kucoin.com',
150290
- 'futuresPrivate': 'https://api-sandbox-futures.kucoin.com',
150291
- 'futuresPublic': 'https://api-sandbox-futures.kucoin.com',
150292
- 'webExchange': 'https://kucoin.com/_api',
150293
- },
150294
150643
  'www': 'https://www.kucoin.com',
150295
150644
  'doc': [
150296
150645
  'https://docs.kucoin.com',
@@ -150302,205 +150651,229 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150302
150651
  'password': true,
150303
150652
  },
150304
150653
  'api': {
150654
+ // level VIP0
150655
+ // Spot => 3000/30s => 100/s
150656
+ // Weight = x => 100/(100/x) = x
150657
+ // Futures Management Public => 2000/30s => 200/3/s
150658
+ // Weight = x => 100/(200/3/x) = x*1.5
150305
150659
  'public': {
150306
150660
  'get': {
150307
- 'timestamp': 1,
150308
- 'status': 1,
150309
- 'symbols': 1,
150310
- 'markets': 1,
150311
- 'market/allTickers': 1,
150312
- 'market/orderbook/level{level}_{limit}': 1,
150313
- 'market/orderbook/level2_20': 1,
150314
- 'market/orderbook/level2_100': 1,
150315
- 'market/histories': 1,
150316
- 'market/candles': 1,
150317
- 'market/stats': 1,
150318
- 'currencies': 1,
150319
- 'currencies/{currency}': 1,
150320
- 'prices': 1,
150321
- 'mark-price/{symbol}/current': 1,
150322
- 'margin/config': 1,
150323
- 'margin/trade/last': 1,
150661
+ // spot trading
150662
+ 'currencies': 4.5,
150663
+ 'currencies/{currency}': 4.5,
150664
+ 'symbols': 6,
150665
+ 'market/orderbook/level1': 3,
150666
+ 'market/allTickers': 22.5,
150667
+ 'market/stats': 22.5,
150668
+ 'markets': 4.5,
150669
+ 'market/orderbook/level{level}_{limit}': 6,
150670
+ 'market/orderbook/level2_20': 3,
150671
+ 'market/orderbook/level2_100': 6,
150672
+ 'market/histories': 4.5,
150673
+ 'market/candles': 4.5,
150674
+ 'prices': 4.5,
150675
+ 'timestamp': 4.5,
150676
+ 'status': 4.5,
150677
+ // margin trading
150678
+ 'mark-price/{symbol}/current': 3,
150679
+ 'margin/config': 25, // 25SW
150324
150680
  },
150325
150681
  'post': {
150326
- 'bullet-public': 1,
150682
+ // ws
150683
+ 'bullet-public': 15, // 10PW
150327
150684
  },
150328
150685
  },
150329
150686
  'private': {
150330
150687
  'get': {
150331
- 'market/orderbook/level{level}': 1,
150332
- 'market/orderbook/level2': { 'v3': 2 },
150333
- 'market/orderbook/level3': 1,
150334
- 'accounts': 1,
150335
- 'accounts/{accountId}': 1,
150336
- // 'accounts/{accountId}/ledgers': 1, Deprecated endpoint
150337
- 'accounts/ledgers': 3.333,
150338
- 'accounts/{accountId}/holds': 1,
150339
- 'accounts/transferable': 1,
150340
- 'base-fee': 1,
150341
- 'sub/user': 1,
150342
- 'user-info': 1,
150343
- 'sub/api-key': 1,
150344
- 'sub-accounts': 1,
150345
- 'sub-accounts/{subUserId}': 1,
150346
- 'deposit-addresses': 1,
150347
- 'deposits': 10,
150348
- 'hist-deposits': 10,
150349
- // 'hist-orders': 1, Deprecated endpoint
150350
- 'hist-withdrawals': 10,
150351
- 'withdrawals': 10,
150352
- 'withdrawals/quotas': 1,
150353
- 'orders': 2,
150354
- 'order/client-order/{clientOid}': 1,
150355
- 'orders/{orderId}': 1,
150356
- 'limit/orders': 1,
150357
- 'fills': 6.66667,
150358
- 'limit/fills': 1,
150359
- 'isolated/accounts': 2,
150360
- 'isolated/account/{symbol}': 2,
150361
- 'isolated/borrow/outstanding': 2,
150362
- 'isolated/borrow/repaid': 2,
150363
- 'isolated/symbols': 2,
150364
- 'margin/account': 1,
150365
- 'margin/borrow': 1,
150366
- 'margin/borrow/outstanding': 1,
150367
- 'margin/borrow/repaid': 1,
150368
- 'margin/lend/active': 1,
150369
- 'margin/lend/done': 1,
150370
- 'margin/lend/trade/unsettled': 1,
150371
- 'margin/lend/trade/settled': 1,
150372
- 'margin/lend/assets': 1,
150373
- 'margin/market': 1,
150374
- 'stop-order/{orderId}': 1,
150375
- 'stop-order': 1,
150376
- 'stop-order/queryOrderByClientOid': 1,
150377
- 'trade-fees': 1.3333,
150378
- 'hf/accounts/ledgers': 3.33,
150688
+ // account
150689
+ 'user-info': 30,
150690
+ 'accounts': 7.5,
150691
+ 'accounts/{accountId}': 7.5,
150692
+ 'accounts/ledgers': 3,
150693
+ 'hf/accounts/ledgers': 2,
150694
+ 'hf/margin/account/ledgers': 2,
150695
+ 'transaction-history': 3,
150696
+ 'sub/user': 30,
150697
+ 'sub-accounts/{subUserId}': 22.5,
150698
+ 'sub-accounts': 30,
150699
+ 'sub/api-key': 30,
150700
+ // funding
150701
+ 'margin/account': 40,
150702
+ 'margin/accounts': 15,
150703
+ 'isolated/accounts': 15,
150704
+ 'deposit-addresses': 7.5,
150705
+ 'deposits': 7.5,
150706
+ 'hist-deposits': 7.5,
150707
+ 'withdrawals': 30,
150708
+ 'hist-withdrawals': 30,
150709
+ 'withdrawals/quotas': 30,
150710
+ 'accounts/transferable': 30,
150711
+ 'transfer-list': 30,
150712
+ 'base-fee': 3,
150713
+ 'trade-fees': 3,
150714
+ // spot trading
150715
+ 'market/orderbook/level{level}': 3,
150716
+ 'market/orderbook/level2': 3,
150717
+ 'market/orderbook/level3': 3,
150379
150718
  'hf/orders/active': 2,
150380
- 'hf/orders/active/symbols': 20,
150719
+ 'hf/orders/active/symbols': 2,
150381
150720
  'hf/orders/done': 2,
150382
- 'hf/orders/{orderId}': 1,
150721
+ 'hf/orders/{orderId}': 2,
150383
150722
  'hf/orders/client-order/{clientOid}': 2,
150384
- 'hf/fills': 6.67,
150385
- 'margin/repay': 1,
150386
- 'project/list': 1,
150387
- 'project/marketInterestRate': 1,
150388
- 'redeem/orders': 1,
150389
- 'purchase/orders': 1,
150723
+ 'hf/orders/dead-cancel-all/query': 2,
150724
+ 'hf/fills': 2,
150725
+ 'orders': 2,
150726
+ 'limit/orders': 3,
150727
+ 'orders/{orderId}': 2,
150728
+ 'order/client-order/{clientOid}': 3,
150729
+ 'fills': 10,
150730
+ 'limit/fills': 20,
150731
+ 'stop-order': 8,
150732
+ 'stop-order/{orderId}': 3,
150733
+ 'stop-order/queryOrderByClientOid': 3,
150734
+ // margin trading
150735
+ 'hf/margin/orders/active': 4,
150736
+ 'hf/margin/orders/done': 10,
150737
+ 'hf/margin/orders/{orderId}': 4,
150738
+ 'hf/margin/orders/client-order/{clientOid}': 5,
150739
+ 'hf/margin/fills': 5,
150740
+ 'etf/info': 25,
150741
+ 'risk/limit/strategy': 20,
150742
+ 'isolated/symbols': 20,
150743
+ 'isolated/account/{symbol}': 50,
150744
+ 'margin/borrow': 15,
150745
+ 'margin/repay': 15,
150746
+ 'project/list': 10,
150747
+ 'project/marketInterestRate': 7.5,
150748
+ 'redeem/orders': 10,
150749
+ 'purchase/orders': 10, // 10SW
150390
150750
  },
150391
150751
  'post': {
150392
- 'accounts': 1,
150393
- 'accounts/inner-transfer': { 'v2': 1 },
150394
- 'accounts/sub-transfer': { 'v2': 25 },
150395
- 'deposit-addresses': 1,
150396
- 'withdrawals': 1,
150397
- 'orders': 4,
150398
- 'orders/test': 4,
150399
- 'orders/multi': 20,
150400
- 'isolated/borrow': 2,
150401
- 'isolated/repay/all': 2,
150402
- 'isolated/repay/single': 2,
150403
- 'margin/borrow': 1,
150404
- 'margin/order': 1,
150405
- 'margin/order/test': 1,
150406
- 'margin/repay/all': 1,
150407
- 'margin/repay/single': 1,
150408
- 'margin/lend': 1,
150409
- 'margin/toggle-auto-lend': 1,
150410
- 'bullet-private': 1,
150411
- 'stop-order': 1,
150412
- 'sub/user': 1,
150413
- 'sub/api-key': 1,
150414
- 'sub/api-key/update': 1,
150415
- 'hf/orders': 0.4,
150416
- 'hf/orders/sync': 1.33,
150417
- 'hf/orders/multi': 20,
150418
- 'hf/orders/multi/sync': 20,
150419
- 'hf/orders/alter': 1,
150420
- 'margin/repay': 1,
150421
- 'purchase': 1,
150422
- 'redeem': 1,
150423
- 'lend/purchase/update': 1,
150752
+ // account
150753
+ 'sub/user/created': 22.5,
150754
+ 'sub/api-key': 30,
150755
+ 'sub/api-key/update': 45,
150756
+ // funding
150757
+ 'deposit-addresses': 30,
150758
+ 'withdrawals': 7.5,
150759
+ 'accounts/universal-transfer': 6,
150760
+ 'accounts/sub-transfer': 45,
150761
+ 'accounts/inner-transfer': 15,
150762
+ 'transfer-out': 30,
150763
+ 'transfer-in': 30,
150764
+ // spot trading
150765
+ 'hf/orders': 1,
150766
+ 'hf/orders/test': 1,
150767
+ 'hf/orders/sync': 1,
150768
+ 'hf/orders/multi': 1,
150769
+ 'hf/orders/multi/sync': 1,
150770
+ 'hf/orders/alter': 3,
150771
+ 'hf/orders/dead-cancel-all': 2,
150772
+ 'orders': 2,
150773
+ 'orders/test': 2,
150774
+ 'orders/multi': 3,
150775
+ 'stop-order': 2,
150776
+ // margin trading
150777
+ 'hf/margin/order': 5,
150778
+ 'hf/margin/order/test': 5,
150779
+ 'margin/order': 5,
150780
+ 'margin/order/test': 5,
150781
+ 'margin/borrow': 15,
150782
+ 'margin/repay': 10,
150783
+ 'purchase': 15,
150784
+ 'redeem': 15,
150785
+ 'lend/purchase/update': 10,
150786
+ // ws
150787
+ 'bullet-private': 10, // 10SW
150424
150788
  },
150425
150789
  'delete': {
150426
- 'withdrawals/{withdrawalId}': 1,
150790
+ // account
150791
+ 'sub/api-key': 45,
150792
+ // funding
150793
+ 'withdrawals/{withdrawalId}': 30,
150794
+ // spot trading
150795
+ 'hf/orders/{orderId}': 1,
150796
+ 'hf/orders/sync/{orderId}': 1,
150797
+ 'hf/orders/client-order/{clientOid}': 1,
150798
+ 'hf/orders/sync/client-order/{clientOid}': 1,
150799
+ 'hf/orders/cancel/{orderId}': 2,
150800
+ 'hf/orders': 2,
150801
+ 'orders/{orderId}': 3,
150802
+ 'order/client-order/{clientOid}': 5,
150427
150803
  'orders': 20,
150428
- 'order/client-order/{clientOid}': 1,
150429
- 'orders/{orderId}': 1,
150430
- 'margin/lend/{orderId}': 1,
150431
- 'stop-order/cancelOrderByClientOid': 1,
150432
- 'stop-order/{orderId}': 1,
150433
- 'stop-order/cancel': 1,
150434
- 'sub/api-key': 1,
150435
- 'hf/orders/{orderId}': 0.4,
150436
- 'hf/orders/sync/{orderId}': 0.4,
150437
- 'hf/orders/client-order/{clientOid}': 0.4,
150438
- 'hf/orders/sync/client-order/{clientOid}': 0.4,
150439
- 'hf/orders/cancel/{orderId}': 1,
150440
- 'hf/orders': 20, // 3 times/3s = 1/s => cost = 20 / 1 = 20
150804
+ 'stop-order/{orderId}': 3,
150805
+ 'stop-order/cancelOrderByClientOid': 5,
150806
+ 'stop-order/cancel': 3,
150807
+ // margin trading
150808
+ 'hf/margin/orders/{orderId}': 5,
150809
+ 'hf/margin/orders/client-order/{clientOid}': 5,
150810
+ 'hf/margin/orders': 10, // 10SW
150441
150811
  },
150442
150812
  },
150443
150813
  'futuresPublic': {
150444
- // cheapest futures 'limited' endpoint is 40 requests per 3 seconds = 14.333 per second => cost = 20/14.333 = 1.3953
150445
150814
  'get': {
150446
- 'contracts/active': 1.3953,
150447
- 'contracts/{symbol}': 1.3953,
150448
- 'ticker': 1.3953,
150449
- 'level2/snapshot': 2,
150450
- 'level2/depth20': 1.3953,
150451
- 'level2/depth100': 1.3953,
150815
+ 'contracts/active': 4.5,
150816
+ 'contracts/{symbol}': 4.5,
150817
+ 'ticker': 3,
150818
+ 'level2/snapshot': 4.5,
150819
+ 'level2/depth20': 7.5,
150820
+ 'level2/depth100': 15,
150821
+ 'trade/history': 7.5,
150822
+ 'kline/query': 4.5,
150823
+ 'interest/query': 7.5,
150824
+ 'index/query': 3,
150825
+ 'mark-price/{symbol}/current': 4.5,
150826
+ 'premium/query': 4.5,
150827
+ 'funding-rate/{symbol}/current': 3,
150828
+ 'timestamp': 3,
150829
+ 'status': 6,
150830
+ // ?
150452
150831
  'level2/message/query': 1.3953,
150453
- 'level3/message/query': 1.3953,
150454
- 'level3/snapshot': 1.3953,
150455
- 'trade/history': 1.3953,
150456
- 'interest/query': 1.3953,
150457
- 'index/query': 1.3953,
150458
- 'mark-price/{symbol}/current': 1.3953,
150459
- 'premium/query': 1.3953,
150460
- 'funding-rate/{symbol}/current': 1.3953,
150461
- 'timestamp': 1.3953,
150462
- 'status': 1.3953,
150463
- 'kline/query': 1.3953,
150464
150832
  },
150465
150833
  'post': {
150466
- 'bullet-public': 1.3953,
150834
+ // ws
150835
+ 'bullet-public': 15, // 10PW
150467
150836
  },
150468
150837
  },
150469
150838
  'futuresPrivate': {
150470
150839
  'get': {
150471
- 'account-overview': 2,
150472
- 'transaction-history': 6.666,
150473
- 'deposit-address': 1.3953,
150474
- 'deposit-list': 1.3953,
150475
- 'withdrawals/quotas': 1.3953,
150476
- 'withdrawal-list': 1.3953,
150477
- 'transfer-list': 1.3953,
150478
- 'orders': 1.3953,
150479
- 'stopOrders': 1.3953,
150480
- 'recentDoneOrders': 1.3953,
150481
- 'orders/{orderId}': 1.3953,
150482
- 'orders/byClientOid': 1.3953,
150483
- 'fills': 6.666,
150484
- 'recentFills': 6.666,
150485
- 'openOrderStatistics': 1.3953,
150486
- 'position': 1.3953,
150487
- 'positions': 6.666,
150488
- 'funding-history': 6.666, // 9 requests per 3 seconds = 3 per second => cost = 20/3 = 6.666
150840
+ // account
150841
+ 'transaction-history': 3,
150842
+ // funding
150843
+ 'account-overview': 7.5,
150844
+ 'account-overview-all': 9,
150845
+ 'transfer-list': 30,
150846
+ // futures
150847
+ 'orders': 3,
150848
+ 'stopOrders': 9,
150849
+ 'recentDoneOrders': 7.5,
150850
+ 'orders/{orderId}': 7.5,
150851
+ 'orders/byClientOid': 7.5,
150852
+ 'fills': 7.5,
150853
+ 'recentFills': 4.5,
150854
+ 'openOrderStatistics': 15,
150855
+ 'position': 3,
150856
+ 'positions': 3,
150857
+ 'contracts/risk-limit/{symbol}': 7.5,
150858
+ 'funding-history': 7.5, // 5FW
150489
150859
  },
150490
150860
  'post': {
150491
- 'withdrawals': 1.3953,
150492
- 'transfer-out': 1.3953,
150493
- 'orders': 1.3953,
150494
- 'position/margin/auto-deposit-status': 1.3953,
150495
- 'position/margin/deposit-margin': 1.3953,
150496
- 'bullet-private': 1.3953,
150861
+ // funding
150862
+ 'transfer-out': 30,
150863
+ 'transfer-in': 30,
150864
+ // futures
150865
+ 'orders': 3,
150866
+ 'orders/test': 3,
150867
+ 'position/margin/auto-deposit-status': 6,
150868
+ 'position/margin/deposit-margin': 6,
150869
+ 'position/risk-limit-level/change': 6,
150870
+ // ws
150871
+ 'bullet-private': 15, // 10FW
150497
150872
  },
150498
150873
  'delete': {
150499
- 'withdrawals/{withdrawalId}': 1.3953,
150500
- 'cancel/transfer-out': 1.3953,
150501
- 'orders/{orderId}': 1.3953,
150502
- 'orders': 6.666,
150503
- 'stopOrders': 1.3953,
150874
+ 'orders/{orderId}': 1.5,
150875
+ 'orders': 45,
150876
+ 'stopOrders': 22.5, // 15FW
150504
150877
  },
150505
150878
  },
150506
150879
  'webExchange': {
@@ -150667,27 +151040,35 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150667
151040
  'versions': {
150668
151041
  'public': {
150669
151042
  'GET': {
151043
+ // spot trading
150670
151044
  'currencies': 'v3',
150671
- 'currencies/{currency}': 'v2',
150672
- 'status': 'v1',
150673
- 'market/orderbook/level2_20': 'v1',
150674
- 'market/orderbook/level2_100': 'v1',
150675
- 'market/orderbook/level{level}_{limit}': 'v1',
151045
+ 'currencies/{currency}': 'v3',
151046
+ 'symbols': 'v2',
150676
151047
  },
150677
151048
  },
150678
151049
  'private': {
150679
151050
  'GET': {
151051
+ // account
151052
+ 'user-info': 'v2',
151053
+ 'hf/margin/account/ledgers': 'v3',
151054
+ 'sub/user': 'v2',
151055
+ 'sub-accounts': 'v2',
151056
+ // funding
151057
+ 'margin/accounts': 'v3',
151058
+ 'isolated/accounts': 'v3',
151059
+ // 'deposit-addresses': 'v2',
151060
+ 'deposit-addresses': 'v1',
151061
+ // spot trading
150680
151062
  'market/orderbook/level2': 'v3',
150681
151063
  'market/orderbook/level3': 'v3',
150682
151064
  'market/orderbook/level{level}': 'v3',
150683
- 'deposit-addresses': 'v1',
150684
- 'hf/accounts/ledgers': 'v1',
150685
- 'hf/orders/active': 'v1',
150686
- 'hf/orders/active/symbols': 'v1',
150687
- 'hf/orders/done': 'v1',
150688
- 'hf/orders/{orderId}': 'v1',
150689
- 'hf/orders/client-order/{clientOid}': 'v1',
150690
- 'hf/fills': 'v1',
151065
+ // margin trading
151066
+ 'hf/margin/orders/active': 'v3',
151067
+ 'hf/margin/orders/done': 'v3',
151068
+ 'hf/margin/orders/{orderId}': 'v3',
151069
+ 'hf/margin/orders/client-order/{clientOid}': 'v3',
151070
+ 'hf/margin/fills': 'v3',
151071
+ 'etf/info': 'v3',
150691
151072
  'margin/borrow': 'v3',
150692
151073
  'margin/repay': 'v3',
150693
151074
  'project/list': 'v3',
@@ -150696,14 +151077,17 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150696
151077
  'purchase/orders': 'v3',
150697
151078
  },
150698
151079
  'POST': {
150699
- 'accounts/inner-transfer': 'v2',
151080
+ // account
151081
+ 'sub/user/created': 'v2',
151082
+ // funding
151083
+ 'accounts/universal-transfer': 'v3',
150700
151084
  'accounts/sub-transfer': 'v2',
150701
- 'accounts': 'v1',
150702
- 'hf/orders': 'v1',
150703
- 'hf/orders/sync': 'v1',
150704
- 'hf/orders/multi': 'v1',
150705
- 'hf/orders/multi/sync': 'v1',
150706
- 'hf/orders/alter': 'v1',
151085
+ 'accounts/inner-transfer': 'v2',
151086
+ 'transfer-out': 'v3',
151087
+ // spot trading
151088
+ // margin trading
151089
+ 'hf/margin/order': 'v3',
151090
+ 'hf/margin/order/test': 'v3',
150707
151091
  'margin/borrow': 'v3',
150708
151092
  'margin/repay': 'v3',
150709
151093
  'purchase': 'v3',
@@ -150711,26 +151095,18 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150711
151095
  'lend/purchase/update': 'v3',
150712
151096
  },
150713
151097
  'DELETE': {
150714
- 'hf/orders/{orderId}': 'v1',
150715
- 'hf/orders/sync/{orderId}': 'v1',
150716
- 'hf/orders/client-order/{clientOid}': 'v1',
150717
- 'hf/orders/sync/client-order/{clientOid}': 'v1',
150718
- 'hf/orders/cancel/{orderId}': 'v1',
150719
- 'hf/orders': 'v1',
151098
+ // account
151099
+ // funding
151100
+ // spot trading
151101
+ 'hf/margin/orders/{orderId}': 'v3',
151102
+ 'hf/margin/orders/client-order/{clientOid}': 'v3',
151103
+ 'hf/margin/orders': 'v3',
151104
+ // margin trading
150720
151105
  },
150721
151106
  },
150722
151107
  'futuresPrivate': {
150723
- 'GET': {
150724
- 'account-overview': 'v1',
150725
- 'positions': 'v1',
150726
- },
150727
151108
  'POST': {
150728
- 'transfer-out': 'v2',
150729
- },
150730
- },
150731
- 'futuresPublic': {
150732
- 'GET': {
150733
- 'level3/snapshot': 'v2',
151109
+ 'transfer-out': 'v3',
150734
151110
  },
150735
151111
  },
150736
151112
  },
@@ -154048,42 +154424,6 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
154048
154424
  }
154049
154425
  return this.safeValue(config, 'cost', 1);
154050
154426
  }
154051
- async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
154052
- /**
154053
- * @method
154054
- * @name kucoin#fetchBorrowRateHistory
154055
- * @description retrieves a history of a currencies borrow interest rate at specific time slots
154056
- * @see https://docs.kucoin.com/#margin-trade-data
154057
- * @param {string} code unified currency code
154058
- * @param {int} [since] timestamp for the earliest borrow rate
154059
- * @param {int} [limit] the maximum number of [borrow rate structures]
154060
- * @param {object} [params] extra parameters specific to the kucoin api endpoint
154061
- * @returns {object[]} an array of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
154062
- */
154063
- await this.loadMarkets();
154064
- const currency = this.currency(code);
154065
- const request = {
154066
- 'currency': currency['id'],
154067
- };
154068
- const response = await this.publicGetMarginTradeLast(this.extend(request, params));
154069
- //
154070
- // {
154071
- // "code": "200000",
154072
- // "data": [
154073
- // {
154074
- // "tradeId": "62db2dcaff219600012b56cd",
154075
- // "currency": "USDT",
154076
- // "size": "10",
154077
- // "dailyIntRate": "0.00003",
154078
- // "term": 7,
154079
- // "timestamp": 1658531274508488480
154080
- // },
154081
- // ]
154082
- // }
154083
- //
154084
- const data = this.safeValue(response, 'data', {});
154085
- return this.parseBorrowRateHistory(data, code, since, limit);
154086
- }
154087
154427
  parseBorrowRateHistory(response, code, since, limit) {
154088
154428
  const result = [];
154089
154429
  for (let i = 0; i < response.length; i++) {
@@ -154464,10 +154804,6 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
154464
154804
  let endpart = '';
154465
154805
  headers = (headers !== undefined) ? headers : {};
154466
154806
  let url = this.urls['api'][api];
154467
- const isSandbox = url.indexOf('sandbox') >= 0;
154468
- if (path === 'symbols' && !isSandbox) {
154469
- endpoint = '/api/v2/' + this.implodeParams(path, params);
154470
- }
154471
154807
  if (Object.keys(query).length) {
154472
154808
  if ((method === 'GET') || (method === 'DELETE')) {
154473
154809
  endpoint += '?' + this.rawencode(query);
@@ -204083,7 +204419,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
204083
204419
  const instType = market['spot'] ? 'sp' : 'mc';
204084
204420
  let channel = 'books';
204085
204421
  let incrementalFeed = true;
204086
- if ((limit === 5) || (limit === 15)) {
204422
+ if ((limit === 1) || (limit === 5) || (limit === 15)) {
204087
204423
  channel += limit.toString();
204088
204424
  incrementalFeed = false;
204089
204425
  }
@@ -217501,7 +217837,7 @@ class coinex extends _coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
217501
217837
  * @param {int|undefined} limit the maximum amount of candles to fetch
217502
217838
  * @param {object} params extra parameters specific to the coinex api endpoint
217503
217839
  * @param {int|undefined} params.end the end time for spot markets, this.seconds () is set as default
217504
- * @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
217840
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
217505
217841
  */
217506
217842
  await this.loadMarkets();
217507
217843
  const market = this.market(symbol);
@@ -222875,9 +223211,8 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
222875
223211
  * @ignore
222876
223212
  * @method
222877
223213
  * @param {string} name websocket endpoint name
222878
- * @param {[string]} [symbols] unified CCXT symbol(s)
223214
+ * @param {string[]} [symbols] unified CCXT symbol(s)
222879
223215
  * @param {object} [params] extra parameters specific to the hitbtc api
222880
- * @returns
222881
223216
  */
222882
223217
  await this.loadMarkets();
222883
223218
  const url = this.urls['api']['ws']['public'];
@@ -222900,7 +223235,6 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
222900
223235
  * @param {string} name websocket endpoint name
222901
223236
  * @param {string} [symbol] unified CCXT symbol
222902
223237
  * @param {object} [params] extra parameters specific to the hitbtc api
222903
- * @returns
222904
223238
  */
222905
223239
  await this.loadMarkets();
222906
223240
  await this.authenticate();
@@ -223354,7 +223688,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
223354
223688
  * @param {int} [since] not used by hitbtc watchOHLCV
223355
223689
  * @param {int} [limit] 0 – 1000, default value = 0 (no history returned)
223356
223690
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
223357
- * @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
223691
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
223358
223692
  */
223359
223693
  const period = this.safeString(this.timeframes, timeframe, timeframe);
223360
223694
  const name = 'candles/' + period;
@@ -223466,7 +223800,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
223466
223800
  * @param {int} [since] timestamp in ms of the earliest order to fetch
223467
223801
  * @param {int} [limit] the maximum amount of orders to fetch
223468
223802
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
223469
- * @returns {[object]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
223803
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
223470
223804
  */
223471
223805
  await this.loadMarkets();
223472
223806
  let marketType = undefined;
@@ -223698,7 +224032,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
223698
224032
  *
223699
224033
  * EXCHANGE SPECIFIC PARAMETERS
223700
224034
  * @param {string} [params.mode] 'updates' or 'batches' (default), 'updates' = messages arrive after balance updates, 'batches' = messages arrive at equal intervals if there were any updates
223701
- * @returns {[object]} a list of [balance structures]{@link https://docs.ccxt.com/#/?id=balance-structure}
224035
+ * @returns {object[]} a list of [balance structures]{@link https://docs.ccxt.com/#/?id=balance-structure}
223702
224036
  */
223703
224037
  await this.loadMarkets();
223704
224038
  let type = undefined;
@@ -236559,7 +236893,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
236559
236893
  const request = {
236560
236894
  'instType': uppercaseType,
236561
236895
  };
236562
- const orders = await this.subscribe('private', messageHash, channel, symbol, this.extend(request, params));
236896
+ const orders = await this.subscribe('private', messageHash, channel, undefined, this.extend(request, params));
236563
236897
  if (this.newUpdates) {
236564
236898
  limit = orders.getLimit(symbol, limit);
236565
236899
  }
@@ -267964,6 +268298,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
267964
268298
  },
267965
268299
  },
267966
268300
  'options': {
268301
+ 'sandboxMode': false,
267967
268302
  'createMarketBuyOrderRequiresPrice': true,
267968
268303
  // these network aliases require manual mapping here
267969
268304
  'network-aliases-for-tokens': {
@@ -269870,14 +270205,17 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
269870
270205
  else {
269871
270206
  this.checkRequiredCredentials();
269872
270207
  if (method === 'POST' && (path === 'algo/order' || path === 'order')) {
269873
- const applicationId = 'bc830de7-50f3-460b-9ee0-f430f83f9dad';
269874
- const brokerId = this.safeString(this.options, 'brokerId', applicationId);
269875
- const isStop = path.indexOf('algo') > -1;
269876
- if (isStop) {
269877
- params['brokerId'] = brokerId;
269878
- }
269879
- else {
269880
- params['broker_id'] = brokerId;
270208
+ const isSandboxMode = this.safeValue(this.options, 'sandboxMode', false);
270209
+ if (!isSandboxMode) {
270210
+ const applicationId = 'bc830de7-50f3-460b-9ee0-f430f83f9dad';
270211
+ const brokerId = this.safeString(this.options, 'brokerId', applicationId);
270212
+ const isStop = path.indexOf('algo') > -1;
270213
+ if (isStop) {
270214
+ params['brokerId'] = brokerId;
270215
+ }
270216
+ else {
270217
+ params['broker_id'] = brokerId;
270218
+ }
269881
270219
  }
269882
270220
  params = this.keysort(params);
269883
270221
  }
@@ -270333,6 +270671,10 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
270333
270671
  // if it was not returned according to above options, then return the first network of currency
270334
270672
  return this.safeValue(networkKeys, 0);
270335
270673
  }
270674
+ setSandboxMode(enable) {
270675
+ super.setSandboxMode(enable);
270676
+ this.options['sandboxMode'] = enable;
270677
+ }
270336
270678
  }
270337
270679
 
270338
270680
 
@@ -279882,7 +280224,7 @@ SOFTWARE.
279882
280224
 
279883
280225
  //-----------------------------------------------------------------------------
279884
280226
  // this is updated by vss.js when building
279885
- const version = '4.1.33';
280227
+ const version = '4.1.35';
279886
280228
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
279887
280229
  //-----------------------------------------------------------------------------
279888
280230