ccxt 4.4.6 → 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.
Files changed (55) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +21 -2
  5. package/dist/cjs/src/binance.js +51 -12
  6. package/dist/cjs/src/bingx.js +3 -0
  7. package/dist/cjs/src/bitget.js +10 -6
  8. package/dist/cjs/src/bitmart.js +124 -1
  9. package/dist/cjs/src/bybit.js +377 -10
  10. package/dist/cjs/src/gate.js +3 -0
  11. package/dist/cjs/src/htx.js +22 -0
  12. package/dist/cjs/src/kucoin.js +2 -2
  13. package/dist/cjs/src/mexc.js +97 -13
  14. package/dist/cjs/src/okx.js +4 -0
  15. package/dist/cjs/src/pro/bitget.js +66 -0
  16. package/dist/cjs/src/pro/bitmart.js +81 -0
  17. package/dist/cjs/src/pro/bitvavo.js +92 -1
  18. package/dist/cjs/src/pro/blofin.js +64 -0
  19. package/dist/cjs/src/pro/okx.js +11 -5
  20. package/examples/js/cli.js +2 -0
  21. package/js/ccxt.d.ts +1 -1
  22. package/js/ccxt.js +1 -1
  23. package/js/src/abstract/binance.d.ts +1 -0
  24. package/js/src/abstract/binancecoinm.d.ts +1 -0
  25. package/js/src/abstract/binanceus.d.ts +1 -0
  26. package/js/src/abstract/binanceusdm.d.ts +1 -0
  27. package/js/src/abstract/bybit.d.ts +5 -0
  28. package/js/src/abstract/okx.d.ts +2 -0
  29. package/js/src/base/Exchange.d.ts +4 -0
  30. package/js/src/base/Exchange.js +21 -2
  31. package/js/src/binance.d.ts +15 -15
  32. package/js/src/binance.js +51 -12
  33. package/js/src/bingx.js +3 -0
  34. package/js/src/bitget.js +10 -6
  35. package/js/src/bitmart.d.ts +1 -0
  36. package/js/src/bitmart.js +124 -1
  37. package/js/src/bybit.d.ts +7 -1
  38. package/js/src/bybit.js +377 -10
  39. package/js/src/gate.js +3 -0
  40. package/js/src/htx.js +22 -0
  41. package/js/src/kucoin.js +2 -2
  42. package/js/src/mexc.d.ts +2 -0
  43. package/js/src/mexc.js +97 -13
  44. package/js/src/okx.js +4 -0
  45. package/js/src/pro/bitget.d.ts +3 -0
  46. package/js/src/pro/bitget.js +66 -0
  47. package/js/src/pro/bitmart.d.ts +3 -0
  48. package/js/src/pro/bitmart.js +81 -0
  49. package/js/src/pro/bitvavo.d.ts +7 -2
  50. package/js/src/pro/bitvavo.js +92 -1
  51. package/js/src/pro/blofin.d.ts +3 -0
  52. package/js/src/pro/blofin.js +64 -0
  53. package/js/src/pro/okx.d.ts +1 -0
  54. package/js/src/pro/okx.js +11 -5
  55. package/package.json +1 -1
@@ -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,
@@ -6223,13 +6233,17 @@ class bybit extends bybit$1 {
6223
6233
  const currencyId = this.safeString2(item, 'coin', 'currency');
6224
6234
  const code = this.safeCurrencyCode(currencyId, currency);
6225
6235
  currency = this.safeCurrency(currencyId, currency);
6226
- const amount = this.safeString2(item, 'amount', 'change');
6227
- const after = this.safeString2(item, 'wallet_balance', 'cashBalance');
6228
- const direction = Precise["default"].stringLt(amount, '0') ? 'out' : 'in';
6236
+ const amountString = this.safeString2(item, 'amount', 'change');
6237
+ const afterString = this.safeString2(item, 'wallet_balance', 'cashBalance');
6238
+ const direction = Precise["default"].stringLt(amountString, '0') ? 'out' : 'in';
6229
6239
  let before = undefined;
6230
- if (after !== undefined && amount !== undefined) {
6231
- const difference = (direction === 'out') ? amount : Precise["default"].stringNeg(amount);
6232
- before = Precise["default"].stringAdd(after, difference);
6240
+ let after = undefined;
6241
+ let amount = undefined;
6242
+ if (afterString !== undefined && amountString !== undefined) {
6243
+ const difference = (direction === 'out') ? amountString : Precise["default"].stringNeg(amountString);
6244
+ before = this.parseToNumeric(Precise["default"].stringAdd(afterString, difference));
6245
+ after = this.parseToNumeric(afterString);
6246
+ amount = this.parseToNumeric(Precise["default"].stringAbs(amountString));
6233
6247
  }
6234
6248
  let timestamp = this.parse8601(this.safeString(item, 'exec_time'));
6235
6249
  if (timestamp === undefined) {
@@ -6244,15 +6258,15 @@ class bybit extends bybit$1 {
6244
6258
  'referenceAccount': undefined,
6245
6259
  'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
6246
6260
  'currency': code,
6247
- 'amount': this.parseToNumeric(Precise["default"].stringAbs(amount)),
6261
+ 'amount': amount,
6248
6262
  'timestamp': timestamp,
6249
6263
  'datetime': this.iso8601(timestamp),
6250
- 'before': this.parseToNumeric(before),
6251
- 'after': this.parseToNumeric(after),
6264
+ 'before': before,
6265
+ 'after': after,
6252
6266
  'status': 'ok',
6253
6267
  'fee': {
6254
6268
  'currency': code,
6255
- 'cost': this.parseToNumeric(this.safeString(item, 'fee')),
6269
+ 'cost': this.safeNumber(item, 'fee'),
6256
6270
  },
6257
6271
  }, currency);
6258
6272
  }
@@ -8864,6 +8878,359 @@ class bybit extends bybit$1 {
8864
8878
  const positions = this.parsePositions(rawPositions, symbols, params);
8865
8879
  return this.filterBySinceLimit(positions, since, limit);
8866
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
+ }
8867
9234
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
8868
9235
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
8869
9236
  if (api === 'public') {
@@ -639,6 +639,9 @@ class gate extends gate$1 {
639
639
  'OPTIMISM': 'OPETH',
640
640
  'POLKADOT': 'DOTSM',
641
641
  'TRC20': 'TRX',
642
+ 'LUNA': 'LUNC',
643
+ 'BASE': 'BASEEVM',
644
+ 'BRC20': 'BTCBRC',
642
645
  },
643
646
  'timeInForce': {
644
647
  'GTC': 'gtc',
@@ -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,
@@ -758,7 +758,7 @@ class kucoin extends kucoin$1 {
758
758
  'hf': 'trade_hf',
759
759
  },
760
760
  'networks': {
761
- 'BTC': 'btc',
761
+ 'BRC20': 'btc',
762
762
  'BTCNATIVESEGWIT': 'bech32',
763
763
  'ERC20': 'eth',
764
764
  'TRC20': 'trx',
@@ -1340,7 +1340,7 @@ class kucoin extends kucoin$1 {
1340
1340
  for (let j = 0; j < chainsLength; j++) {
1341
1341
  const chain = chains[j];
1342
1342
  const chainId = this.safeString(chain, 'chainId');
1343
- const networkCode = this.networkIdToCode(chainId);
1343
+ const networkCode = this.networkIdToCode(chainId, code);
1344
1344
  const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false);
1345
1345
  if (isWithdrawEnabled === undefined) {
1346
1346
  isWithdrawEnabled = chainWithdrawEnabled;