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