ccxt 4.2.77 → 4.2.79

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 (67) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.js +456 -98
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bingx.js +39 -5
  6. package/dist/cjs/src/bitstamp.js +21 -26
  7. package/dist/cjs/src/bybit.js +107 -2
  8. package/dist/cjs/src/coinbase.js +22 -9
  9. package/dist/cjs/src/coinbaseinternational.js +2 -2
  10. package/dist/cjs/src/gate.js +4 -1
  11. package/dist/cjs/src/htx.js +36 -27
  12. package/dist/cjs/src/hyperliquid.js +6 -4
  13. package/dist/cjs/src/kucoin.js +52 -0
  14. package/dist/cjs/src/okcoin.js +27 -1
  15. package/dist/cjs/src/okx.js +18 -0
  16. package/dist/cjs/src/pro/alpaca.js +1 -1
  17. package/dist/cjs/src/pro/bitfinex2.js +1 -1
  18. package/dist/cjs/src/pro/bitget.js +1 -1
  19. package/dist/cjs/src/pro/bitmart.js +1 -1
  20. package/dist/cjs/src/pro/bitmex.js +1 -1
  21. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  22. package/dist/cjs/src/pro/bybit.js +16 -1
  23. package/dist/cjs/src/pro/cex.js +9 -5
  24. package/dist/cjs/src/pro/cryptocom.js +1 -1
  25. package/dist/cjs/src/pro/hitbtc.js +1 -1
  26. package/dist/cjs/src/pro/htx.js +1 -1
  27. package/dist/cjs/src/pro/okcoin.js +1 -1
  28. package/dist/cjs/src/pro/onetrading.js +1 -1
  29. package/dist/cjs/src/pro/woo.js +38 -0
  30. package/dist/cjs/src/woo.js +47 -3
  31. package/js/ccxt.d.ts +1 -1
  32. package/js/ccxt.js +1 -1
  33. package/js/src/abstract/bingx.d.ts +1 -0
  34. package/js/src/abstract/gate.d.ts +1 -0
  35. package/js/src/abstract/gateio.d.ts +1 -0
  36. package/js/src/base/types.d.ts +2 -2
  37. package/js/src/bingx.js +39 -5
  38. package/js/src/bitstamp.js +21 -26
  39. package/js/src/bybit.d.ts +12 -1
  40. package/js/src/bybit.js +107 -2
  41. package/js/src/coinbase.d.ts +2 -2
  42. package/js/src/coinbase.js +22 -9
  43. package/js/src/coinbaseinternational.js +2 -2
  44. package/js/src/gate.js +4 -1
  45. package/js/src/htx.js +36 -27
  46. package/js/src/hyperliquid.js +6 -4
  47. package/js/src/kucoin.js +52 -0
  48. package/js/src/okcoin.js +27 -1
  49. package/js/src/okx.js +18 -0
  50. package/js/src/pro/alpaca.js +1 -1
  51. package/js/src/pro/bitfinex2.js +1 -1
  52. package/js/src/pro/bitget.js +1 -1
  53. package/js/src/pro/bitmart.js +1 -1
  54. package/js/src/pro/bitmex.js +1 -1
  55. package/js/src/pro/blockchaincom.js +1 -1
  56. package/js/src/pro/bybit.js +16 -1
  57. package/js/src/pro/cex.js +9 -5
  58. package/js/src/pro/cryptocom.js +1 -1
  59. package/js/src/pro/hitbtc.js +1 -1
  60. package/js/src/pro/htx.js +1 -1
  61. package/js/src/pro/okcoin.js +1 -1
  62. package/js/src/pro/onetrading.js +1 -1
  63. package/js/src/pro/woo.js +38 -0
  64. package/js/src/woo.d.ts +2 -0
  65. package/js/src/woo.js +47 -3
  66. package/package.json +1 -1
  67. package/skip-tests.json +5 -1
@@ -31354,6 +31354,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31354
31354
  'post': {
31355
31355
  'trade/cancelReplace': 1,
31356
31356
  'positionSide/dual': 1,
31357
+ 'trade/closePosition': 1,
31357
31358
  },
31358
31359
  },
31359
31360
  },
@@ -33335,6 +33336,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33335
33336
  'SELL': 'sell',
33336
33337
  'SHORT': 'sell',
33337
33338
  'LONG': 'buy',
33339
+ 'ask': 'sell',
33340
+ 'bid': 'buy',
33338
33341
  };
33339
33342
  return this.safeString(sides, side, side);
33340
33343
  }
@@ -35082,14 +35085,45 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
35082
35085
  * @param {string} symbol Unified CCXT market symbol
35083
35086
  * @param {string} [side] not used by bingx
35084
35087
  * @param {object} [params] extra parameters specific to the bingx api endpoint
35088
+ * @param {string|undefined} [params.positionId] it is recommended to fill in this parameter when closing a position
35085
35089
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
35086
35090
  */
35087
35091
  await this.loadMarkets();
35088
- const market = this.market(symbol);
35089
- const request = {
35090
- 'symbol': market['id'],
35091
- };
35092
- const response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
35092
+ const positionId = this.safeString(params, 'positionId');
35093
+ params = this.omit(params, 'positionId');
35094
+ let response = undefined;
35095
+ if (positionId !== undefined) {
35096
+ const request = {
35097
+ 'positionId': positionId,
35098
+ };
35099
+ response = await this.swapV1PrivatePostTradeClosePosition(this.extend(request, params));
35100
+ }
35101
+ else {
35102
+ const market = this.market(symbol);
35103
+ const request = {
35104
+ 'symbol': market['id'],
35105
+ };
35106
+ response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
35107
+ }
35108
+ //
35109
+ // swapV1PrivatePostTradeClosePosition
35110
+ //
35111
+ // {
35112
+ // "code": 0,
35113
+ // "msg": "",
35114
+ // "timestamp": 1710992264190,
35115
+ // "data": {
35116
+ // "orderId": 1770656007907930112,
35117
+ // "positionId": "1751667128353910784",
35118
+ // "symbol": "LTC-USDT",
35119
+ // "side": "Ask",
35120
+ // "type": "MARKET",
35121
+ // "positionSide": "Long",
35122
+ // "origQty": "0.2"
35123
+ // }
35124
+ // }
35125
+ //
35126
+ // swapV2PrivatePostTradeCloseAllPositions
35093
35127
  //
35094
35128
  // {
35095
35129
  // "code": 0,
@@ -70180,16 +70214,18 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70180
70214
  'timestamp': undefined,
70181
70215
  'datetime': undefined,
70182
70216
  };
70183
- const codes = Object.keys(this.currencies);
70184
- for (let i = 0; i < codes.length; i++) {
70185
- const code = codes[i];
70186
- const currency = this.currency(code);
70187
- const currencyId = currency['id'];
70217
+ if (response === undefined) {
70218
+ response = [];
70219
+ }
70220
+ for (let i = 0; i < response.length; i++) {
70221
+ const currencyBalance = response[i];
70222
+ const currencyId = this.safeString(currencyBalance, 'currency');
70223
+ const currencyCode = this.safeCurrencyCode(currencyId);
70188
70224
  const account = this.account();
70189
- account['free'] = this.safeString(response, currencyId + '_available');
70190
- account['used'] = this.safeString(response, currencyId + '_reserved');
70191
- account['total'] = this.safeString(response, currencyId + '_balance');
70192
- result[code] = account;
70225
+ account['free'] = this.safeString(currencyBalance, 'available');
70226
+ account['used'] = this.safeString(currencyBalance, 'reserved');
70227
+ account['total'] = this.safeString(currencyBalance, 'total');
70228
+ result[currencyCode] = account;
70193
70229
  }
70194
70230
  return this.safeBalance(result);
70195
70231
  }
@@ -70203,24 +70239,17 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70203
70239
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
70204
70240
  */
70205
70241
  await this.loadMarkets();
70206
- const response = await this.privatePostBalance(params);
70242
+ const response = await this.privatePostAccountBalances(params);
70207
70243
  //
70208
- // {
70209
- // "aave_available": "0.00000000",
70210
- // "aave_balance": "0.00000000",
70211
- // "aave_reserved": "0.00000000",
70212
- // "aave_withdrawal_fee": "0.07000000",
70213
- // "aavebtc_fee": "0.000",
70214
- // "aaveeur_fee": "0.000",
70215
- // "aaveusd_fee": "0.000",
70216
- // "bat_available": "0.00000000",
70217
- // "bat_balance": "0.00000000",
70218
- // "bat_reserved": "0.00000000",
70219
- // "bat_withdrawal_fee": "5.00000000",
70220
- // "batbtc_fee": "0.000",
70221
- // "bateur_fee": "0.000",
70222
- // "batusd_fee": "0.000",
70223
- // }
70244
+ // [
70245
+ // {
70246
+ // "currency": "usdt",
70247
+ // "total": "7.00000",
70248
+ // "available": "7.00000",
70249
+ // "reserved": "0.00000"
70250
+ // },
70251
+ // ...
70252
+ // ]
70224
70253
  //
70225
70254
  return this.parseBalance(response);
70226
70255
  }
@@ -83586,6 +83615,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83586
83615
  'fetchUnderlyingAssets': false,
83587
83616
  'fetchVolatilityHistory': true,
83588
83617
  'fetchWithdrawals': true,
83618
+ 'fetchFundingHistory': true,
83589
83619
  'repayCrossMargin': true,
83590
83620
  'setLeverage': true,
83591
83621
  'setMarginMode': true,
@@ -91570,11 +91600,15 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
91570
91600
  const tier = info[i];
91571
91601
  const marketId = this.safeString(info, 'symbol');
91572
91602
  market = this.safeMarket(marketId);
91603
+ let minNotional = this.parseNumber('0');
91604
+ if (i !== 0) {
91605
+ minNotional = this.safeNumber(info[i - 1], 'riskLimitValue');
91606
+ }
91573
91607
  tiers.push({
91574
91608
  'tier': this.safeInteger(tier, 'id'),
91575
91609
  'currency': market['settle'],
91576
- 'minNotional': undefined,
91577
- 'maxNotional': undefined,
91610
+ 'minNotional': minNotional,
91611
+ 'maxNotional': this.safeNumber(tier, 'riskLimitValue'),
91578
91612
  'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
91579
91613
  'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
91580
91614
  'info': tier,
@@ -91582,6 +91616,106 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
91582
91616
  }
91583
91617
  return tiers;
91584
91618
  }
91619
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
91620
+ /**
91621
+ * @method
91622
+ * @name bybit#fetchFundingHistory
91623
+ * @description fetch the history of funding payments paid and received on this account
91624
+ * @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
91625
+ * @param {string} [symbol] unified market symbol
91626
+ * @param {int} [since] the earliest time in ms to fetch funding history for
91627
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
91628
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
91629
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
91630
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
91631
+ */
91632
+ await this.loadMarkets();
91633
+ let paginate = false;
91634
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
91635
+ if (paginate) {
91636
+ return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
91637
+ }
91638
+ let request = {
91639
+ 'execType': 'Funding',
91640
+ };
91641
+ let market = undefined;
91642
+ if (symbol !== undefined) {
91643
+ market = this.market(symbol);
91644
+ request['symbol'] = market['id'];
91645
+ }
91646
+ let type = undefined;
91647
+ [type, params] = this.getBybitType('fetchFundingHistory', market, params);
91648
+ request['category'] = type;
91649
+ if (symbol !== undefined) {
91650
+ request['symbol'] = market['id'];
91651
+ }
91652
+ if (since !== undefined) {
91653
+ request['startTime'] = since;
91654
+ }
91655
+ if (limit !== undefined) {
91656
+ request['size'] = limit;
91657
+ }
91658
+ else {
91659
+ request['size'] = 100;
91660
+ }
91661
+ [request, params] = this.handleUntilOption('endTime', request, params);
91662
+ const response = await this.privateGetV5ExecutionList(this.extend(request, params));
91663
+ const fundings = this.addPaginationCursorToResult(response);
91664
+ return this.parseIncomes(fundings, market, since, limit);
91665
+ }
91666
+ parseIncome(income, market = undefined) {
91667
+ //
91668
+ // {
91669
+ // "symbol": "XMRUSDT",
91670
+ // "orderType": "UNKNOWN",
91671
+ // "underlyingPrice": "",
91672
+ // "orderLinkId": "",
91673
+ // "orderId": "a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d",
91674
+ // "stopOrderType": "UNKNOWN",
91675
+ // "execTime": "1710950400000",
91676
+ // "feeCurrency": "",
91677
+ // "createType": "",
91678
+ // "feeRate": "-0.000761",
91679
+ // "tradeIv": "",
91680
+ // "blockTradeId": "",
91681
+ // "markPrice": "136.79",
91682
+ // "execPrice": "137.11",
91683
+ // "markIv": "",
91684
+ // "orderQty": "0",
91685
+ // "orderPrice": "0",
91686
+ // "execValue": "134.3678",
91687
+ // "closedSize": "0",
91688
+ // "execType": "Funding",
91689
+ // "seq": "28097658790",
91690
+ // "side": "Sell",
91691
+ // "indexPrice": "",
91692
+ // "leavesQty": "0",
91693
+ // "isMaker": false,
91694
+ // "execFee": "-0.10232512",
91695
+ // "execId": "8d1ef156-4ec6-4445-9a6c-1c0c24dbd046",
91696
+ // "marketUnit": "",
91697
+ // "execQty": "0.98",
91698
+ // "nextPageCursor": "5774437%3A0%2C5771289%3A0"
91699
+ // }
91700
+ //
91701
+ const marketId = this.safeString(income, 'symbol');
91702
+ market = this.safeMarket(marketId, market, undefined, 'contract');
91703
+ let code = 'USDT';
91704
+ if (market['inverse']) {
91705
+ code = market['quote'];
91706
+ }
91707
+ const timestamp = this.safeInteger(income, 'execTime');
91708
+ return {
91709
+ 'info': income,
91710
+ 'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
91711
+ 'code': code,
91712
+ 'timestamp': timestamp,
91713
+ 'datetime': this.iso8601(timestamp),
91714
+ 'id': this.safeString(income, 'execId'),
91715
+ 'amount': this.safeNumber(income, 'execQty'),
91716
+ 'rate': this.safeNumber(income, 'feeRate'),
91717
+ };
91718
+ }
91585
91719
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
91586
91720
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
91587
91721
  if (api === 'public') {
@@ -94524,7 +94658,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
94524
94658
  * @returns {object[]} an array of objects representing market data
94525
94659
  */
94526
94660
  const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
94527
- return await this[method](params);
94661
+ if (method === 'fetchMarketsV3') {
94662
+ return await this.fetchMarketsV3(params);
94663
+ }
94664
+ return await this.fetchMarketsV2(params);
94528
94665
  }
94529
94666
  async fetchMarketsV2(params = {}) {
94530
94667
  const response = await this.fetchCurrenciesFromCache(params);
@@ -94599,7 +94736,13 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
94599
94736
  return result;
94600
94737
  }
94601
94738
  async fetchMarketsV3(params = {}) {
94602
- const response = await this.v3PrivateGetBrokerageProducts(params);
94739
+ const promisesUnresolved = [
94740
+ this.v3PrivateGetBrokerageProducts(params),
94741
+ this.v3PrivateGetBrokerageTransactionSummary(params),
94742
+ ];
94743
+ // const response = await this.v3PrivateGetBrokerageProducts (params);
94744
+ const promises = await Promise.all(promisesUnresolved);
94745
+ const response = this.safeDict(promises, 0, {});
94603
94746
  //
94604
94747
  // [
94605
94748
  // {
@@ -94634,7 +94777,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
94634
94777
  // ...
94635
94778
  // ]
94636
94779
  //
94637
- const fees = await this.v3PrivateGetBrokerageTransactionSummary(params);
94780
+ // const fees = await this.v3PrivateGetBrokerageTransactionSummary (params);
94781
+ const fees = this.safeDict(promises, 1, {});
94638
94782
  //
94639
94783
  // {
94640
94784
  // "total_volume": 0,
@@ -95351,6 +95495,9 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
95351
95495
  const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
95352
95496
  const ledger = this.parseLedger(response['data'], currency, since, limit);
95353
95497
  const length = ledger.length;
95498
+ if (length === 0) {
95499
+ return ledger;
95500
+ }
95354
95501
  const lastIndex = length - 1;
95355
95502
  const last = this.safeDict(ledger, lastIndex);
95356
95503
  const pagination = this.safeDict(response, 'pagination', {});
@@ -95690,9 +95837,9 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
95690
95837
  'fee': fee,
95691
95838
  };
95692
95839
  }
95693
- async findAccountId(code) {
95840
+ async findAccountId(code, params = {}) {
95694
95841
  await this.loadMarkets();
95695
- await this.loadAccounts();
95842
+ await this.loadAccounts(false, params);
95696
95843
  for (let i = 0; i < this.accounts.length; i++) {
95697
95844
  const account = this.accounts[i];
95698
95845
  if (account['code'] === code) {
@@ -95721,7 +95868,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
95721
95868
  if (code === undefined) {
95722
95869
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
95723
95870
  }
95724
- accountId = await this.findAccountId(code);
95871
+ accountId = await this.findAccountId(code, params);
95725
95872
  if (accountId === undefined) {
95726
95873
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code);
95727
95874
  }
@@ -96865,7 +97012,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
96865
97012
  if (code === undefined) {
96866
97013
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
96867
97014
  }
96868
- accountId = await this.findAccountId(code);
97015
+ accountId = await this.findAccountId(code, params);
96869
97016
  if (accountId === undefined) {
96870
97017
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
96871
97018
  }
@@ -97090,7 +97237,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
97090
97237
  if (code === undefined) {
97091
97238
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
97092
97239
  }
97093
- accountId = await this.findAccountId(code);
97240
+ accountId = await this.findAccountId(code, params);
97094
97241
  if (accountId === undefined) {
97095
97242
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' deposit() could not find account id for ' + code);
97096
97243
  }
@@ -97160,7 +97307,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
97160
97307
  if (code === undefined) {
97161
97308
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
97162
97309
  }
97163
- accountId = await this.findAccountId(code);
97310
+ accountId = await this.findAccountId(code, params);
97164
97311
  if (accountId === undefined) {
97165
97312
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
97166
97313
  }
@@ -97459,10 +97606,10 @@ class coinbaseinternational extends _abstract_coinbaseinternational_js__WEBPACK_
97459
97606
  },
97460
97607
  'www': 'https://international.coinbase.com',
97461
97608
  'doc': [
97462
- 'https://docs.cloud.coinbaseinternational.com/intx/docs',
97609
+ 'https://docs.cloud.coinbase.com/intx/docs',
97463
97610
  ],
97464
97611
  'fees': [
97465
- 'https://help.coinbaseinternational.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
97612
+ 'https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
97466
97613
  ],
97467
97614
  'referral': '',
97468
97615
  },
@@ -135863,6 +136010,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
135863
136010
  'rebate': 'https://api.gateio.ws/api/v4',
135864
136011
  'earn': 'https://api.gateio.ws/api/v4',
135865
136012
  'account': 'https://api.gateio.ws/api/v4',
136013
+ 'loan': 'https://api.gateio.ws/api/v4',
135866
136014
  },
135867
136015
  },
135868
136016
  'test': {
@@ -136123,6 +136271,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
136123
136271
  'loan_records': 20 / 15,
136124
136272
  'interest_records': 20 / 15,
136125
136273
  'estimate_rate': 20 / 15,
136274
+ 'currency_discount_tiers': 20 / 15,
136126
136275
  },
136127
136276
  'post': {
136128
136277
  'account_mode': 20 / 15,
@@ -140043,7 +140192,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140043
140192
  'account': account,
140044
140193
  };
140045
140194
  if (amount !== undefined) {
140046
- request['amount'] = this.amountToPrecision(symbol, amount);
140195
+ const amountKey = (market['spot']) ? 'amount' : 'size';
140196
+ request[amountKey] = this.amountToPrecision(symbol, amount);
140047
140197
  }
140048
140198
  if (price !== undefined) {
140049
140199
  request['price'] = this.priceToPrecision(symbol, price);
@@ -153585,42 +153735,47 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153585
153735
  // 'from': parseInt ((since / 1000).toString ()), spot only
153586
153736
  // 'to': this.seconds (), spot only
153587
153737
  };
153588
- const price = this.safeString(params, 'price');
153589
- params = this.omit(params, 'price');
153738
+ const priceType = this.safeStringN(params, ['priceType', 'price']);
153739
+ params = this.omit(params, ['priceType', 'price']);
153740
+ let until = undefined;
153741
+ [until, params] = this.handleParamInteger(params, 'until');
153742
+ const untilSeconds = (until !== undefined) ? this.parseToInt(until / 1000) : undefined;
153590
153743
  if (market['contract']) {
153591
153744
  if (limit !== undefined) {
153592
- request['size'] = limit; // when using limit from and to are ignored
153745
+ request['size'] = limit; // when using limit: from & to are ignored
153593
153746
  // https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
153594
153747
  }
153595
153748
  else {
153596
153749
  limit = 2000; // only used for from/to calculation
153597
153750
  }
153598
- if (price === undefined) {
153751
+ if (priceType === undefined) {
153599
153752
  const duration = this.parseTimeframe(timeframe);
153753
+ let calcualtedEnd = undefined;
153600
153754
  if (since === undefined) {
153601
153755
  const now = this.seconds();
153602
153756
  request['from'] = now - duration * (limit - 1);
153603
- request['to'] = now;
153757
+ calcualtedEnd = now;
153604
153758
  }
153605
153759
  else {
153606
153760
  const start = this.parseToInt(since / 1000);
153607
153761
  request['from'] = start;
153608
- request['to'] = this.sum(start, duration * (limit - 1));
153762
+ calcualtedEnd = this.sum(start, duration * (limit - 1));
153609
153763
  }
153764
+ request['to'] = (untilSeconds !== undefined) ? untilSeconds : calcualtedEnd;
153610
153765
  }
153611
153766
  }
153612
153767
  let response = undefined;
153613
153768
  if (market['future']) {
153614
153769
  if (market['inverse']) {
153615
153770
  request['symbol'] = market['id'];
153616
- if (price === 'mark') {
153771
+ if (priceType === 'mark') {
153617
153772
  response = await this.contractPublicGetIndexMarketHistoryMarkPriceKline(this.extend(request, params));
153618
153773
  }
153619
- else if (price === 'index') {
153774
+ else if (priceType === 'index') {
153620
153775
  response = await this.contractPublicGetIndexMarketHistoryIndex(this.extend(request, params));
153621
153776
  }
153622
- else if (price === 'premiumIndex') {
153623
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
153777
+ else if (priceType === 'premiumIndex') {
153778
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
153624
153779
  }
153625
153780
  else {
153626
153781
  response = await this.contractPublicGetMarketHistoryKline(this.extend(request, params));
@@ -153628,13 +153783,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153628
153783
  }
153629
153784
  else if (market['linear']) {
153630
153785
  request['contract_code'] = market['id'];
153631
- if (price === 'mark') {
153786
+ if (priceType === 'mark') {
153632
153787
  response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
153633
153788
  }
153634
- else if (price === 'index') {
153635
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
153789
+ else if (priceType === 'index') {
153790
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
153636
153791
  }
153637
- else if (price === 'premiumIndex') {
153792
+ else if (priceType === 'premiumIndex') {
153638
153793
  response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
153639
153794
  }
153640
153795
  else {
@@ -153645,13 +153800,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153645
153800
  else if (market['swap']) {
153646
153801
  request['contract_code'] = market['id'];
153647
153802
  if (market['inverse']) {
153648
- if (price === 'mark') {
153803
+ if (priceType === 'mark') {
153649
153804
  response = await this.contractPublicGetIndexMarketHistorySwapMarkPriceKline(this.extend(request, params));
153650
153805
  }
153651
- else if (price === 'index') {
153652
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
153806
+ else if (priceType === 'index') {
153807
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
153653
153808
  }
153654
- else if (price === 'premiumIndex') {
153809
+ else if (priceType === 'premiumIndex') {
153655
153810
  response = await this.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(this.extend(request, params));
153656
153811
  }
153657
153812
  else {
@@ -153659,13 +153814,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153659
153814
  }
153660
153815
  }
153661
153816
  else if (market['linear']) {
153662
- if (price === 'mark') {
153817
+ if (priceType === 'mark') {
153663
153818
  response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
153664
153819
  }
153665
- else if (price === 'index') {
153666
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
153820
+ else if (priceType === 'index') {
153821
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + priceType + ' kline data');
153667
153822
  }
153668
- else if (price === 'premiumIndex') {
153823
+ else if (priceType === 'premiumIndex') {
153669
153824
  response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
153670
153825
  }
153671
153826
  else {
@@ -153678,18 +153833,22 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153678
153833
  let useHistorical = undefined;
153679
153834
  [useHistorical, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', true);
153680
153835
  if (!useHistorical) {
153681
- // `limit` only available for the this endpoint
153682
153836
  if (limit !== undefined) {
153683
- request['size'] = limit; // max 2000
153837
+ request['size'] = Math.min(2000, limit); // max 2000
153684
153838
  }
153685
153839
  response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
153686
153840
  }
153687
153841
  else {
153688
- // `since` only available for the this endpoint
153842
+ // "from & to" only available for the this endpoint
153689
153843
  if (since !== undefined) {
153690
- // default 150 bars
153691
153844
  request['from'] = this.parseToInt(since / 1000);
153692
153845
  }
153846
+ if (untilSeconds !== undefined) {
153847
+ request['to'] = untilSeconds;
153848
+ }
153849
+ if (limit !== undefined) {
153850
+ request['size'] = Math.min(1000, limit); // max 1000, otherwise default returns 150
153851
+ }
153693
153852
  response = await this.spotPublicGetMarketHistoryCandles(this.extend(request, params));
153694
153853
  }
153695
153854
  }
@@ -153705,7 +153864,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
153705
153864
  // ]
153706
153865
  // }
153707
153866
  //
153708
- const data = this.safeValue(response, 'data', []);
153867
+ const data = this.safeList(response, 'data', []);
153709
153868
  return this.parseOHLCVs(data, market, timeframe, since, limit);
153710
153869
  }
153711
153870
  async fetchAccounts(params = {}) {
@@ -162526,8 +162685,9 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162526
162685
  * @param {bool} [params.postOnly] true or false whether the order is post-only
162527
162686
  * @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
162528
162687
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
162529
- * @param {string} [params.clientOrderId] client order id, optional 128 bit hex string
162688
+ * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
162530
162689
  * @param {string} [params.slippage] the slippage for market order
162690
+ * @param {string} [params.vaultAddress] the vault address for order
162531
162691
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
162532
162692
  */
162533
162693
  await this.loadMarkets();
@@ -162577,7 +162737,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162577
162737
  }
162578
162738
  }
162579
162739
  }
162580
- params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice']);
162740
+ params = this.omit(params, ['slippage', 'clientOrderId', 'client_id', 'slippage', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'timeInForce']);
162581
162741
  const nonce = this.milliseconds();
162582
162742
  const orderReq = [];
162583
162743
  for (let i = 0; i < orders.length; i++) {
@@ -162704,7 +162864,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162704
162864
  * @param {string} id order id
162705
162865
  * @param {string} symbol unified symbol of the market the order was made in
162706
162866
  * @param {object} [params] extra parameters specific to the exchange API endpoint
162707
- * @param {string} [params.clientOrderId] client order id (default undefined)
162867
+ * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
162708
162868
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
162709
162869
  */
162710
162870
  return await this.cancelOrders([id], symbol, params);
@@ -162719,7 +162879,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162719
162879
  * @param {string[]} ids order ids
162720
162880
  * @param {string} [symbol] unified market symbol
162721
162881
  * @param {object} [params] extra parameters specific to the exchange API endpoint
162722
- * @param {string|string[]} [params.clientOrderId] client order ids (default undefined)
162882
+ * @param {string|string[]} [params.clientOrderId] client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
162723
162883
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
162724
162884
  */
162725
162885
  this.checkRequiredCredentials();
@@ -162802,6 +162962,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
162802
162962
  * @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
162803
162963
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
162804
162964
  * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
162965
+ * @param {string} [params.vaultAddress] the vault address for order
162805
162966
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
162806
162967
  */
162807
162968
  this.checkRequiredCredentials();
@@ -173923,6 +174084,56 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
173923
174084
  '130202': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
173924
174085
  '130203': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
173925
174086
  '130204': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
174087
+ '130301': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
174088
+ '130302': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
174089
+ '130303': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174090
+ '130304': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174091
+ '130305': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174092
+ '130306': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174093
+ '130307': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174094
+ '130308': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174095
+ '130309': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174096
+ '130310': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174097
+ '130311': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174098
+ '130312': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174099
+ '130313': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174100
+ '130314': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174101
+ '130315': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174102
+ '126000': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174103
+ '126001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174104
+ '126002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174105
+ '126003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174106
+ '126004': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174107
+ '126005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
174108
+ '126006': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174109
+ '126007': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174110
+ '126009': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174111
+ '126010': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174112
+ '126011': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174113
+ '126013': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
174114
+ '126015': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174115
+ '126021': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174116
+ '126022': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174117
+ '126027': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174118
+ '126028': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174119
+ '126029': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174120
+ '126030': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174121
+ '126033': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174122
+ '126034': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174123
+ '126036': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174124
+ '126037': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174125
+ '126038': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174126
+ '126039': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174127
+ '126041': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174128
+ '126042': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174129
+ '126043': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
174130
+ '126044': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
174131
+ '126045': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174132
+ '126046': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported,
174133
+ '126047': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
174134
+ '126048': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
174135
+ '135005': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
174136
+ '135018': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
173926
174137
  '200004': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
173927
174138
  '210014': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
173928
174139
  '210021': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
@@ -173944,10 +174155,12 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
173944
174155
  '400350': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
173945
174156
  '400370': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
173946
174157
  '400400': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
174158
+ '400401': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
173947
174159
  '400500': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
173948
174160
  '400600': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol,
173949
174161
  '400760': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
173950
174162
  '401000': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
174163
+ '408000': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
173951
174164
  '411100': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AccountSuspended,
173952
174165
  '415000': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
173953
174166
  '400303': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
@@ -201541,6 +201754,16 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
201541
201754
  '50026': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
201542
201755
  '50027': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.PermissionDenied,
201543
201756
  '50028': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
201757
+ '50029': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
201758
+ '50030': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.PermissionDenied,
201759
+ '50032': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AccountSuspended,
201760
+ '50033': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AccountSuspended,
201761
+ '50035': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
201762
+ '50036': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
201763
+ '50037': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
201764
+ '50038': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
201765
+ '50039': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
201766
+ '50041': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
201544
201767
  '50044': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
201545
201768
  // API Class
201546
201769
  '50100': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
@@ -201584,9 +201807,25 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
201584
201807
  '51024': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AccountSuspended,
201585
201808
  '51025': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
201586
201809
  '51026': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol,
201810
+ '51030': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201811
+ '51031': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201812
+ '51032': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201813
+ '51033': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201814
+ '51037': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201815
+ '51038': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201816
+ '51044': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201587
201817
  '51046': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201588
201818
  '51047': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201589
- '51031': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201819
+ '51048': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201820
+ '51049': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201821
+ '51050': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201822
+ '51051': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201823
+ '51052': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201824
+ '51053': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201825
+ '51054': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
201826
+ '51056': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201827
+ '51058': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201828
+ '51059': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201590
201829
  '51100': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201591
201830
  '51102': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
201592
201831
  '51103': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
@@ -204997,6 +205236,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
204997
205236
  '50027': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.PermissionDenied,
204998
205237
  '50028': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
204999
205238
  '50044': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
205239
+ '50061': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
205000
205240
  '50062': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
205001
205241
  // API Class
205002
205242
  '50100': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
@@ -205184,6 +205424,15 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
205184
205424
  // SPOT/MARGIN error codes 54000-54999
205185
205425
  '54000': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
205186
205426
  '54001': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
205427
+ // Trading bot Error Code from 55100 to 55999
205428
+ '55100': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205429
+ '55101': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205430
+ '55102': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205431
+ '55103': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205432
+ '55104': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205433
+ '55111': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205434
+ '55112': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205435
+ '55113': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
205187
205436
  // FUNDING error codes 58000-58999
205188
205437
  '58000': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
205189
205438
  '58001': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
@@ -209445,6 +209694,14 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
209445
209694
  '3': 'pending',
209446
209695
  '4': 'pending',
209447
209696
  '5': 'pending',
209697
+ '6': 'pending',
209698
+ '7': 'pending',
209699
+ '8': 'pending',
209700
+ '9': 'pending',
209701
+ '10': 'pending',
209702
+ '12': 'pending',
209703
+ '15': 'pending',
209704
+ '16': 'pending',
209448
209705
  };
209449
209706
  return this.safeString(statuses, status, status);
209450
209707
  }
@@ -225282,7 +225539,7 @@ class alpaca extends _alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225282
225539
  }
225283
225540
  this.watch(url, messageHash, request, messageHash, future);
225284
225541
  }
225285
- return future;
225542
+ return await future;
225286
225543
  }
225287
225544
  handleErrorMessage(client, message) {
225288
225545
  //
@@ -232371,7 +232628,7 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
232371
232628
  const message = this.extend(request, params);
232372
232629
  this.watch(url, messageHash, message, messageHash);
232373
232630
  }
232374
- return future;
232631
+ return await future;
232375
232632
  }
232376
232633
  handleAuthenticationMessage(client, message) {
232377
232634
  const messageHash = 'authenticated';
@@ -234285,7 +234542,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
234285
234542
  const message = this.extend(request, params);
234286
234543
  this.watch(url, messageHash, message, messageHash);
234287
234544
  }
234288
- return future;
234545
+ return await future;
234289
234546
  }
234290
234547
  async watchPrivate(messageHash, subscriptionHash, args, params = {}) {
234291
234548
  await this.authenticate();
@@ -235850,7 +236107,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
235850
236107
  const message = this.extend(request, params);
235851
236108
  this.watch(url, messageHash, message, messageHash);
235852
236109
  }
235853
- return future;
236110
+ return await future;
235854
236111
  }
235855
236112
  handleSubscriptionStatus(client, message) {
235856
236113
  //
@@ -236620,7 +236877,7 @@ class bitmex extends _bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
236620
236877
  const message = this.extend(request, params);
236621
236878
  this.watch(url, messageHash, message, messageHash);
236622
236879
  }
236623
- return future;
236880
+ return await future;
236624
236881
  }
236625
236882
  handleAuthenticationMessage(client, message) {
236626
236883
  const authenticated = this.safeBool(message, 'success', false);
@@ -241294,7 +241551,7 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
241294
241551
  };
241295
241552
  return this.watch(url, messageHash, this.extend(request, params), messageHash);
241296
241553
  }
241297
- return future;
241554
+ return await future;
241298
241555
  }
241299
241556
  }
241300
241557
 
@@ -242347,8 +242604,23 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
242347
242604
  for (let i = 0; i < rawPositions.length; i++) {
242348
242605
  const rawPosition = rawPositions[i];
242349
242606
  const position = this.parsePosition(rawPosition);
242607
+ const side = this.safeString(position, 'side');
242608
+ // hacky solution to handle closing positions
242609
+ // without crashing, we should handle this properly later
242350
242610
  newPositions.push(position);
242351
- cache.append(position);
242611
+ if (side === undefined || side === '') {
242612
+ // closing update, adding both sides to "reset" both sides
242613
+ // since we don't know which side is being closed
242614
+ position['side'] = 'long';
242615
+ cache.append(position);
242616
+ position['side'] = 'short';
242617
+ cache.append(position);
242618
+ position['side'] = undefined;
242619
+ }
242620
+ else {
242621
+ // regular update
242622
+ cache.append(position);
242623
+ }
242352
242624
  }
242353
242625
  const messageHashes = this.findMessageHashes(client, 'positions::');
242354
242626
  for (let i = 0; i < messageHashes.length; i++) {
@@ -243334,16 +243606,20 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243334
243606
  // {
243335
243607
  // "e": "history",
243336
243608
  // "data": [
243337
- // "sell:1665467367741:3888551:19058.8:14541219",
243338
- // "buy:1665467367741:1059339:19071.5:14541218",
243609
+ // 'buy:1710255706095:444444:71222.2:14892622'
243610
+ // 'sell:1710255658251:42530:71300:14892621'
243611
+ // 'buy:1710252424241:87913:72800:14892620'
243612
+ // ... timestamp descending
243339
243613
  // ]
243340
243614
  // }
243341
243615
  //
243342
- const data = this.safeValue(message, 'data', []);
243616
+ const data = this.safeList(message, 'data', []);
243343
243617
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
243344
243618
  const stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCache */ .ZL(limit);
243345
- for (let i = 0; i < data.length; i++) {
243346
- const rawTrade = data[i];
243619
+ const dataLength = data.length;
243620
+ for (let i = 0; i < dataLength; i++) {
243621
+ const index = dataLength - 1 - i;
243622
+ const rawTrade = data[index];
243347
243623
  const parsed = this.parseWsOldTrade(rawTrade);
243348
243624
  stored.append(parsed);
243349
243625
  }
@@ -249657,7 +249933,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
249657
249933
  const message = this.extend(request, params);
249658
249934
  this.watch(url, messageHash, message, messageHash);
249659
249935
  }
249660
- return future;
249936
+ return await future;
249661
249937
  }
249662
249938
  handlePing(client, message) {
249663
249939
  this.spawn(this.pong, client, message);
@@ -254307,7 +254583,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
254307
254583
  // }
254308
254584
  //
254309
254585
  }
254310
- return future;
254586
+ return await future;
254311
254587
  }
254312
254588
  async subscribePublic(name, messageHashPrefix, symbols = undefined, params = {}) {
254313
254589
  /**
@@ -258495,7 +258771,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
258495
258771
  };
258496
258772
  this.watch(url, messageHash, request, messageHash, subscription);
258497
258773
  }
258498
- return future;
258774
+ return await future;
258499
258775
  }
258500
258776
  }
258501
258777
 
@@ -269152,7 +269428,7 @@ class okcoin extends _okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
269152
269428
  };
269153
269429
  this.spawn(this.watch, url, messageHash, request, messageHash, future);
269154
269430
  }
269155
- return future;
269431
+ return await future;
269156
269432
  }
269157
269433
  async watchBalance(params = {}) {
269158
269434
  /**
@@ -272416,7 +272692,7 @@ class onetrading extends _onetrading_js__WEBPACK_IMPORTED_MODULE_0__/* ["default
272416
272692
  };
272417
272693
  this.watch(url, messageHash, this.extend(request, params), messageHash);
272418
272694
  }
272419
- return future;
272695
+ return await future;
272420
272696
  }
272421
272697
  }
272422
272698
 
@@ -279348,6 +279624,15 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279348
279624
  return await this.watch(url, messageHash, request, messageHash, subscribe);
279349
279625
  }
279350
279626
  async watchOrderBook(symbol, limit = undefined, params = {}) {
279627
+ /**
279628
+ * @method
279629
+ * @name woo#watchOrderBook
279630
+ * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
279631
+ * @param {string} symbol unified symbol of the market to fetch the order book for
279632
+ * @param {int} [limit] the maximum amount of order book entries to return.
279633
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279634
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
279635
+ */
279351
279636
  await this.loadMarkets();
279352
279637
  const name = 'orderbook';
279353
279638
  const market = this.market(symbol);
@@ -279397,9 +279682,18 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279397
279682
  client.resolve(orderbook, topic);
279398
279683
  }
279399
279684
  async watchTicker(symbol, params = {}) {
279685
+ /**
279686
+ * @method
279687
+ * @name woo#watchTicker
279688
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
279689
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
279690
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279691
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
279692
+ */
279400
279693
  await this.loadMarkets();
279401
279694
  const name = 'ticker';
279402
279695
  const market = this.market(symbol);
279696
+ symbol = market['symbol'];
279403
279697
  const topic = market['id'] + '@' + name;
279404
279698
  const request = {
279405
279699
  'event': 'subscribe',
@@ -279474,7 +279768,16 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279474
279768
  return message;
279475
279769
  }
279476
279770
  async watchTickers(symbols = undefined, params = {}) {
279771
+ /**
279772
+ * @method
279773
+ * @name woo#watchTickers
279774
+ * @description n watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
279775
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
279776
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279777
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
279778
+ */
279477
279779
  await this.loadMarkets();
279780
+ symbols = this.marketSymbols(symbols);
279478
279781
  const name = 'tickers';
279479
279782
  const topic = name;
279480
279783
  const request = {
@@ -279593,8 +279896,19 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279593
279896
  client.resolve(stored, topic);
279594
279897
  }
279595
279898
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
279899
+ /**
279900
+ * @method
279901
+ * @name woo#watchTrades
279902
+ * @description watches information on multiple trades made in a market
279903
+ * @param {string} symbol unified market symbol of the market trades were made in
279904
+ * @param {int} [since] the earliest time in ms to fetch trades for
279905
+ * @param {int} [limit] the maximum number of trade structures to retrieve
279906
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279907
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
279908
+ */
279596
279909
  await this.loadMarkets();
279597
279910
  const market = this.market(symbol);
279911
+ symbol = market['symbol'];
279598
279912
  const topic = market['id'] + '@trade';
279599
279913
  const request = {
279600
279914
  'event': 'subscribe',
@@ -308873,7 +309187,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
308873
309187
  'fetchBalance': true,
308874
309188
  'fetchCanceledOrders': false,
308875
309189
  'fetchClosedOrder': false,
308876
- 'fetchClosedOrders': false,
309190
+ 'fetchClosedOrders': true,
308877
309191
  'fetchCurrencies': true,
308878
309192
  'fetchDepositAddress': true,
308879
309193
  'fetchDeposits': true,
@@ -308892,7 +309206,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
308892
309206
  'fetchOHLCV': true,
308893
309207
  'fetchOpenInterestHistory': false,
308894
309208
  'fetchOpenOrder': false,
308895
- 'fetchOpenOrders': false,
309209
+ 'fetchOpenOrders': true,
308896
309210
  'fetchOrder': true,
308897
309211
  'fetchOrderBook': true,
308898
309212
  'fetchOrders': true,
@@ -310262,7 +310576,51 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
310262
310576
  //
310263
310577
  const data = this.safeValue(response, 'data', response);
310264
310578
  const orders = this.safeList(data, 'rows');
310265
- return this.parseOrders(orders, market, since, limit, params);
310579
+ return this.parseOrders(orders, market, since, limit);
310580
+ }
310581
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
310582
+ /**
310583
+ * @method
310584
+ * @name woo#fetchOpenOrders
310585
+ * @description fetches information on multiple orders made by the user
310586
+ * @see https://docs.woo.org/#get-orders
310587
+ * @see https://docs.woo.org/#get-algo-orders
310588
+ * @param {string} symbol unified market symbol of the market orders were made in
310589
+ * @param {int} [since] the earliest time in ms to fetch orders for
310590
+ * @param {int} [limit] the maximum number of order structures to retrieve
310591
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
310592
+ * @param {boolean} [params.stop] whether the order is a stop/algo order
310593
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
310594
+ * @param {string} [params.side] 'buy' or 'sell'
310595
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
310596
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
310597
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
310598
+ */
310599
+ await this.loadMarkets();
310600
+ const extendedParams = this.extend(params, { 'status': 'INCOMPLETE' });
310601
+ return await this.fetchOrders(symbol, since, limit, extendedParams);
310602
+ }
310603
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
310604
+ /**
310605
+ * @method
310606
+ * @name woo#fetchClosedOrders
310607
+ * @description fetches information on multiple orders made by the user
310608
+ * @see https://docs.woo.org/#get-orders
310609
+ * @see https://docs.woo.org/#get-algo-orders
310610
+ * @param {string} symbol unified market symbol of the market orders were made in
310611
+ * @param {int} [since] the earliest time in ms to fetch orders for
310612
+ * @param {int} [limit] the maximum number of order structures to retrieve
310613
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
310614
+ * @param {boolean} [params.stop] whether the order is a stop/algo order
310615
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
310616
+ * @param {string} [params.side] 'buy' or 'sell'
310617
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
310618
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
310619
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
310620
+ */
310621
+ await this.loadMarkets();
310622
+ const extendedParams = this.extend(params, { 'status': 'COMPLETED' });
310623
+ return await this.fetchOrders(symbol, since, limit, extendedParams);
310266
310624
  }
310267
310625
  parseTimeInForce(timeInForce) {
310268
310626
  const timeInForces = {
@@ -321921,7 +322279,7 @@ SOFTWARE.
321921
322279
 
321922
322280
  //-----------------------------------------------------------------------------
321923
322281
  // this is updated by vss.js when building
321924
- const version = '4.2.77';
322282
+ const version = '4.2.79';
321925
322283
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
321926
322284
  //-----------------------------------------------------------------------------
321927
322285