ccxt 4.4.7 → 4.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.4.7';
197
+ const version = '4.4.8';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -1091,6 +1091,7 @@ class binance extends binance$1 {
1091
1091
  'repay-futures-negative-balance': 150,
1092
1092
  'listenKey': 1,
1093
1093
  'asset-collection': 3,
1094
+ 'margin/repay-debt': 0.4, // Weight(Order): 0.4 => (1000 / (50 * 0.4)) * 60 = 3000
1094
1095
  },
1095
1096
  'put': {
1096
1097
  'listenKey': 1, // 1
@@ -1208,6 +1209,7 @@ class binance extends binance$1 {
1208
1209
  ],
1209
1210
  'fetchCurrencies': true,
1210
1211
  // 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades, eapiPublicGetTrades
1212
+ // 'repayCrossMarginMethod': 'papiPostRepayLoan', // papiPostMarginRepayDebt
1211
1213
  'defaultTimeInForce': 'GTC',
1212
1214
  'defaultType': 'spot',
1213
1215
  'defaultSubType': undefined,
@@ -2904,7 +2906,7 @@ class binance extends binance$1 {
2904
2906
  const res = this.safeValue(results, i);
2905
2907
  if (fetchMargins && Array.isArray(res)) {
2906
2908
  const keysList = Object.keys(this.indexBy(res, 'symbol'));
2907
- const length = (Object.keys(this.options['crossMarginPairsData'])).length;
2909
+ const length = this.options['crossMarginPairsData'].length;
2908
2910
  // first one is the cross-margin promise
2909
2911
  if (length === 0) {
2910
2912
  this.options['crossMarginPairsData'] = keysList;
@@ -12217,10 +12219,13 @@ class binance extends binance$1 {
12217
12219
  * @description repay borrowed margin and interest
12218
12220
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay
12219
12221
  * @see https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay
12222
+ * @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay-Debt
12220
12223
  * @param {string} code unified currency code of the currency to repay
12221
12224
  * @param {float} amount the amount to repay
12222
12225
  * @param {object} [params] extra parameters specific to the exchange API endpoint
12223
12226
  * @param {boolean} [params.portfolioMargin] set to true if you would like to repay margin in a portfolio margin account
12227
+ * @param {string} [params.repayCrossMarginMethod] *portfolio margin only* 'papiPostRepayLoan' (default), 'papiPostMarginRepayDebt' (alternative)
12228
+ * @param {string} [params.specifyRepayAssets] *portfolio margin papiPostMarginRepayDebt only* specific asset list to repay debt
12224
12229
  * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
12225
12230
  */
12226
12231
  await this.loadMarkets();
@@ -12233,19 +12238,41 @@ class binance extends binance$1 {
12233
12238
  let isPortfolioMargin = undefined;
12234
12239
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'repayCrossMargin', 'papi', 'portfolioMargin', false);
12235
12240
  if (isPortfolioMargin) {
12236
- response = await this.papiPostRepayLoan(this.extend(request, params));
12241
+ let method = undefined;
12242
+ [method, params] = this.handleOptionAndParams2(params, 'repayCrossMargin', 'repayCrossMarginMethod', 'method');
12243
+ if (method === 'papiPostMarginRepayDebt') {
12244
+ response = await this.papiPostMarginRepayDebt(this.extend(request, params));
12245
+ //
12246
+ // {
12247
+ // "asset": "USDC",
12248
+ // "amount": 10,
12249
+ // "specifyRepayAssets": null,
12250
+ // "updateTime": 1727170761267,
12251
+ // "success": true
12252
+ // }
12253
+ //
12254
+ }
12255
+ else {
12256
+ response = await this.papiPostRepayLoan(this.extend(request, params));
12257
+ //
12258
+ // {
12259
+ // "tranId": 108988250265,
12260
+ // "clientTag":""
12261
+ // }
12262
+ //
12263
+ }
12237
12264
  }
12238
12265
  else {
12239
12266
  request['isIsolated'] = 'FALSE';
12240
12267
  request['type'] = 'REPAY';
12241
12268
  response = await this.sapiPostMarginBorrowRepay(this.extend(request, params));
12269
+ //
12270
+ // {
12271
+ // "tranId": 108988250265,
12272
+ // "clientTag":""
12273
+ // }
12274
+ //
12242
12275
  }
12243
- //
12244
- // {
12245
- // "tranId": 108988250265,
12246
- // "clientTag":""
12247
- // }
12248
- //
12249
12276
  return this.parseMarginLoan(response, currency);
12250
12277
  }
12251
12278
  async repayIsolatedMargin(symbol, code, amount, params = {}) {
@@ -12355,13 +12382,25 @@ class binance extends binance$1 {
12355
12382
  // "clientTag":""
12356
12383
  // }
12357
12384
  //
12385
+ // repayCrossMargin alternative endpoint
12386
+ //
12387
+ // {
12388
+ // "asset": "USDC",
12389
+ // "amount": 10,
12390
+ // "specifyRepayAssets": null,
12391
+ // "updateTime": 1727170761267,
12392
+ // "success": true
12393
+ // }
12394
+ //
12395
+ const currencyId = this.safeString(info, 'asset');
12396
+ const timestamp = this.safeInteger(info, 'updateTime');
12358
12397
  return {
12359
12398
  'id': this.safeInteger(info, 'tranId'),
12360
- 'currency': this.safeCurrencyCode(undefined, currency),
12361
- 'amount': undefined,
12399
+ 'currency': this.safeCurrencyCode(currencyId, currency),
12400
+ 'amount': this.safeNumber(info, 'amount'),
12362
12401
  'symbol': undefined,
12363
- 'timestamp': undefined,
12364
- 'datetime': undefined,
12402
+ 'timestamp': timestamp,
12403
+ 'datetime': this.iso8601(timestamp),
12365
12404
  'info': info,
12366
12405
  };
12367
12406
  }
@@ -40,6 +40,7 @@ class bybit extends bybit$1 {
40
40
  'cancelOrdersForSymbols': true,
41
41
  'closeAllPositions': false,
42
42
  'closePosition': false,
43
+ 'createConvertTrade': true,
43
44
  'createMarketBuyOrderWithCost': true,
44
45
  'createMarketSellOrderWithCost': true,
45
46
  'createOrder': true,
@@ -63,6 +64,10 @@ class bybit extends bybit$1 {
63
64
  'fetchCanceledOrders': true,
64
65
  'fetchClosedOrder': true,
65
66
  'fetchClosedOrders': true,
67
+ 'fetchConvertCurrencies': true,
68
+ 'fetchConvertQuote': true,
69
+ 'fetchConvertTrade': true,
70
+ 'fetchConvertTradeHistory': true,
66
71
  'fetchCrossBorrowRate': true,
67
72
  'fetchCrossBorrowRates': false,
68
73
  'fetchCurrencies': true,
@@ -329,6 +334,9 @@ class bybit extends bybit$1 {
329
334
  'v5/account/smp-group': 1,
330
335
  'v5/account/mmp-state': 5,
331
336
  // asset
337
+ 'v5/asset/exchange/query-coin-list': 0.5,
338
+ 'v5/asset/exchange/convert-result-query': 0.5,
339
+ 'v5/asset/exchange/query-convert-history': 0.5,
332
340
  'v5/asset/exchange/order-record': 5,
333
341
  'v5/asset/delivery-record': 5,
334
342
  'v5/asset/settlement-record': 5,
@@ -487,6 +495,8 @@ class bybit extends bybit$1 {
487
495
  'v5/account/mmp-modify': 5,
488
496
  'v5/account/mmp-reset': 5,
489
497
  // asset
498
+ 'v5/asset/exchange/quote-apply': 1,
499
+ 'v5/asset/exchange/convert-execute': 1,
490
500
  'v5/asset/transfer/inter-transfer': 50,
491
501
  'v5/asset/transfer/save-transfer-sub-member': 150,
492
502
  'v5/asset/transfer/universal-transfer': 10,
@@ -8868,6 +8878,359 @@ class bybit extends bybit$1 {
8868
8878
  const positions = this.parsePositions(rawPositions, symbols, params);
8869
8879
  return this.filterBySinceLimit(positions, since, limit);
8870
8880
  }
8881
+ async fetchConvertCurrencies(params = {}) {
8882
+ /**
8883
+ * @method
8884
+ * @name bybit#fetchConvertCurrencies
8885
+ * @description fetches all available currencies that can be converted
8886
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list
8887
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8888
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8889
+ * @returns {object} an associative dictionary of currencies
8890
+ */
8891
+ await this.loadMarkets();
8892
+ let accountType = undefined;
8893
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
8894
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
8895
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
8896
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertCurrencies', 'accountType', accountTypeDefault);
8897
+ const request = {
8898
+ 'accountType': accountType,
8899
+ };
8900
+ const response = await this.privateGetV5AssetExchangeQueryCoinList(this.extend(request, params));
8901
+ //
8902
+ // {
8903
+ // "retCode": 0,
8904
+ // "retMsg": "ok",
8905
+ // "result": {
8906
+ // "coins": [
8907
+ // {
8908
+ // "coin": "MATIC",
8909
+ // "fullName": "MATIC",
8910
+ // "icon": "https://s1.bycsi.com/app/assets/token/0552ae79c535c3095fa18f7b377dd2e9.svg",
8911
+ // "iconNight": "https://t1.bycsi.com/app/assets/token/f59301aef2d6ac2165c4c4603e672fb4.svg",
8912
+ // "accuracyLength": 8,
8913
+ // "coinType": "crypto",
8914
+ // "balance": "0",
8915
+ // "uBalance": "0",
8916
+ // "timePeriod": 0,
8917
+ // "singleFromMinLimit": "1.1",
8918
+ // "singleFromMaxLimit": "20001",
8919
+ // "singleToMinLimit": "0",
8920
+ // "singleToMaxLimit": "0",
8921
+ // "dailyFromMinLimit": "0",
8922
+ // "dailyFromMaxLimit": "0",
8923
+ // "dailyToMinLimit": "0",
8924
+ // "dailyToMaxLimit": "0",
8925
+ // "disableFrom": false,
8926
+ // "disableTo": false
8927
+ // },
8928
+ // ]
8929
+ // },
8930
+ // "retExtInfo": {},
8931
+ // "time": 1727256416250
8932
+ // }
8933
+ //
8934
+ const result = {};
8935
+ const data = this.safeDict(response, 'result', {});
8936
+ const coins = this.safeList(data, 'coins', []);
8937
+ for (let i = 0; i < coins.length; i++) {
8938
+ const entry = coins[i];
8939
+ const id = this.safeString(entry, 'coin');
8940
+ const disableFrom = this.safeBool(entry, 'disableFrom');
8941
+ const disableTo = this.safeBool(entry, 'disableTo');
8942
+ const inactive = (disableFrom || disableTo);
8943
+ const code = this.safeCurrencyCode(id);
8944
+ result[code] = {
8945
+ 'info': entry,
8946
+ 'id': id,
8947
+ 'code': code,
8948
+ 'networks': undefined,
8949
+ 'type': this.safeString(entry, 'coinType'),
8950
+ 'name': this.safeString(entry, 'fullName'),
8951
+ 'active': !inactive,
8952
+ 'deposit': undefined,
8953
+ 'withdraw': this.safeNumber(entry, 'balance'),
8954
+ 'fee': undefined,
8955
+ 'precision': undefined,
8956
+ 'limits': {
8957
+ 'amount': {
8958
+ 'min': this.safeNumber(entry, 'singleFromMinLimit'),
8959
+ 'max': this.safeNumber(entry, 'singleFromMaxLimit'),
8960
+ },
8961
+ 'withdraw': {
8962
+ 'min': undefined,
8963
+ 'max': undefined,
8964
+ },
8965
+ 'deposit': {
8966
+ 'min': undefined,
8967
+ 'max': undefined,
8968
+ },
8969
+ },
8970
+ 'created': undefined,
8971
+ };
8972
+ }
8973
+ return result;
8974
+ }
8975
+ async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
8976
+ /**
8977
+ * @method
8978
+ * @name bybit#fetchConvertQuote
8979
+ * @description fetch a quote for converting from one currency to another
8980
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote
8981
+ * @param {string} fromCode the currency that you want to sell and convert from
8982
+ * @param {string} toCode the currency that you want to buy and convert into
8983
+ * @param {float} [amount] how much you want to trade in units of the from currency
8984
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8985
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8986
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
8987
+ */
8988
+ await this.loadMarkets();
8989
+ let accountType = undefined;
8990
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
8991
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
8992
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
8993
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertQuote', 'accountType', accountTypeDefault);
8994
+ const request = {
8995
+ 'fromCoin': fromCode,
8996
+ 'toCoin': toCode,
8997
+ 'requestAmount': this.numberToString(amount),
8998
+ 'requestCoin': fromCode,
8999
+ 'accountType': accountType,
9000
+ };
9001
+ const response = await this.privatePostV5AssetExchangeQuoteApply(this.extend(request, params));
9002
+ //
9003
+ // {
9004
+ // "retCode": 0,
9005
+ // "retMsg": "ok",
9006
+ // "result": {
9007
+ // "quoteTxId": "1010020692439481682687668224",
9008
+ // "exchangeRate": "0.000015330836780000",
9009
+ // "fromCoin": "USDT",
9010
+ // "fromCoinType": "crypto",
9011
+ // "toCoin": "BTC",
9012
+ // "toCoinType": "crypto",
9013
+ // "fromAmount": "10",
9014
+ // "toAmount": "0.000153308367800000",
9015
+ // "expiredTime": "1727257413353",
9016
+ // "requestId": ""
9017
+ // },
9018
+ // "retExtInfo": {},
9019
+ // "time": 1727257398375
9020
+ // }
9021
+ //
9022
+ const data = this.safeDict(response, 'result', {});
9023
+ const fromCurrencyId = this.safeString(data, 'fromCoin', fromCode);
9024
+ const fromCurrency = this.currency(fromCurrencyId);
9025
+ const toCurrencyId = this.safeString(data, 'toCoin', toCode);
9026
+ const toCurrency = this.currency(toCurrencyId);
9027
+ return this.parseConversion(data, fromCurrency, toCurrency);
9028
+ }
9029
+ async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
9030
+ /**
9031
+ * @method
9032
+ * @name bybit#createConvertTrade
9033
+ * @description convert from one currency to another
9034
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote
9035
+ * @param {string} id the id of the trade that you want to make
9036
+ * @param {string} fromCode the currency that you want to sell and convert from
9037
+ * @param {string} toCode the currency that you want to buy and convert into
9038
+ * @param {float} amount how much you want to trade in units of the from currency
9039
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9040
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9041
+ */
9042
+ await this.loadMarkets();
9043
+ const request = {
9044
+ 'quoteTxId': id,
9045
+ };
9046
+ const response = await this.privatePostV5AssetExchangeConvertExecute(this.extend(request, params));
9047
+ //
9048
+ // {
9049
+ // "retCode": 0,
9050
+ // "retMsg": "ok",
9051
+ // "result": {
9052
+ // "exchangeStatus": "processing",
9053
+ // "quoteTxId": "1010020692439483803499737088"
9054
+ // },
9055
+ // "retExtInfo": {},
9056
+ // "time": 1727257904969
9057
+ // }
9058
+ //
9059
+ const data = this.safeDict(response, 'result', {});
9060
+ return this.parseConversion(data);
9061
+ }
9062
+ async fetchConvertTrade(id, code = undefined, params = {}) {
9063
+ /**
9064
+ * @method
9065
+ * @name bybit#fetchConvertTrade
9066
+ * @description fetch the data for a conversion trade
9067
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result
9068
+ * @param {string} id the id of the trade that you want to fetch
9069
+ * @param {string} [code] the unified currency code of the conversion trade
9070
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9071
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
9072
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9073
+ */
9074
+ await this.loadMarkets();
9075
+ let accountType = undefined;
9076
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
9077
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
9078
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
9079
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertQuote', 'accountType', accountTypeDefault);
9080
+ const request = {
9081
+ 'quoteTxId': id,
9082
+ 'accountType': accountType,
9083
+ };
9084
+ const response = await this.privateGetV5AssetExchangeConvertResultQuery(this.extend(request, params));
9085
+ //
9086
+ // {
9087
+ // "retCode": 0,
9088
+ // "retMsg": "ok",
9089
+ // "result": {
9090
+ // "result": {
9091
+ // "accountType": "eb_convert_uta",
9092
+ // "exchangeTxId": "1010020692439483803499737088",
9093
+ // "userId": "100406395",
9094
+ // "fromCoin": "USDT",
9095
+ // "fromCoinType": "crypto",
9096
+ // "fromAmount": "10",
9097
+ // "toCoin": "BTC",
9098
+ // "toCoinType": "crypto",
9099
+ // "toAmount": "0.00015344889",
9100
+ // "exchangeStatus": "success",
9101
+ // "extInfo": {},
9102
+ // "convertRate": "0.000015344889",
9103
+ // "createdAt": "1727257904726"
9104
+ // }
9105
+ // },
9106
+ // "retExtInfo": {},
9107
+ // "time": 1727258257216
9108
+ // }
9109
+ //
9110
+ const data = this.safeDict(response, 'result', {});
9111
+ const result = this.safeDict(data, 'result', {});
9112
+ const fromCurrencyId = this.safeString(result, 'fromCoin');
9113
+ const toCurrencyId = this.safeString(result, 'toCoin');
9114
+ let fromCurrency = undefined;
9115
+ let toCurrency = undefined;
9116
+ if (fromCurrencyId !== undefined) {
9117
+ fromCurrency = this.currency(fromCurrencyId);
9118
+ }
9119
+ if (toCurrencyId !== undefined) {
9120
+ toCurrency = this.currency(toCurrencyId);
9121
+ }
9122
+ return this.parseConversion(result, fromCurrency, toCurrency);
9123
+ }
9124
+ async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
9125
+ /**
9126
+ * @method
9127
+ * @name bybit#fetchConvertTradeHistory
9128
+ * @description fetch the users history of conversion trades
9129
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history
9130
+ * @param {string} [code] the unified currency code
9131
+ * @param {int} [since] the earliest time in ms to fetch conversions for
9132
+ * @param {int} [limit] the maximum number of conversion structures to retrieve
9133
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9134
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
9135
+ * @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9136
+ */
9137
+ await this.loadMarkets();
9138
+ const request = {};
9139
+ if (limit !== undefined) {
9140
+ request['limit'] = limit;
9141
+ }
9142
+ const response = await this.privateGetV5AssetExchangeQueryConvertHistory(this.extend(request, params));
9143
+ //
9144
+ // {
9145
+ // "retCode": 0,
9146
+ // "retMsg": "ok",
9147
+ // "result": {
9148
+ // "list": [
9149
+ // {
9150
+ // "accountType": "eb_convert_uta",
9151
+ // "exchangeTxId": "1010020692439483803499737088",
9152
+ // "userId": "100406395",
9153
+ // "fromCoin": "USDT",
9154
+ // "fromCoinType": "crypto",
9155
+ // "fromAmount": "10",
9156
+ // "toCoin": "BTC",
9157
+ // "toCoinType": "crypto",
9158
+ // "toAmount": "0.00015344889",
9159
+ // "exchangeStatus": "success",
9160
+ // "extInfo": {},
9161
+ // "convertRate": "0.000015344889",
9162
+ // "createdAt": "1727257904726"
9163
+ // }
9164
+ // ]
9165
+ // },
9166
+ // "retExtInfo": {},
9167
+ // "time": 1727258761874
9168
+ // }
9169
+ //
9170
+ const data = this.safeDict(response, 'result', {});
9171
+ const dataList = this.safeList(data, 'list', []);
9172
+ return this.parseConversions(dataList, code, 'fromCoin', 'toCoin', since, limit);
9173
+ }
9174
+ parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
9175
+ //
9176
+ // fetchConvertQuote
9177
+ //
9178
+ // {
9179
+ // "quoteTxId": "1010020692439481682687668224",
9180
+ // "exchangeRate": "0.000015330836780000",
9181
+ // "fromCoin": "USDT",
9182
+ // "fromCoinType": "crypto",
9183
+ // "toCoin": "BTC",
9184
+ // "toCoinType": "crypto",
9185
+ // "fromAmount": "10",
9186
+ // "toAmount": "0.000153308367800000",
9187
+ // "expiredTime": "1727257413353",
9188
+ // "requestId": ""
9189
+ // }
9190
+ //
9191
+ // createConvertTrade
9192
+ //
9193
+ // {
9194
+ // "exchangeStatus": "processing",
9195
+ // "quoteTxId": "1010020692439483803499737088"
9196
+ // }
9197
+ //
9198
+ // fetchConvertTrade, fetchConvertTradeHistory
9199
+ //
9200
+ // {
9201
+ // "accountType": "eb_convert_uta",
9202
+ // "exchangeTxId": "1010020692439483803499737088",
9203
+ // "userId": "100406395",
9204
+ // "fromCoin": "USDT",
9205
+ // "fromCoinType": "crypto",
9206
+ // "fromAmount": "10",
9207
+ // "toCoin": "BTC",
9208
+ // "toCoinType": "crypto",
9209
+ // "toAmount": "0.00015344889",
9210
+ // "exchangeStatus": "success",
9211
+ // "extInfo": {},
9212
+ // "convertRate": "0.000015344889",
9213
+ // "createdAt": "1727257904726"
9214
+ // }
9215
+ //
9216
+ const timestamp = this.safeInteger2(conversion, 'expiredTime', 'createdAt');
9217
+ const fromCoin = this.safeString(conversion, 'fromCoin');
9218
+ const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
9219
+ const to = this.safeString(conversion, 'toCoin');
9220
+ const toCode = this.safeCurrencyCode(to, toCurrency);
9221
+ return {
9222
+ 'info': conversion,
9223
+ 'timestamp': timestamp,
9224
+ 'datetime': this.iso8601(timestamp),
9225
+ 'id': this.safeString2(conversion, 'quoteTxId', 'exchangeTxId'),
9226
+ 'fromCurrency': fromCode,
9227
+ 'fromAmount': this.safeNumber(conversion, 'fromAmount'),
9228
+ 'toCurrency': toCode,
9229
+ 'toAmount': this.safeNumber(conversion, 'toAmount'),
9230
+ 'price': undefined,
9231
+ 'fee': undefined,
9232
+ };
9233
+ }
8871
9234
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
8872
9235
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
8873
9236
  if (api === 'public') {
@@ -2078,6 +2078,10 @@ class htx extends htx$1 {
2078
2078
  * @method
2079
2079
  * @name htx#fetchTicker
2080
2080
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
2081
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-latest-aggregated-ticker
2082
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#get-market-data-overview
2083
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-data-overview
2084
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-data-overview
2081
2085
  * @param {string} symbol unified symbol of the market to fetch the ticker for
2082
2086
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2083
2087
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -2398,6 +2402,10 @@ class htx extends htx$1 {
2398
2402
  * @method
2399
2403
  * @name htx#fetchOrderBook
2400
2404
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
2405
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-market-depth
2406
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#get-market-depth
2407
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-depth
2408
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-depth
2401
2409
  * @param {string} symbol unified symbol of the market to fetch the order book for
2402
2410
  * @param {int} [limit] the maximum amount of order book entries to return
2403
2411
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2627,6 +2635,7 @@ class htx extends htx$1 {
2627
2635
  * @method
2628
2636
  * @name htx#fetchOrderTrades
2629
2637
  * @description fetch all the trades made from a single order
2638
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order
2630
2639
  * @param {string} id order id
2631
2640
  * @param {string} symbol unified market symbol
2632
2641
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -2646,6 +2655,19 @@ class htx extends htx$1 {
2646
2655
  return await this.fetchSpotOrderTrades(id, symbol, since, limit, params);
2647
2656
  }
2648
2657
  async fetchSpotOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2658
+ /**
2659
+ * @ignore
2660
+ * @method
2661
+ * @name htx#fetchOrderTrades
2662
+ * @description fetch all the trades made from a single order
2663
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order
2664
+ * @param {string} id order id
2665
+ * @param {string} symbol unified market symbol
2666
+ * @param {int} [since] the earliest time in ms to fetch trades for
2667
+ * @param {int} [limit] the maximum number of trades to retrieve
2668
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2669
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2670
+ */
2649
2671
  await this.loadMarkets();
2650
2672
  const request = {
2651
2673
  'order-id': id,
@@ -266,6 +266,7 @@ class okx extends okx$1 {
266
266
  'copytrading/public-preference-currency': 4,
267
267
  'copytrading/public-current-subpositions': 4,
268
268
  'copytrading/public-subpositions-history': 4,
269
+ 'support/announcements-types': 20,
269
270
  },
270
271
  },
271
272
  'private': {
@@ -411,6 +412,7 @@ class okx extends okx$1 {
411
412
  // affiliate
412
413
  'affiliate/invitee/detail': 1,
413
414
  'users/partner/if-rebate': 1,
415
+ 'support/announcements': 4,
414
416
  },
415
417
  'post': {
416
418
  // rfq
@@ -790,6 +792,8 @@ class okx extends okx$1 {
790
792
  // SPOT/MARGIN error codes 54000-54999
791
793
  '54000': errors.ExchangeError,
792
794
  '54001': errors.ExchangeError,
795
+ '54008': errors.InvalidOrder,
796
+ '54009': errors.InvalidOrder,
793
797
  '54011': errors.InvalidOrder,
794
798
  // Trading bot Error Code from 55100 to 55999
795
799
  '55100': errors.InvalidOrder,