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
package/js/src/bybit.js CHANGED
@@ -43,6 +43,7 @@ export default class bybit extends Exchange {
43
43
  'cancelOrdersForSymbols': true,
44
44
  'closeAllPositions': false,
45
45
  'closePosition': false,
46
+ 'createConvertTrade': true,
46
47
  'createMarketBuyOrderWithCost': true,
47
48
  'createMarketSellOrderWithCost': true,
48
49
  'createOrder': true,
@@ -66,6 +67,10 @@ export default class bybit extends Exchange {
66
67
  'fetchCanceledOrders': true,
67
68
  'fetchClosedOrder': true,
68
69
  'fetchClosedOrders': true,
70
+ 'fetchConvertCurrencies': true,
71
+ 'fetchConvertQuote': true,
72
+ 'fetchConvertTrade': true,
73
+ 'fetchConvertTradeHistory': true,
69
74
  'fetchCrossBorrowRate': true,
70
75
  'fetchCrossBorrowRates': false,
71
76
  'fetchCurrencies': true,
@@ -332,6 +337,9 @@ export default class bybit extends Exchange {
332
337
  'v5/account/smp-group': 1,
333
338
  'v5/account/mmp-state': 5,
334
339
  // asset
340
+ 'v5/asset/exchange/query-coin-list': 0.5,
341
+ 'v5/asset/exchange/convert-result-query': 0.5,
342
+ 'v5/asset/exchange/query-convert-history': 0.5,
335
343
  'v5/asset/exchange/order-record': 5,
336
344
  'v5/asset/delivery-record': 5,
337
345
  'v5/asset/settlement-record': 5,
@@ -490,6 +498,8 @@ export default class bybit extends Exchange {
490
498
  'v5/account/mmp-modify': 5,
491
499
  'v5/account/mmp-reset': 5,
492
500
  // asset
501
+ 'v5/asset/exchange/quote-apply': 1,
502
+ 'v5/asset/exchange/convert-execute': 1,
493
503
  'v5/asset/transfer/inter-transfer': 50,
494
504
  'v5/asset/transfer/save-transfer-sub-member': 150,
495
505
  'v5/asset/transfer/universal-transfer': 10,
@@ -6226,13 +6236,17 @@ export default class bybit extends Exchange {
6226
6236
  const currencyId = this.safeString2(item, 'coin', 'currency');
6227
6237
  const code = this.safeCurrencyCode(currencyId, currency);
6228
6238
  currency = this.safeCurrency(currencyId, currency);
6229
- const amount = this.safeString2(item, 'amount', 'change');
6230
- const after = this.safeString2(item, 'wallet_balance', 'cashBalance');
6231
- const direction = Precise.stringLt(amount, '0') ? 'out' : 'in';
6239
+ const amountString = this.safeString2(item, 'amount', 'change');
6240
+ const afterString = this.safeString2(item, 'wallet_balance', 'cashBalance');
6241
+ const direction = Precise.stringLt(amountString, '0') ? 'out' : 'in';
6232
6242
  let before = undefined;
6233
- if (after !== undefined && amount !== undefined) {
6234
- const difference = (direction === 'out') ? amount : Precise.stringNeg(amount);
6235
- before = Precise.stringAdd(after, difference);
6243
+ let after = undefined;
6244
+ let amount = undefined;
6245
+ if (afterString !== undefined && amountString !== undefined) {
6246
+ const difference = (direction === 'out') ? amountString : Precise.stringNeg(amountString);
6247
+ before = this.parseToNumeric(Precise.stringAdd(afterString, difference));
6248
+ after = this.parseToNumeric(afterString);
6249
+ amount = this.parseToNumeric(Precise.stringAbs(amountString));
6236
6250
  }
6237
6251
  let timestamp = this.parse8601(this.safeString(item, 'exec_time'));
6238
6252
  if (timestamp === undefined) {
@@ -6247,15 +6261,15 @@ export default class bybit extends Exchange {
6247
6261
  'referenceAccount': undefined,
6248
6262
  'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
6249
6263
  'currency': code,
6250
- 'amount': this.parseToNumeric(Precise.stringAbs(amount)),
6264
+ 'amount': amount,
6251
6265
  'timestamp': timestamp,
6252
6266
  'datetime': this.iso8601(timestamp),
6253
- 'before': this.parseToNumeric(before),
6254
- 'after': this.parseToNumeric(after),
6267
+ 'before': before,
6268
+ 'after': after,
6255
6269
  'status': 'ok',
6256
6270
  'fee': {
6257
6271
  'currency': code,
6258
- 'cost': this.parseToNumeric(this.safeString(item, 'fee')),
6272
+ 'cost': this.safeNumber(item, 'fee'),
6259
6273
  },
6260
6274
  }, currency);
6261
6275
  }
@@ -8871,6 +8885,359 @@ export default class bybit extends Exchange {
8871
8885
  const positions = this.parsePositions(rawPositions, symbols, params);
8872
8886
  return this.filterBySinceLimit(positions, since, limit);
8873
8887
  }
8888
+ async fetchConvertCurrencies(params = {}) {
8889
+ /**
8890
+ * @method
8891
+ * @name bybit#fetchConvertCurrencies
8892
+ * @description fetches all available currencies that can be converted
8893
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list
8894
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8895
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8896
+ * @returns {object} an associative dictionary of currencies
8897
+ */
8898
+ await this.loadMarkets();
8899
+ let accountType = undefined;
8900
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
8901
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
8902
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
8903
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertCurrencies', 'accountType', accountTypeDefault);
8904
+ const request = {
8905
+ 'accountType': accountType,
8906
+ };
8907
+ const response = await this.privateGetV5AssetExchangeQueryCoinList(this.extend(request, params));
8908
+ //
8909
+ // {
8910
+ // "retCode": 0,
8911
+ // "retMsg": "ok",
8912
+ // "result": {
8913
+ // "coins": [
8914
+ // {
8915
+ // "coin": "MATIC",
8916
+ // "fullName": "MATIC",
8917
+ // "icon": "https://s1.bycsi.com/app/assets/token/0552ae79c535c3095fa18f7b377dd2e9.svg",
8918
+ // "iconNight": "https://t1.bycsi.com/app/assets/token/f59301aef2d6ac2165c4c4603e672fb4.svg",
8919
+ // "accuracyLength": 8,
8920
+ // "coinType": "crypto",
8921
+ // "balance": "0",
8922
+ // "uBalance": "0",
8923
+ // "timePeriod": 0,
8924
+ // "singleFromMinLimit": "1.1",
8925
+ // "singleFromMaxLimit": "20001",
8926
+ // "singleToMinLimit": "0",
8927
+ // "singleToMaxLimit": "0",
8928
+ // "dailyFromMinLimit": "0",
8929
+ // "dailyFromMaxLimit": "0",
8930
+ // "dailyToMinLimit": "0",
8931
+ // "dailyToMaxLimit": "0",
8932
+ // "disableFrom": false,
8933
+ // "disableTo": false
8934
+ // },
8935
+ // ]
8936
+ // },
8937
+ // "retExtInfo": {},
8938
+ // "time": 1727256416250
8939
+ // }
8940
+ //
8941
+ const result = {};
8942
+ const data = this.safeDict(response, 'result', {});
8943
+ const coins = this.safeList(data, 'coins', []);
8944
+ for (let i = 0; i < coins.length; i++) {
8945
+ const entry = coins[i];
8946
+ const id = this.safeString(entry, 'coin');
8947
+ const disableFrom = this.safeBool(entry, 'disableFrom');
8948
+ const disableTo = this.safeBool(entry, 'disableTo');
8949
+ const inactive = (disableFrom || disableTo);
8950
+ const code = this.safeCurrencyCode(id);
8951
+ result[code] = {
8952
+ 'info': entry,
8953
+ 'id': id,
8954
+ 'code': code,
8955
+ 'networks': undefined,
8956
+ 'type': this.safeString(entry, 'coinType'),
8957
+ 'name': this.safeString(entry, 'fullName'),
8958
+ 'active': !inactive,
8959
+ 'deposit': undefined,
8960
+ 'withdraw': this.safeNumber(entry, 'balance'),
8961
+ 'fee': undefined,
8962
+ 'precision': undefined,
8963
+ 'limits': {
8964
+ 'amount': {
8965
+ 'min': this.safeNumber(entry, 'singleFromMinLimit'),
8966
+ 'max': this.safeNumber(entry, 'singleFromMaxLimit'),
8967
+ },
8968
+ 'withdraw': {
8969
+ 'min': undefined,
8970
+ 'max': undefined,
8971
+ },
8972
+ 'deposit': {
8973
+ 'min': undefined,
8974
+ 'max': undefined,
8975
+ },
8976
+ },
8977
+ 'created': undefined,
8978
+ };
8979
+ }
8980
+ return result;
8981
+ }
8982
+ async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
8983
+ /**
8984
+ * @method
8985
+ * @name bybit#fetchConvertQuote
8986
+ * @description fetch a quote for converting from one currency to another
8987
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote
8988
+ * @param {string} fromCode the currency that you want to sell and convert from
8989
+ * @param {string} toCode the currency that you want to buy and convert into
8990
+ * @param {float} [amount] how much you want to trade in units of the from currency
8991
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8992
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8993
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
8994
+ */
8995
+ await this.loadMarkets();
8996
+ let accountType = undefined;
8997
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
8998
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
8999
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
9000
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertQuote', 'accountType', accountTypeDefault);
9001
+ const request = {
9002
+ 'fromCoin': fromCode,
9003
+ 'toCoin': toCode,
9004
+ 'requestAmount': this.numberToString(amount),
9005
+ 'requestCoin': fromCode,
9006
+ 'accountType': accountType,
9007
+ };
9008
+ const response = await this.privatePostV5AssetExchangeQuoteApply(this.extend(request, params));
9009
+ //
9010
+ // {
9011
+ // "retCode": 0,
9012
+ // "retMsg": "ok",
9013
+ // "result": {
9014
+ // "quoteTxId": "1010020692439481682687668224",
9015
+ // "exchangeRate": "0.000015330836780000",
9016
+ // "fromCoin": "USDT",
9017
+ // "fromCoinType": "crypto",
9018
+ // "toCoin": "BTC",
9019
+ // "toCoinType": "crypto",
9020
+ // "fromAmount": "10",
9021
+ // "toAmount": "0.000153308367800000",
9022
+ // "expiredTime": "1727257413353",
9023
+ // "requestId": ""
9024
+ // },
9025
+ // "retExtInfo": {},
9026
+ // "time": 1727257398375
9027
+ // }
9028
+ //
9029
+ const data = this.safeDict(response, 'result', {});
9030
+ const fromCurrencyId = this.safeString(data, 'fromCoin', fromCode);
9031
+ const fromCurrency = this.currency(fromCurrencyId);
9032
+ const toCurrencyId = this.safeString(data, 'toCoin', toCode);
9033
+ const toCurrency = this.currency(toCurrencyId);
9034
+ return this.parseConversion(data, fromCurrency, toCurrency);
9035
+ }
9036
+ async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
9037
+ /**
9038
+ * @method
9039
+ * @name bybit#createConvertTrade
9040
+ * @description convert from one currency to another
9041
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote
9042
+ * @param {string} id the id of the trade that you want to make
9043
+ * @param {string} fromCode the currency that you want to sell and convert from
9044
+ * @param {string} toCode the currency that you want to buy and convert into
9045
+ * @param {float} amount how much you want to trade in units of the from currency
9046
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9047
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9048
+ */
9049
+ await this.loadMarkets();
9050
+ const request = {
9051
+ 'quoteTxId': id,
9052
+ };
9053
+ const response = await this.privatePostV5AssetExchangeConvertExecute(this.extend(request, params));
9054
+ //
9055
+ // {
9056
+ // "retCode": 0,
9057
+ // "retMsg": "ok",
9058
+ // "result": {
9059
+ // "exchangeStatus": "processing",
9060
+ // "quoteTxId": "1010020692439483803499737088"
9061
+ // },
9062
+ // "retExtInfo": {},
9063
+ // "time": 1727257904969
9064
+ // }
9065
+ //
9066
+ const data = this.safeDict(response, 'result', {});
9067
+ return this.parseConversion(data);
9068
+ }
9069
+ async fetchConvertTrade(id, code = undefined, params = {}) {
9070
+ /**
9071
+ * @method
9072
+ * @name bybit#fetchConvertTrade
9073
+ * @description fetch the data for a conversion trade
9074
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result
9075
+ * @param {string} id the id of the trade that you want to fetch
9076
+ * @param {string} [code] the unified currency code of the conversion trade
9077
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9078
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
9079
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9080
+ */
9081
+ await this.loadMarkets();
9082
+ let accountType = undefined;
9083
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
9084
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
9085
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
9086
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertQuote', 'accountType', accountTypeDefault);
9087
+ const request = {
9088
+ 'quoteTxId': id,
9089
+ 'accountType': accountType,
9090
+ };
9091
+ const response = await this.privateGetV5AssetExchangeConvertResultQuery(this.extend(request, params));
9092
+ //
9093
+ // {
9094
+ // "retCode": 0,
9095
+ // "retMsg": "ok",
9096
+ // "result": {
9097
+ // "result": {
9098
+ // "accountType": "eb_convert_uta",
9099
+ // "exchangeTxId": "1010020692439483803499737088",
9100
+ // "userId": "100406395",
9101
+ // "fromCoin": "USDT",
9102
+ // "fromCoinType": "crypto",
9103
+ // "fromAmount": "10",
9104
+ // "toCoin": "BTC",
9105
+ // "toCoinType": "crypto",
9106
+ // "toAmount": "0.00015344889",
9107
+ // "exchangeStatus": "success",
9108
+ // "extInfo": {},
9109
+ // "convertRate": "0.000015344889",
9110
+ // "createdAt": "1727257904726"
9111
+ // }
9112
+ // },
9113
+ // "retExtInfo": {},
9114
+ // "time": 1727258257216
9115
+ // }
9116
+ //
9117
+ const data = this.safeDict(response, 'result', {});
9118
+ const result = this.safeDict(data, 'result', {});
9119
+ const fromCurrencyId = this.safeString(result, 'fromCoin');
9120
+ const toCurrencyId = this.safeString(result, 'toCoin');
9121
+ let fromCurrency = undefined;
9122
+ let toCurrency = undefined;
9123
+ if (fromCurrencyId !== undefined) {
9124
+ fromCurrency = this.currency(fromCurrencyId);
9125
+ }
9126
+ if (toCurrencyId !== undefined) {
9127
+ toCurrency = this.currency(toCurrencyId);
9128
+ }
9129
+ return this.parseConversion(result, fromCurrency, toCurrency);
9130
+ }
9131
+ async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
9132
+ /**
9133
+ * @method
9134
+ * @name bybit#fetchConvertTradeHistory
9135
+ * @description fetch the users history of conversion trades
9136
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history
9137
+ * @param {string} [code] the unified currency code
9138
+ * @param {int} [since] the earliest time in ms to fetch conversions for
9139
+ * @param {int} [limit] the maximum number of conversion structures to retrieve
9140
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9141
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
9142
+ * @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9143
+ */
9144
+ await this.loadMarkets();
9145
+ const request = {};
9146
+ if (limit !== undefined) {
9147
+ request['limit'] = limit;
9148
+ }
9149
+ const response = await this.privateGetV5AssetExchangeQueryConvertHistory(this.extend(request, params));
9150
+ //
9151
+ // {
9152
+ // "retCode": 0,
9153
+ // "retMsg": "ok",
9154
+ // "result": {
9155
+ // "list": [
9156
+ // {
9157
+ // "accountType": "eb_convert_uta",
9158
+ // "exchangeTxId": "1010020692439483803499737088",
9159
+ // "userId": "100406395",
9160
+ // "fromCoin": "USDT",
9161
+ // "fromCoinType": "crypto",
9162
+ // "fromAmount": "10",
9163
+ // "toCoin": "BTC",
9164
+ // "toCoinType": "crypto",
9165
+ // "toAmount": "0.00015344889",
9166
+ // "exchangeStatus": "success",
9167
+ // "extInfo": {},
9168
+ // "convertRate": "0.000015344889",
9169
+ // "createdAt": "1727257904726"
9170
+ // }
9171
+ // ]
9172
+ // },
9173
+ // "retExtInfo": {},
9174
+ // "time": 1727258761874
9175
+ // }
9176
+ //
9177
+ const data = this.safeDict(response, 'result', {});
9178
+ const dataList = this.safeList(data, 'list', []);
9179
+ return this.parseConversions(dataList, code, 'fromCoin', 'toCoin', since, limit);
9180
+ }
9181
+ parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
9182
+ //
9183
+ // fetchConvertQuote
9184
+ //
9185
+ // {
9186
+ // "quoteTxId": "1010020692439481682687668224",
9187
+ // "exchangeRate": "0.000015330836780000",
9188
+ // "fromCoin": "USDT",
9189
+ // "fromCoinType": "crypto",
9190
+ // "toCoin": "BTC",
9191
+ // "toCoinType": "crypto",
9192
+ // "fromAmount": "10",
9193
+ // "toAmount": "0.000153308367800000",
9194
+ // "expiredTime": "1727257413353",
9195
+ // "requestId": ""
9196
+ // }
9197
+ //
9198
+ // createConvertTrade
9199
+ //
9200
+ // {
9201
+ // "exchangeStatus": "processing",
9202
+ // "quoteTxId": "1010020692439483803499737088"
9203
+ // }
9204
+ //
9205
+ // fetchConvertTrade, fetchConvertTradeHistory
9206
+ //
9207
+ // {
9208
+ // "accountType": "eb_convert_uta",
9209
+ // "exchangeTxId": "1010020692439483803499737088",
9210
+ // "userId": "100406395",
9211
+ // "fromCoin": "USDT",
9212
+ // "fromCoinType": "crypto",
9213
+ // "fromAmount": "10",
9214
+ // "toCoin": "BTC",
9215
+ // "toCoinType": "crypto",
9216
+ // "toAmount": "0.00015344889",
9217
+ // "exchangeStatus": "success",
9218
+ // "extInfo": {},
9219
+ // "convertRate": "0.000015344889",
9220
+ // "createdAt": "1727257904726"
9221
+ // }
9222
+ //
9223
+ const timestamp = this.safeInteger2(conversion, 'expiredTime', 'createdAt');
9224
+ const fromCoin = this.safeString(conversion, 'fromCoin');
9225
+ const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
9226
+ const to = this.safeString(conversion, 'toCoin');
9227
+ const toCode = this.safeCurrencyCode(to, toCurrency);
9228
+ return {
9229
+ 'info': conversion,
9230
+ 'timestamp': timestamp,
9231
+ 'datetime': this.iso8601(timestamp),
9232
+ 'id': this.safeString2(conversion, 'quoteTxId', 'exchangeTxId'),
9233
+ 'fromCurrency': fromCode,
9234
+ 'fromAmount': this.safeNumber(conversion, 'fromAmount'),
9235
+ 'toCurrency': toCode,
9236
+ 'toAmount': this.safeNumber(conversion, 'toAmount'),
9237
+ 'price': undefined,
9238
+ 'fee': undefined,
9239
+ };
9240
+ }
8874
9241
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
8875
9242
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
8876
9243
  if (api === 'public') {
package/js/src/gate.js CHANGED
@@ -642,6 +642,9 @@ export default class gate extends Exchange {
642
642
  'OPTIMISM': 'OPETH',
643
643
  'POLKADOT': 'DOTSM',
644
644
  'TRC20': 'TRX',
645
+ 'LUNA': 'LUNC',
646
+ 'BASE': 'BASEEVM',
647
+ 'BRC20': 'BTCBRC',
645
648
  },
646
649
  'timeInForce': {
647
650
  'GTC': 'gtc',
package/js/src/htx.js CHANGED
@@ -2081,6 +2081,10 @@ export default class htx extends Exchange {
2081
2081
  * @method
2082
2082
  * @name htx#fetchTicker
2083
2083
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
2084
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-latest-aggregated-ticker
2085
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#get-market-data-overview
2086
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-data-overview
2087
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-data-overview
2084
2088
  * @param {string} symbol unified symbol of the market to fetch the ticker for
2085
2089
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2086
2090
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -2401,6 +2405,10 @@ export default class htx extends Exchange {
2401
2405
  * @method
2402
2406
  * @name htx#fetchOrderBook
2403
2407
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
2408
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-market-depth
2409
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#get-market-depth
2410
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-depth
2411
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-depth
2404
2412
  * @param {string} symbol unified symbol of the market to fetch the order book for
2405
2413
  * @param {int} [limit] the maximum amount of order book entries to return
2406
2414
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2630,6 +2638,7 @@ export default class htx extends Exchange {
2630
2638
  * @method
2631
2639
  * @name htx#fetchOrderTrades
2632
2640
  * @description fetch all the trades made from a single order
2641
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order
2633
2642
  * @param {string} id order id
2634
2643
  * @param {string} symbol unified market symbol
2635
2644
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -2649,6 +2658,19 @@ export default class htx extends Exchange {
2649
2658
  return await this.fetchSpotOrderTrades(id, symbol, since, limit, params);
2650
2659
  }
2651
2660
  async fetchSpotOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2661
+ /**
2662
+ * @ignore
2663
+ * @method
2664
+ * @name htx#fetchOrderTrades
2665
+ * @description fetch all the trades made from a single order
2666
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order
2667
+ * @param {string} id order id
2668
+ * @param {string} symbol unified market symbol
2669
+ * @param {int} [since] the earliest time in ms to fetch trades for
2670
+ * @param {int} [limit] the maximum number of trades to retrieve
2671
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2672
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2673
+ */
2652
2674
  await this.loadMarkets();
2653
2675
  const request = {
2654
2676
  'order-id': id,
package/js/src/kucoin.js CHANGED
@@ -761,7 +761,7 @@ export default class kucoin extends Exchange {
761
761
  'hf': 'trade_hf',
762
762
  },
763
763
  'networks': {
764
- 'BTC': 'btc',
764
+ 'BRC20': 'btc',
765
765
  'BTCNATIVESEGWIT': 'bech32',
766
766
  'ERC20': 'eth',
767
767
  'TRC20': 'trx',
@@ -1343,7 +1343,7 @@ export default class kucoin extends Exchange {
1343
1343
  for (let j = 0; j < chainsLength; j++) {
1344
1344
  const chain = chains[j];
1345
1345
  const chainId = this.safeString(chain, 'chainId');
1346
- const networkCode = this.networkIdToCode(chainId);
1346
+ const networkCode = this.networkIdToCode(chainId, code);
1347
1347
  const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false);
1348
1348
  if (isWithdrawEnabled === undefined) {
1349
1349
  isWithdrawEnabled = chainWithdrawEnabled;
package/js/src/mexc.d.ts CHANGED
@@ -30,6 +30,7 @@ export default class mexc extends Exchange {
30
30
  parseTicker(ticker: Dict, market?: Market): Ticker;
31
31
  fetchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
32
32
  createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
33
+ createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
33
34
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
34
35
  createSpotOrderRequest(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): any;
35
36
  createSpotOrder(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): Promise<Order>;
@@ -156,6 +157,7 @@ export default class mexc extends Exchange {
156
157
  parseLeverage(leverage: Dict, market?: Market): Leverage;
157
158
  handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
158
159
  fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
160
+ setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<Leverage>;
159
161
  nonce(): number;
160
162
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
161
163
  url: any;