ccxt 4.4.7 → 4.4.9

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 (61) 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/bigone.js +35 -86
  5. package/dist/cjs/src/binance.js +51 -12
  6. package/dist/cjs/src/bingx.js +7 -2
  7. package/dist/cjs/src/bitget.js +3 -0
  8. package/dist/cjs/src/bybit.js +368 -1
  9. package/dist/cjs/src/gate.js +35 -1
  10. package/dist/cjs/src/htx.js +24 -0
  11. package/dist/cjs/src/kucoin.js +2 -1
  12. package/dist/cjs/src/kucoinfutures.js +162 -2
  13. package/dist/cjs/src/okx.js +4 -0
  14. package/dist/cjs/src/pro/binance.js +4 -4
  15. package/dist/cjs/src/pro/bitmart.js +81 -0
  16. package/dist/cjs/src/pro/bitvavo.js +92 -1
  17. package/dist/cjs/src/pro/blofin.js +64 -0
  18. package/dist/cjs/src/pro/hitbtc.js +122 -48
  19. package/dist/cjs/src/pro/hollaex.js +5 -0
  20. package/dist/cjs/src/pro/okx.js +19 -3
  21. package/dist/cjs/src/pro/p2b.js +35 -1
  22. package/dist/cjs/src/pro/whitebit.js +31 -0
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/bigone.d.ts +1 -1
  26. package/js/src/abstract/binance.d.ts +1 -0
  27. package/js/src/abstract/binancecoinm.d.ts +1 -0
  28. package/js/src/abstract/binanceus.d.ts +1 -0
  29. package/js/src/abstract/binanceusdm.d.ts +1 -0
  30. package/js/src/abstract/bybit.d.ts +5 -0
  31. package/js/src/abstract/kucoinfutures.d.ts +5 -0
  32. package/js/src/abstract/okx.d.ts +2 -0
  33. package/js/src/bigone.js +35 -86
  34. package/js/src/binance.d.ts +15 -15
  35. package/js/src/binance.js +51 -12
  36. package/js/src/bingx.js +7 -2
  37. package/js/src/bitget.js +3 -0
  38. package/js/src/bybit.d.ts +7 -1
  39. package/js/src/bybit.js +368 -1
  40. package/js/src/gate.js +35 -1
  41. package/js/src/htx.js +24 -0
  42. package/js/src/kucoin.js +2 -1
  43. package/js/src/kucoinfutures.d.ts +7 -1
  44. package/js/src/kucoinfutures.js +162 -2
  45. package/js/src/okx.js +4 -0
  46. package/js/src/pro/binance.js +4 -4
  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/hitbtc.d.ts +4 -1
  54. package/js/src/pro/hitbtc.js +122 -48
  55. package/js/src/pro/hollaex.js +5 -0
  56. package/js/src/pro/okx.js +19 -3
  57. package/js/src/pro/p2b.d.ts +2 -1
  58. package/js/src/pro/p2b.js +35 -1
  59. package/js/src/pro/whitebit.d.ts +2 -1
  60. package/js/src/pro/whitebit.js +31 -0
  61. 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,
@@ -3702,6 +3712,7 @@ export default class bybit extends Exchange {
3702
3712
  // Valid for option only.
3703
3713
  // 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
3704
3714
  };
3715
+ const hedged = this.safeBool(params, 'hedged', false);
3705
3716
  let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
3706
3717
  const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
3707
3718
  const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
@@ -3900,7 +3911,10 @@ export default class bybit extends Exchange {
3900
3911
  }
3901
3912
  }
3902
3913
  }
3903
- params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice']);
3914
+ if (!market['spot'] && hedged) {
3915
+ request['positionIdx'] = (side === 'buy') ? 1 : 2;
3916
+ }
3917
+ params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged']);
3904
3918
  return this.extend(request, params);
3905
3919
  }
3906
3920
  async createOrders(orders, params = {}) {
@@ -8875,6 +8889,359 @@ export default class bybit extends Exchange {
8875
8889
  const positions = this.parsePositions(rawPositions, symbols, params);
8876
8890
  return this.filterBySinceLimit(positions, since, limit);
8877
8891
  }
8892
+ async fetchConvertCurrencies(params = {}) {
8893
+ /**
8894
+ * @method
8895
+ * @name bybit#fetchConvertCurrencies
8896
+ * @description fetches all available currencies that can be converted
8897
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list
8898
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8899
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8900
+ * @returns {object} an associative dictionary of currencies
8901
+ */
8902
+ await this.loadMarkets();
8903
+ let accountType = undefined;
8904
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
8905
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
8906
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
8907
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertCurrencies', 'accountType', accountTypeDefault);
8908
+ const request = {
8909
+ 'accountType': accountType,
8910
+ };
8911
+ const response = await this.privateGetV5AssetExchangeQueryCoinList(this.extend(request, params));
8912
+ //
8913
+ // {
8914
+ // "retCode": 0,
8915
+ // "retMsg": "ok",
8916
+ // "result": {
8917
+ // "coins": [
8918
+ // {
8919
+ // "coin": "MATIC",
8920
+ // "fullName": "MATIC",
8921
+ // "icon": "https://s1.bycsi.com/app/assets/token/0552ae79c535c3095fa18f7b377dd2e9.svg",
8922
+ // "iconNight": "https://t1.bycsi.com/app/assets/token/f59301aef2d6ac2165c4c4603e672fb4.svg",
8923
+ // "accuracyLength": 8,
8924
+ // "coinType": "crypto",
8925
+ // "balance": "0",
8926
+ // "uBalance": "0",
8927
+ // "timePeriod": 0,
8928
+ // "singleFromMinLimit": "1.1",
8929
+ // "singleFromMaxLimit": "20001",
8930
+ // "singleToMinLimit": "0",
8931
+ // "singleToMaxLimit": "0",
8932
+ // "dailyFromMinLimit": "0",
8933
+ // "dailyFromMaxLimit": "0",
8934
+ // "dailyToMinLimit": "0",
8935
+ // "dailyToMaxLimit": "0",
8936
+ // "disableFrom": false,
8937
+ // "disableTo": false
8938
+ // },
8939
+ // ]
8940
+ // },
8941
+ // "retExtInfo": {},
8942
+ // "time": 1727256416250
8943
+ // }
8944
+ //
8945
+ const result = {};
8946
+ const data = this.safeDict(response, 'result', {});
8947
+ const coins = this.safeList(data, 'coins', []);
8948
+ for (let i = 0; i < coins.length; i++) {
8949
+ const entry = coins[i];
8950
+ const id = this.safeString(entry, 'coin');
8951
+ const disableFrom = this.safeBool(entry, 'disableFrom');
8952
+ const disableTo = this.safeBool(entry, 'disableTo');
8953
+ const inactive = (disableFrom || disableTo);
8954
+ const code = this.safeCurrencyCode(id);
8955
+ result[code] = {
8956
+ 'info': entry,
8957
+ 'id': id,
8958
+ 'code': code,
8959
+ 'networks': undefined,
8960
+ 'type': this.safeString(entry, 'coinType'),
8961
+ 'name': this.safeString(entry, 'fullName'),
8962
+ 'active': !inactive,
8963
+ 'deposit': undefined,
8964
+ 'withdraw': this.safeNumber(entry, 'balance'),
8965
+ 'fee': undefined,
8966
+ 'precision': undefined,
8967
+ 'limits': {
8968
+ 'amount': {
8969
+ 'min': this.safeNumber(entry, 'singleFromMinLimit'),
8970
+ 'max': this.safeNumber(entry, 'singleFromMaxLimit'),
8971
+ },
8972
+ 'withdraw': {
8973
+ 'min': undefined,
8974
+ 'max': undefined,
8975
+ },
8976
+ 'deposit': {
8977
+ 'min': undefined,
8978
+ 'max': undefined,
8979
+ },
8980
+ },
8981
+ 'created': undefined,
8982
+ };
8983
+ }
8984
+ return result;
8985
+ }
8986
+ async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
8987
+ /**
8988
+ * @method
8989
+ * @name bybit#fetchConvertQuote
8990
+ * @description fetch a quote for converting from one currency to another
8991
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote
8992
+ * @param {string} fromCode the currency that you want to sell and convert from
8993
+ * @param {string} toCode the currency that you want to buy and convert into
8994
+ * @param {float} [amount] how much you want to trade in units of the from currency
8995
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8996
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
8997
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
8998
+ */
8999
+ await this.loadMarkets();
9000
+ let accountType = undefined;
9001
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
9002
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
9003
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
9004
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertQuote', 'accountType', accountTypeDefault);
9005
+ const request = {
9006
+ 'fromCoin': fromCode,
9007
+ 'toCoin': toCode,
9008
+ 'requestAmount': this.numberToString(amount),
9009
+ 'requestCoin': fromCode,
9010
+ 'accountType': accountType,
9011
+ };
9012
+ const response = await this.privatePostV5AssetExchangeQuoteApply(this.extend(request, params));
9013
+ //
9014
+ // {
9015
+ // "retCode": 0,
9016
+ // "retMsg": "ok",
9017
+ // "result": {
9018
+ // "quoteTxId": "1010020692439481682687668224",
9019
+ // "exchangeRate": "0.000015330836780000",
9020
+ // "fromCoin": "USDT",
9021
+ // "fromCoinType": "crypto",
9022
+ // "toCoin": "BTC",
9023
+ // "toCoinType": "crypto",
9024
+ // "fromAmount": "10",
9025
+ // "toAmount": "0.000153308367800000",
9026
+ // "expiredTime": "1727257413353",
9027
+ // "requestId": ""
9028
+ // },
9029
+ // "retExtInfo": {},
9030
+ // "time": 1727257398375
9031
+ // }
9032
+ //
9033
+ const data = this.safeDict(response, 'result', {});
9034
+ const fromCurrencyId = this.safeString(data, 'fromCoin', fromCode);
9035
+ const fromCurrency = this.currency(fromCurrencyId);
9036
+ const toCurrencyId = this.safeString(data, 'toCoin', toCode);
9037
+ const toCurrency = this.currency(toCurrencyId);
9038
+ return this.parseConversion(data, fromCurrency, toCurrency);
9039
+ }
9040
+ async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
9041
+ /**
9042
+ * @method
9043
+ * @name bybit#createConvertTrade
9044
+ * @description convert from one currency to another
9045
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote
9046
+ * @param {string} id the id of the trade that you want to make
9047
+ * @param {string} fromCode the currency that you want to sell and convert from
9048
+ * @param {string} toCode the currency that you want to buy and convert into
9049
+ * @param {float} amount how much you want to trade in units of the from currency
9050
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9051
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9052
+ */
9053
+ await this.loadMarkets();
9054
+ const request = {
9055
+ 'quoteTxId': id,
9056
+ };
9057
+ const response = await this.privatePostV5AssetExchangeConvertExecute(this.extend(request, params));
9058
+ //
9059
+ // {
9060
+ // "retCode": 0,
9061
+ // "retMsg": "ok",
9062
+ // "result": {
9063
+ // "exchangeStatus": "processing",
9064
+ // "quoteTxId": "1010020692439483803499737088"
9065
+ // },
9066
+ // "retExtInfo": {},
9067
+ // "time": 1727257904969
9068
+ // }
9069
+ //
9070
+ const data = this.safeDict(response, 'result', {});
9071
+ return this.parseConversion(data);
9072
+ }
9073
+ async fetchConvertTrade(id, code = undefined, params = {}) {
9074
+ /**
9075
+ * @method
9076
+ * @name bybit#fetchConvertTrade
9077
+ * @description fetch the data for a conversion trade
9078
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result
9079
+ * @param {string} id the id of the trade that you want to fetch
9080
+ * @param {string} [code] the unified currency code of the conversion trade
9081
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9082
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
9083
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9084
+ */
9085
+ await this.loadMarkets();
9086
+ let accountType = undefined;
9087
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
9088
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
9089
+ const accountTypeDefault = isUnifiedAccount ? 'eb_convert_uta' : 'eb_convert_spot';
9090
+ [accountType, params] = this.handleOptionAndParams(params, 'fetchConvertQuote', 'accountType', accountTypeDefault);
9091
+ const request = {
9092
+ 'quoteTxId': id,
9093
+ 'accountType': accountType,
9094
+ };
9095
+ const response = await this.privateGetV5AssetExchangeConvertResultQuery(this.extend(request, params));
9096
+ //
9097
+ // {
9098
+ // "retCode": 0,
9099
+ // "retMsg": "ok",
9100
+ // "result": {
9101
+ // "result": {
9102
+ // "accountType": "eb_convert_uta",
9103
+ // "exchangeTxId": "1010020692439483803499737088",
9104
+ // "userId": "100406395",
9105
+ // "fromCoin": "USDT",
9106
+ // "fromCoinType": "crypto",
9107
+ // "fromAmount": "10",
9108
+ // "toCoin": "BTC",
9109
+ // "toCoinType": "crypto",
9110
+ // "toAmount": "0.00015344889",
9111
+ // "exchangeStatus": "success",
9112
+ // "extInfo": {},
9113
+ // "convertRate": "0.000015344889",
9114
+ // "createdAt": "1727257904726"
9115
+ // }
9116
+ // },
9117
+ // "retExtInfo": {},
9118
+ // "time": 1727258257216
9119
+ // }
9120
+ //
9121
+ const data = this.safeDict(response, 'result', {});
9122
+ const result = this.safeDict(data, 'result', {});
9123
+ const fromCurrencyId = this.safeString(result, 'fromCoin');
9124
+ const toCurrencyId = this.safeString(result, 'toCoin');
9125
+ let fromCurrency = undefined;
9126
+ let toCurrency = undefined;
9127
+ if (fromCurrencyId !== undefined) {
9128
+ fromCurrency = this.currency(fromCurrencyId);
9129
+ }
9130
+ if (toCurrencyId !== undefined) {
9131
+ toCurrency = this.currency(toCurrencyId);
9132
+ }
9133
+ return this.parseConversion(result, fromCurrency, toCurrency);
9134
+ }
9135
+ async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
9136
+ /**
9137
+ * @method
9138
+ * @name bybit#fetchConvertTradeHistory
9139
+ * @description fetch the users history of conversion trades
9140
+ * @see https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history
9141
+ * @param {string} [code] the unified currency code
9142
+ * @param {int} [since] the earliest time in ms to fetch conversions for
9143
+ * @param {int} [limit] the maximum number of conversion structures to retrieve
9144
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
9145
+ * @param {string} [params.accountType] eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
9146
+ * @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
9147
+ */
9148
+ await this.loadMarkets();
9149
+ const request = {};
9150
+ if (limit !== undefined) {
9151
+ request['limit'] = limit;
9152
+ }
9153
+ const response = await this.privateGetV5AssetExchangeQueryConvertHistory(this.extend(request, params));
9154
+ //
9155
+ // {
9156
+ // "retCode": 0,
9157
+ // "retMsg": "ok",
9158
+ // "result": {
9159
+ // "list": [
9160
+ // {
9161
+ // "accountType": "eb_convert_uta",
9162
+ // "exchangeTxId": "1010020692439483803499737088",
9163
+ // "userId": "100406395",
9164
+ // "fromCoin": "USDT",
9165
+ // "fromCoinType": "crypto",
9166
+ // "fromAmount": "10",
9167
+ // "toCoin": "BTC",
9168
+ // "toCoinType": "crypto",
9169
+ // "toAmount": "0.00015344889",
9170
+ // "exchangeStatus": "success",
9171
+ // "extInfo": {},
9172
+ // "convertRate": "0.000015344889",
9173
+ // "createdAt": "1727257904726"
9174
+ // }
9175
+ // ]
9176
+ // },
9177
+ // "retExtInfo": {},
9178
+ // "time": 1727258761874
9179
+ // }
9180
+ //
9181
+ const data = this.safeDict(response, 'result', {});
9182
+ const dataList = this.safeList(data, 'list', []);
9183
+ return this.parseConversions(dataList, code, 'fromCoin', 'toCoin', since, limit);
9184
+ }
9185
+ parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
9186
+ //
9187
+ // fetchConvertQuote
9188
+ //
9189
+ // {
9190
+ // "quoteTxId": "1010020692439481682687668224",
9191
+ // "exchangeRate": "0.000015330836780000",
9192
+ // "fromCoin": "USDT",
9193
+ // "fromCoinType": "crypto",
9194
+ // "toCoin": "BTC",
9195
+ // "toCoinType": "crypto",
9196
+ // "fromAmount": "10",
9197
+ // "toAmount": "0.000153308367800000",
9198
+ // "expiredTime": "1727257413353",
9199
+ // "requestId": ""
9200
+ // }
9201
+ //
9202
+ // createConvertTrade
9203
+ //
9204
+ // {
9205
+ // "exchangeStatus": "processing",
9206
+ // "quoteTxId": "1010020692439483803499737088"
9207
+ // }
9208
+ //
9209
+ // fetchConvertTrade, fetchConvertTradeHistory
9210
+ //
9211
+ // {
9212
+ // "accountType": "eb_convert_uta",
9213
+ // "exchangeTxId": "1010020692439483803499737088",
9214
+ // "userId": "100406395",
9215
+ // "fromCoin": "USDT",
9216
+ // "fromCoinType": "crypto",
9217
+ // "fromAmount": "10",
9218
+ // "toCoin": "BTC",
9219
+ // "toCoinType": "crypto",
9220
+ // "toAmount": "0.00015344889",
9221
+ // "exchangeStatus": "success",
9222
+ // "extInfo": {},
9223
+ // "convertRate": "0.000015344889",
9224
+ // "createdAt": "1727257904726"
9225
+ // }
9226
+ //
9227
+ const timestamp = this.safeInteger2(conversion, 'expiredTime', 'createdAt');
9228
+ const fromCoin = this.safeString(conversion, 'fromCoin');
9229
+ const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
9230
+ const to = this.safeString(conversion, 'toCoin');
9231
+ const toCode = this.safeCurrencyCode(to, toCurrency);
9232
+ return {
9233
+ 'info': conversion,
9234
+ 'timestamp': timestamp,
9235
+ 'datetime': this.iso8601(timestamp),
9236
+ 'id': this.safeString2(conversion, 'quoteTxId', 'exchangeTxId'),
9237
+ 'fromCurrency': fromCode,
9238
+ 'fromAmount': this.safeNumber(conversion, 'fromAmount'),
9239
+ 'toCurrency': toCode,
9240
+ 'toAmount': this.safeNumber(conversion, 'toAmount'),
9241
+ 'price': undefined,
9242
+ 'fee': undefined,
9243
+ };
9244
+ }
8878
9245
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
8879
9246
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
8880
9247
  if (api === 'public') {
package/js/src/gate.js CHANGED
@@ -596,6 +596,8 @@ export default class gate extends Exchange {
596
596
  },
597
597
  // copied from gatev2
598
598
  'commonCurrencies': {
599
+ 'ORT': 'XREATORS',
600
+ 'ASS': 'ASSF',
599
601
  '88MPH': 'MPH',
600
602
  'AXIS': 'AXISDEFI',
601
603
  'BIFI': 'BITCOINFILE',
@@ -630,6 +632,8 @@ export default class gate extends Exchange {
630
632
  },
631
633
  'createMarketBuyOrderRequiresPrice': true,
632
634
  'networks': {
635
+ 'LINEA': 'LINEAETH',
636
+ 'KON': 'KONET',
633
637
  'AVAXC': 'AVAX_C',
634
638
  'BEP20': 'BSC',
635
639
  'EOS': 'EOS',
@@ -4712,6 +4716,7 @@ export default class gate extends Exchange {
4712
4716
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
4713
4717
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
4714
4718
  * @see https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
4719
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-by-time-range
4715
4720
  * @param {string} symbol unified market symbol of the market orders were made in
4716
4721
  * @param {int} [since] the earliest time in ms to fetch orders for
4717
4722
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -4719,9 +4724,38 @@ export default class gate extends Exchange {
4719
4724
  * @param {bool} [params.stop] true for fetching stop orders
4720
4725
  * @param {string} [params.type] spot, swap or future, if not provided this.options['defaultType'] is used
4721
4726
  * @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
4727
+ * @param {boolean} [params.historical] *swap only* true for using historical endpoint
4722
4728
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4723
4729
  */
4724
- return await this.fetchOrdersByStatus('finished', symbol, since, limit, params);
4730
+ await this.loadMarkets();
4731
+ const until = this.safeInteger(params, 'until');
4732
+ params = this.omit(params, 'until');
4733
+ let market = undefined;
4734
+ if (symbol !== undefined) {
4735
+ market = this.market(symbol);
4736
+ symbol = market['symbol'];
4737
+ }
4738
+ const res = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
4739
+ const type = this.safeString(res, 0);
4740
+ let useHistorical = false;
4741
+ [useHistorical, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'historical', false);
4742
+ if (!useHistorical && ((since === undefined && until === undefined) || (type !== 'swap'))) {
4743
+ return await this.fetchOrdersByStatus('finished', symbol, since, limit, params);
4744
+ }
4745
+ params = this.omit(params, 'type');
4746
+ let request = {};
4747
+ [request, params] = this.prepareRequest(market, type, params);
4748
+ if (since !== undefined) {
4749
+ request['from'] = this.parseToInt(since / 1000);
4750
+ }
4751
+ if (until !== undefined) {
4752
+ request['to'] = this.parseToInt(until / 1000);
4753
+ }
4754
+ if (limit !== undefined) {
4755
+ request['limit'] = limit;
4756
+ }
4757
+ const response = await this.privateFuturesGetSettleOrdersTimerange(this.extend(request, params));
4758
+ return this.parseOrders(response, market, since, limit);
4725
4759
  }
4726
4760
  fetchOrdersByStatusRequest(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
4727
4761
  let market = undefined;
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,
@@ -3105,6 +3127,7 @@ export default class htx extends Exchange {
3105
3127
  * @method
3106
3128
  * @name htx#fetchAccounts
3107
3129
  * @description fetch all the accounts associated with a profile
3130
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
3108
3131
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3109
3132
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
3110
3133
  */
@@ -3178,6 +3201,7 @@ export default class htx extends Exchange {
3178
3201
  * @method
3179
3202
  * @name htx#fetchCurrencies
3180
3203
  * @description fetches all available currencies on an exchange
3204
+ * @see https://huobiapi.github.io/docs/spot/v1/en/#apiv2-currency-amp-chains
3181
3205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3182
3206
  * @returns {object} an associative dictionary of currencies
3183
3207
  */
package/js/src/kucoin.js CHANGED
@@ -625,7 +625,8 @@ export default class kucoin extends Exchange {
625
625
  'VAI': 'VAIOT',
626
626
  'WAX': 'WAXP',
627
627
  'ALT': 'APTOSLAUNCHTOKEN',
628
- 'KALT': 'ALT', // ALTLAYER
628
+ 'KALT': 'ALT',
629
+ 'FUD': 'FTX Users\' Debt',
629
630
  },
630
631
  'options': {
631
632
  'hf': false,
@@ -1,5 +1,5 @@
1
1
  import kucoin from './abstract/kucoinfutures.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, OHLCV, Order, Trade, OrderRequest, FundingHistory, Balances, Str, Ticker, Tickers, OrderBook, Transaction, Strings, Market, Currency, Num, MarginModification, TradingFeeInterface, Dict, LeverageTier } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, OHLCV, Order, Trade, OrderRequest, FundingHistory, Balances, Str, Ticker, Tickers, OrderBook, Transaction, Strings, Market, Currency, Num, MarginModification, TradingFeeInterface, Dict, LeverageTier, MarginMode, Leverage } from './base/types.js';
3
3
  /**
4
4
  * @class kucoinfutures
5
5
  * @augments Exchange
@@ -87,4 +87,10 @@ export default class kucoinfutures extends kucoin {
87
87
  };
88
88
  closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
89
89
  fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
90
+ fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
91
+ parseMarginMode(marginMode: Dict, market?: any): MarginMode;
92
+ setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<MarginMode>;
93
+ fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
94
+ setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<Leverage>;
95
+ parseLeverage(leverage: Dict, market?: Market): Leverage;
90
96
  }