ccxt 4.1.56 → 4.1.58
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/.git-templates/hooks/pre-push +2 -2
- package/README.md +3 -3
- package/build.sh +30 -18
- package/dist/ccxt.browser.js +3893 -3214
- package/dist/ccxt.browser.min.js +10 -10
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +17 -13
- package/dist/cjs/src/alpaca.js +6 -6
- package/dist/cjs/src/ascendex.js +35 -29
- package/dist/cjs/src/base/Exchange.js +39 -26
- package/dist/cjs/src/base/Precise.js +1 -3
- package/dist/cjs/src/base/ws/Client.js +1 -1
- package/dist/cjs/src/bigone.js +24 -20
- package/dist/cjs/src/binance.js +97 -76
- package/dist/cjs/src/bingx.js +63 -44
- package/dist/cjs/src/bit2c.js +18 -15
- package/dist/cjs/src/bitbank.js +16 -15
- package/dist/cjs/src/bitbns.js +28 -18
- package/dist/cjs/src/bitfinex.js +23 -21
- package/dist/cjs/src/bitfinex2.js +32 -28
- package/dist/cjs/src/bitflyer.js +28 -20
- package/dist/cjs/src/bitforex.js +25 -18
- package/dist/cjs/src/bitget.js +184 -147
- package/dist/cjs/src/bithumb.js +23 -16
- package/dist/cjs/src/bitmart.js +110 -89
- package/dist/cjs/src/bitmex.js +104 -64
- package/dist/cjs/src/bitopro.js +38 -26
- package/dist/cjs/src/bitpanda.js +24 -23
- package/dist/cjs/src/bitrue.js +33 -24
- package/dist/cjs/src/bitso.js +24 -23
- package/dist/cjs/src/bitstamp.js +24 -23
- package/dist/cjs/src/bittrex.js +30 -29
- package/dist/cjs/src/bitvavo.js +38 -30
- package/dist/cjs/src/bl3p.js +11 -10
- package/dist/cjs/src/blockchaincom.js +20 -20
- package/dist/cjs/src/btcalpha.js +18 -17
- package/dist/cjs/src/btcbox.js +13 -12
- package/dist/cjs/src/btcmarkets.js +20 -19
- package/dist/cjs/src/btcturk.js +14 -13
- package/dist/cjs/src/bybit.js +84 -54
- package/dist/cjs/src/cex.js +16 -14
- package/dist/cjs/src/coinbase.js +29 -27
- package/dist/cjs/src/coinbasepro.js +27 -25
- package/dist/cjs/src/coincheck.js +15 -14
- package/dist/cjs/src/coinex.js +100 -77
- package/dist/cjs/src/coinlist.js +28 -27
- package/dist/cjs/src/coinmate.js +20 -17
- package/dist/cjs/src/coinone.js +21 -16
- package/dist/cjs/src/coinsph.js +37 -28
- package/dist/cjs/src/coinspot.js +12 -11
- package/dist/cjs/src/cryptocom.js +40 -202
- package/dist/cjs/src/currencycom.js +32 -25
- package/dist/cjs/src/delta.js +34 -28
- package/dist/cjs/src/deribit.js +39 -36
- package/dist/cjs/src/digifinex.js +64 -44
- package/dist/cjs/src/exmo.js +29 -27
- package/dist/cjs/src/gate.js +67 -53
- package/dist/cjs/src/gemini.js +23 -20
- package/dist/cjs/src/hitbtc.js +65 -56
- package/dist/cjs/src/hollaex.js +30 -27
- package/dist/cjs/src/htx.js +132 -143
- package/dist/cjs/src/huobijp.js +22 -20
- package/dist/cjs/src/idex.js +22 -21
- package/dist/cjs/src/independentreserve.js +15 -14
- package/dist/cjs/src/indodax.js +30 -26
- package/dist/cjs/src/kraken.js +29 -27
- package/dist/cjs/src/krakenfutures.js +29 -22
- package/dist/cjs/src/kucoin.js +48 -43
- package/dist/cjs/src/kucoinfutures.js +33 -28
- package/dist/cjs/src/kuna.js +25 -24
- package/dist/cjs/src/latoken.js +24 -22
- package/dist/cjs/src/lbank.js +45 -30
- package/dist/cjs/src/luno.js +22 -19
- package/dist/cjs/src/lykke.js +19 -17
- package/dist/cjs/src/mercado.js +30 -19
- package/dist/cjs/src/mexc.js +60 -49
- package/dist/cjs/src/ndax.js +23 -22
- package/dist/cjs/src/novadax.js +23 -22
- package/dist/cjs/src/oceanex.js +22 -19
- package/dist/cjs/src/okcoin.js +29 -23
- package/dist/cjs/src/okx.js +87 -82
- package/dist/cjs/src/p2b.js +79 -82
- package/dist/cjs/src/paymium.js +10 -10
- package/dist/cjs/src/phemex.js +63 -40
- package/dist/cjs/src/poloniex.js +22 -22
- package/dist/cjs/src/poloniexfutures.js +23 -19
- package/dist/cjs/src/pro/alpaca.js +5 -5
- package/dist/cjs/src/pro/ascendex.js +4 -4
- package/dist/cjs/src/pro/binance.js +16 -16
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitfinex.js +4 -4
- package/dist/cjs/src/pro/bitfinex2.js +6 -6
- package/dist/cjs/src/pro/bitget.js +7 -7
- package/dist/cjs/src/pro/bitmart.js +7 -5
- package/dist/cjs/src/pro/bitmex.js +6 -6
- package/dist/cjs/src/pro/bitopro.js +4 -4
- package/dist/cjs/src/pro/bitpanda.js +6 -6
- package/dist/cjs/src/pro/bitrue.js +2 -2
- package/dist/cjs/src/pro/bitstamp.js +6 -4
- package/dist/cjs/src/pro/bittrex.js +15 -6
- package/dist/cjs/src/pro/bitvavo.js +11 -7
- package/dist/cjs/src/pro/blockchaincom.js +8 -8
- package/dist/cjs/src/pro/bybit.js +7 -7
- package/dist/cjs/src/pro/cex.js +13 -9
- package/dist/cjs/src/pro/coinbase.js +5 -5
- package/dist/cjs/src/pro/coinbasepro.js +11 -10
- package/dist/cjs/src/pro/coinex.js +7 -9
- package/dist/cjs/src/pro/cryptocom.js +9 -9
- package/dist/cjs/src/pro/currencycom.js +4 -4
- package/dist/cjs/src/pro/deribit.js +6 -6
- package/dist/cjs/src/pro/exmo.js +12 -14
- package/dist/cjs/src/pro/gate.js +7 -7
- package/dist/cjs/src/pro/gemini.js +3 -3
- package/dist/cjs/src/pro/hitbtc.js +263 -4
- package/dist/cjs/src/pro/hollaex.js +5 -5
- package/dist/cjs/src/pro/htx.js +6 -6
- package/dist/cjs/src/pro/huobijp.js +3 -3
- package/dist/cjs/src/pro/idex.js +4 -4
- package/dist/cjs/src/pro/independentreserve.js +2 -2
- package/dist/cjs/src/pro/kraken.js +10 -10
- package/dist/cjs/src/pro/krakenfutures.js +41 -17
- package/dist/cjs/src/pro/kucoin.js +7 -7
- package/dist/cjs/src/pro/kucoinfutures.js +8 -6
- package/dist/cjs/src/pro/luno.js +2 -2
- package/dist/cjs/src/pro/mexc.js +6 -6
- package/dist/cjs/src/pro/ndax.js +3 -3
- package/dist/cjs/src/pro/okcoin.js +5 -5
- package/dist/cjs/src/pro/okx.js +12 -12
- package/dist/cjs/src/pro/phemex.js +6 -6
- package/dist/cjs/src/pro/poloniex.js +7 -7
- package/dist/cjs/src/pro/poloniexfutures.js +5 -5
- package/dist/cjs/src/pro/probit.js +6 -6
- package/dist/cjs/src/pro/upbit.js +3 -3
- package/dist/cjs/src/pro/wazirx.js +8 -8
- package/dist/cjs/src/pro/whitebit.js +12 -8
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/probit.js +28 -23
- package/dist/cjs/src/tidex.js +16 -15
- package/dist/cjs/src/timex.js +19 -18
- package/dist/cjs/src/tokocrypto.js +27 -22
- package/dist/cjs/src/upbit.js +19 -19
- package/dist/cjs/src/wavesexchange.js +22 -19
- package/dist/cjs/src/wazirx.js +24 -17
- package/dist/cjs/src/whitebit.js +33 -27
- package/dist/cjs/src/woo.js +44 -34
- package/dist/cjs/src/yobit.js +25 -20
- package/dist/cjs/src/zaif.js +9 -9
- package/dist/cjs/src/zonda.js +18 -17
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +0 -20
- package/js/src/ace.js +18 -14
- package/js/src/alpaca.js +6 -6
- package/js/src/ascendex.js +35 -29
- package/js/src/base/Exchange.d.ts +37 -34
- package/js/src/base/Exchange.js +39 -26
- package/js/src/base/Precise.d.ts +4 -4
- package/js/src/base/Precise.js +1 -3
- package/js/src/base/functions/type.d.ts +25 -25
- package/js/src/base/types.d.ts +21 -14
- package/js/src/base/ws/Client.js +1 -1
- package/js/src/bigone.js +25 -21
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +97 -76
- package/js/src/bingx.js +63 -44
- package/js/src/bit2c.js +19 -16
- package/js/src/bitbank.js +16 -15
- package/js/src/bitbns.js +28 -18
- package/js/src/bitfinex.js +23 -21
- package/js/src/bitfinex2.js +32 -28
- package/js/src/bitflyer.js +28 -20
- package/js/src/bitforex.js +26 -19
- package/js/src/bitget.d.ts +25 -3
- package/js/src/bitget.js +184 -147
- package/js/src/bithumb.js +23 -16
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +110 -89
- package/js/src/bitmex.d.ts +2 -2
- package/js/src/bitmex.js +104 -64
- package/js/src/bitopro.js +38 -26
- package/js/src/bitpanda.js +24 -23
- package/js/src/bitrue.js +33 -24
- package/js/src/bitso.js +24 -23
- package/js/src/bitstamp.d.ts +2 -2
- package/js/src/bitstamp.js +24 -23
- package/js/src/bittrex.js +30 -29
- package/js/src/bitvavo.js +38 -30
- package/js/src/bl3p.js +11 -10
- package/js/src/blockchaincom.js +20 -20
- package/js/src/btcalpha.js +18 -17
- package/js/src/btcbox.js +13 -12
- package/js/src/btcmarkets.js +20 -19
- package/js/src/btcturk.js +14 -13
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +84 -54
- package/js/src/cex.js +16 -14
- package/js/src/coinbase.js +29 -27
- package/js/src/coinbasepro.js +27 -25
- package/js/src/coincheck.js +15 -14
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +100 -77
- package/js/src/coinlist.js +28 -27
- package/js/src/coinmate.js +21 -18
- package/js/src/coinone.js +21 -16
- package/js/src/coinsph.js +37 -28
- package/js/src/coinspot.js +12 -11
- package/js/src/cryptocom.d.ts +0 -23
- package/js/src/cryptocom.js +40 -202
- package/js/src/currencycom.js +32 -25
- package/js/src/delta.js +35 -29
- package/js/src/deribit.js +39 -36
- package/js/src/digifinex.d.ts +2 -2
- package/js/src/digifinex.js +65 -45
- package/js/src/exmo.js +29 -27
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +67 -53
- package/js/src/gemini.js +23 -20
- package/js/src/hitbtc.d.ts +1 -0
- package/js/src/hitbtc.js +65 -56
- package/js/src/hollaex.js +30 -27
- package/js/src/htx.d.ts +11 -3
- package/js/src/htx.js +132 -143
- package/js/src/huobijp.js +23 -21
- package/js/src/idex.js +22 -21
- package/js/src/independentreserve.js +15 -14
- package/js/src/indodax.js +30 -26
- package/js/src/kraken.js +29 -27
- package/js/src/krakenfutures.js +29 -22
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +48 -43
- package/js/src/kucoinfutures.js +33 -28
- package/js/src/kuna.js +25 -24
- package/js/src/latoken.js +25 -23
- package/js/src/lbank.js +46 -31
- package/js/src/luno.js +22 -19
- package/js/src/lykke.js +19 -17
- package/js/src/mercado.js +30 -19
- package/js/src/mexc.d.ts +1 -1
- package/js/src/mexc.js +60 -49
- package/js/src/ndax.js +23 -22
- package/js/src/novadax.js +23 -22
- package/js/src/oceanex.js +22 -19
- package/js/src/okcoin.js +29 -23
- package/js/src/okx.d.ts +2 -2
- package/js/src/okx.js +87 -82
- package/js/src/p2b.d.ts +8 -7
- package/js/src/p2b.js +79 -81
- package/js/src/paymium.js +10 -10
- package/js/src/phemex.js +63 -40
- package/js/src/poloniex.js +22 -22
- package/js/src/poloniexfutures.js +23 -19
- package/js/src/pro/alpaca.js +5 -5
- package/js/src/pro/ascendex.js +4 -4
- package/js/src/pro/binance.js +16 -16
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitfinex.js +4 -4
- package/js/src/pro/bitfinex2.d.ts +1 -1
- package/js/src/pro/bitfinex2.js +6 -6
- package/js/src/pro/bitget.js +7 -7
- package/js/src/pro/bitmart.js +7 -5
- package/js/src/pro/bitmex.js +6 -6
- package/js/src/pro/bitopro.js +4 -4
- package/js/src/pro/bitpanda.js +6 -6
- package/js/src/pro/bitrue.js +2 -2
- package/js/src/pro/bitstamp.js +7 -5
- package/js/src/pro/bittrex.js +15 -6
- package/js/src/pro/bitvavo.js +12 -8
- package/js/src/pro/blockchaincom.js +8 -8
- package/js/src/pro/bybit.js +7 -7
- package/js/src/pro/cex.js +14 -10
- package/js/src/pro/coinbase.js +5 -5
- package/js/src/pro/coinbasepro.js +12 -11
- package/js/src/pro/coinex.js +7 -9
- package/js/src/pro/cryptocom.js +9 -9
- package/js/src/pro/currencycom.js +4 -4
- package/js/src/pro/deribit.js +6 -6
- package/js/src/pro/exmo.js +12 -14
- package/js/src/pro/gate.js +7 -7
- package/js/src/pro/gemini.js +3 -3
- package/js/src/pro/hitbtc.d.ts +8 -1
- package/js/src/pro/hitbtc.js +264 -5
- package/js/src/pro/hollaex.js +5 -5
- package/js/src/pro/htx.js +6 -6
- package/js/src/pro/huobijp.js +3 -3
- package/js/src/pro/idex.js +4 -4
- package/js/src/pro/independentreserve.js +2 -2
- package/js/src/pro/kraken.js +10 -10
- package/js/src/pro/krakenfutures.d.ts +1 -0
- package/js/src/pro/krakenfutures.js +42 -18
- package/js/src/pro/kucoin.js +7 -7
- package/js/src/pro/kucoinfutures.js +8 -6
- package/js/src/pro/luno.js +2 -2
- package/js/src/pro/mexc.js +6 -6
- package/js/src/pro/ndax.js +3 -3
- package/js/src/pro/okcoin.js +5 -5
- package/js/src/pro/okx.js +12 -12
- package/js/src/pro/phemex.js +6 -6
- package/js/src/pro/poloniex.js +7 -7
- package/js/src/pro/poloniexfutures.js +5 -5
- package/js/src/pro/probit.js +6 -6
- package/js/src/pro/upbit.js +3 -3
- package/js/src/pro/wazirx.js +8 -8
- package/js/src/pro/whitebit.js +13 -9
- package/js/src/pro/woo.js +1 -1
- package/js/src/probit.js +29 -24
- package/js/src/tidex.js +16 -15
- package/js/src/timex.js +19 -18
- package/js/src/tokocrypto.js +28 -23
- package/js/src/upbit.js +19 -19
- package/js/src/wavesexchange.js +23 -20
- package/js/src/wazirx.js +25 -18
- package/js/src/whitebit.js +33 -27
- package/js/src/woo.js +45 -35
- package/js/src/yobit.js +25 -20
- package/js/src/zaif.js +9 -9
- package/js/src/zonda.js +18 -17
- package/package.json +1 -1
package/dist/cjs/src/htx.js
CHANGED
|
@@ -47,14 +47,13 @@ class htx extends htx$1 {
|
|
|
47
47
|
'fetchBalance': true,
|
|
48
48
|
'fetchBidsAsks': undefined,
|
|
49
49
|
'fetchBorrowInterest': true,
|
|
50
|
-
'fetchBorrowRate': undefined,
|
|
51
50
|
'fetchBorrowRateHistories': undefined,
|
|
52
51
|
'fetchBorrowRateHistory': undefined,
|
|
53
|
-
'fetchBorrowRates': true,
|
|
54
|
-
'fetchBorrowRatesPerSymbol': true,
|
|
55
52
|
'fetchCanceledOrders': undefined,
|
|
56
53
|
'fetchClosedOrder': undefined,
|
|
57
54
|
'fetchClosedOrders': true,
|
|
55
|
+
'fetchCrossBorrowRate': false,
|
|
56
|
+
'fetchCrossBorrowRates': false,
|
|
58
57
|
'fetchCurrencies': true,
|
|
59
58
|
'fetchDeposit': undefined,
|
|
60
59
|
'fetchDepositAddress': true,
|
|
@@ -68,6 +67,8 @@ class htx extends htx$1 {
|
|
|
68
67
|
'fetchFundingRateHistory': true,
|
|
69
68
|
'fetchFundingRates': true,
|
|
70
69
|
'fetchIndexOHLCV': true,
|
|
70
|
+
'fetchIsolatedBorrowRate': false,
|
|
71
|
+
'fetchIsolatedBorrowRates': true,
|
|
71
72
|
'fetchL3OrderBook': undefined,
|
|
72
73
|
'fetchLedger': true,
|
|
73
74
|
'fetchLedgerEntry': undefined,
|
|
@@ -1485,7 +1486,7 @@ class htx extends htx$1 {
|
|
|
1485
1486
|
* @description fetch the trading fees for a market
|
|
1486
1487
|
* @param {string} symbol unified market symbol
|
|
1487
1488
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
1488
|
-
* @returns {object} a [fee structure]{@link https://
|
|
1489
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1489
1490
|
*/
|
|
1490
1491
|
await this.loadMarkets();
|
|
1491
1492
|
const market = this.market(symbol);
|
|
@@ -2025,7 +2026,7 @@ class htx extends htx$1 {
|
|
|
2025
2026
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2026
2027
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2027
2028
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2028
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
2029
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2029
2030
|
*/
|
|
2030
2031
|
await this.loadMarkets();
|
|
2031
2032
|
const market = this.market(symbol);
|
|
@@ -2108,7 +2109,7 @@ class htx extends htx$1 {
|
|
|
2108
2109
|
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-a-batch-of-market-data-overview-v2
|
|
2109
2110
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2110
2111
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2111
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
2112
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2112
2113
|
*/
|
|
2113
2114
|
await this.loadMarkets();
|
|
2114
2115
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2262,7 +2263,7 @@ class htx extends htx$1 {
|
|
|
2262
2263
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2263
2264
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2264
2265
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2265
|
-
* @returns {object} A dictionary of [order book structures]{@link https://
|
|
2266
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
2266
2267
|
*/
|
|
2267
2268
|
await this.loadMarkets();
|
|
2268
2269
|
const market = this.market(symbol);
|
|
@@ -2490,7 +2491,7 @@ class htx extends htx$1 {
|
|
|
2490
2491
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2491
2492
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
2492
2493
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2493
|
-
* @returns {object[]} a list of [trade structures]{@link https://
|
|
2494
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2494
2495
|
*/
|
|
2495
2496
|
let market = undefined;
|
|
2496
2497
|
if (symbol !== undefined) {
|
|
@@ -2525,7 +2526,7 @@ class htx extends htx$1 {
|
|
|
2525
2526
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2526
2527
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
2527
2528
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2528
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
2529
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2529
2530
|
*/
|
|
2530
2531
|
await this.loadMarkets();
|
|
2531
2532
|
let paginate = false;
|
|
@@ -2575,7 +2576,9 @@ class htx extends htx$1 {
|
|
|
2575
2576
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
2576
2577
|
}
|
|
2577
2578
|
else {
|
|
2578
|
-
|
|
2579
|
+
if (symbol === undefined) {
|
|
2580
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
2581
|
+
}
|
|
2579
2582
|
request['contract'] = market['id'];
|
|
2580
2583
|
request['trade_type'] = 0; // 0 all, 1 open long, 2 open short, 3 close short, 4 close long, 5 liquidate long positions, 6 liquidate short positions
|
|
2581
2584
|
if (since !== undefined) {
|
|
@@ -2696,7 +2699,7 @@ class htx extends htx$1 {
|
|
|
2696
2699
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2697
2700
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2698
2701
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2699
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
2702
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2700
2703
|
*/
|
|
2701
2704
|
await this.loadMarkets();
|
|
2702
2705
|
const market = this.market(symbol);
|
|
@@ -2943,7 +2946,7 @@ class htx extends htx$1 {
|
|
|
2943
2946
|
* @name huobi#fetchAccounts
|
|
2944
2947
|
* @description fetch all the accounts associated with a profile
|
|
2945
2948
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2946
|
-
* @returns {object} a dictionary of [account structures]{@link https://
|
|
2949
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
2947
2950
|
*/
|
|
2948
2951
|
await this.loadMarkets();
|
|
2949
2952
|
const response = await this.spotPrivateGetV1AccountAccounts(params);
|
|
@@ -3187,7 +3190,7 @@ class htx extends htx$1 {
|
|
|
3187
3190
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3188
3191
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3189
3192
|
* @param {bool} [params.unified] provide this parameter if you have a recent account with unified cross+isolated margin account
|
|
3190
|
-
* @returns {object} a [balance structure]{@link https://
|
|
3193
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3191
3194
|
*/
|
|
3192
3195
|
await this.loadMarkets();
|
|
3193
3196
|
let type = undefined;
|
|
@@ -3514,7 +3517,7 @@ class htx extends htx$1 {
|
|
|
3514
3517
|
* @description fetches information on an order made by the user
|
|
3515
3518
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3516
3519
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3517
|
-
* @returns {object} An [order structure]{@link https://
|
|
3520
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3518
3521
|
*/
|
|
3519
3522
|
await this.loadMarkets();
|
|
3520
3523
|
let market = undefined;
|
|
@@ -3551,7 +3554,9 @@ class htx extends htx$1 {
|
|
|
3551
3554
|
}
|
|
3552
3555
|
}
|
|
3553
3556
|
else {
|
|
3554
|
-
|
|
3557
|
+
if (symbol === undefined) {
|
|
3558
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3559
|
+
}
|
|
3555
3560
|
request['contract_code'] = market['id'];
|
|
3556
3561
|
if (market['linear']) {
|
|
3557
3562
|
let marginMode = undefined;
|
|
@@ -3736,7 +3741,9 @@ class htx extends htx$1 {
|
|
|
3736
3741
|
async fetchSpotOrdersByStates(states, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3737
3742
|
const method = this.safeString(this.options, 'fetchOrdersByStatesMethod', 'spot_private_get_v1_order_orders'); // spot_private_get_v1_order_history
|
|
3738
3743
|
if (method === 'spot_private_get_v1_order_orders') {
|
|
3739
|
-
|
|
3744
|
+
if (symbol === undefined) {
|
|
3745
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
3746
|
+
}
|
|
3740
3747
|
}
|
|
3741
3748
|
await this.loadMarkets();
|
|
3742
3749
|
let market = undefined;
|
|
@@ -3806,7 +3813,9 @@ class htx extends htx$1 {
|
|
|
3806
3813
|
return await this.fetchSpotOrdersByStates('filled,partial-canceled,canceled', symbol, since, limit, params);
|
|
3807
3814
|
}
|
|
3808
3815
|
async fetchContractOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3809
|
-
|
|
3816
|
+
if (symbol === undefined) {
|
|
3817
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchContractOrders() requires a symbol argument');
|
|
3818
|
+
}
|
|
3810
3819
|
await this.loadMarkets();
|
|
3811
3820
|
const market = this.market(symbol);
|
|
3812
3821
|
let request = {
|
|
@@ -4063,7 +4072,7 @@ class htx extends htx$1 {
|
|
|
4063
4072
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4064
4073
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4065
4074
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4066
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4075
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4067
4076
|
*/
|
|
4068
4077
|
await this.loadMarkets();
|
|
4069
4078
|
let market = undefined;
|
|
@@ -4100,7 +4109,7 @@ class htx extends htx$1 {
|
|
|
4100
4109
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4101
4110
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4102
4111
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4103
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4112
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4104
4113
|
*/
|
|
4105
4114
|
await this.loadMarkets();
|
|
4106
4115
|
let paginate = false;
|
|
@@ -4135,7 +4144,7 @@ class htx extends htx$1 {
|
|
|
4135
4144
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4136
4145
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4137
4146
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4138
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4147
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4139
4148
|
*/
|
|
4140
4149
|
await this.loadMarkets();
|
|
4141
4150
|
let market = undefined;
|
|
@@ -4173,7 +4182,9 @@ class htx extends htx$1 {
|
|
|
4173
4182
|
response = await this.spotPrivateGetV1OrderOpenOrders(this.extend(request, params));
|
|
4174
4183
|
}
|
|
4175
4184
|
else {
|
|
4176
|
-
|
|
4185
|
+
if (symbol === undefined) {
|
|
4186
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
4187
|
+
}
|
|
4177
4188
|
if (limit !== undefined) {
|
|
4178
4189
|
request['page_size'] = limit;
|
|
4179
4190
|
}
|
|
@@ -5060,7 +5071,7 @@ class htx extends htx$1 {
|
|
|
5060
5071
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
5061
5072
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
5062
5073
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
5063
|
-
* @returns {object} an [order structure]{@link https://
|
|
5074
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5064
5075
|
*/
|
|
5065
5076
|
await this.loadMarkets();
|
|
5066
5077
|
const market = this.market(symbol);
|
|
@@ -5208,7 +5219,7 @@ class htx extends htx$1 {
|
|
|
5208
5219
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders
|
|
5209
5220
|
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
5210
5221
|
* @param {object} [params] extra parameters specific to the htx api endpoint
|
|
5211
|
-
* @returns {object} an [order structure]{@link https://
|
|
5222
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5212
5223
|
*/
|
|
5213
5224
|
await this.loadMarkets();
|
|
5214
5225
|
const ordersRequests = [];
|
|
@@ -5342,7 +5353,7 @@ class htx extends htx$1 {
|
|
|
5342
5353
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5343
5354
|
* @param {bool} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
5344
5355
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5345
|
-
* @returns {object} An [order structure]{@link https://
|
|
5356
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5346
5357
|
*/
|
|
5347
5358
|
await this.loadMarkets();
|
|
5348
5359
|
let market = undefined;
|
|
@@ -5377,7 +5388,9 @@ class htx extends htx$1 {
|
|
|
5377
5388
|
}
|
|
5378
5389
|
}
|
|
5379
5390
|
else {
|
|
5380
|
-
|
|
5391
|
+
if (symbol === undefined) {
|
|
5392
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
5393
|
+
}
|
|
5381
5394
|
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5382
5395
|
if (clientOrderId === undefined) {
|
|
5383
5396
|
request['order_id'] = id;
|
|
@@ -5484,7 +5497,7 @@ class htx extends htx$1 {
|
|
|
5484
5497
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5485
5498
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5486
5499
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5487
|
-
* @returns {object} an list of [order structures]{@link https://
|
|
5500
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5488
5501
|
*/
|
|
5489
5502
|
await this.loadMarkets();
|
|
5490
5503
|
let market = undefined;
|
|
@@ -5527,7 +5540,9 @@ class htx extends htx$1 {
|
|
|
5527
5540
|
response = await this.spotPrivatePostV1OrderOrdersBatchcancel(this.extend(request, params));
|
|
5528
5541
|
}
|
|
5529
5542
|
else {
|
|
5530
|
-
|
|
5543
|
+
if (symbol === undefined) {
|
|
5544
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
5545
|
+
}
|
|
5531
5546
|
let clientOrderIds = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5532
5547
|
clientOrderIds = this.safeString2(params, 'client_order_ids', 'clientOrderIds', clientOrderIds);
|
|
5533
5548
|
if (clientOrderIds === undefined) {
|
|
@@ -5663,7 +5678,7 @@ class htx extends htx$1 {
|
|
|
5663
5678
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5664
5679
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5665
5680
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5666
|
-
* @returns {object[]} a list of [order structures]{@link https://
|
|
5681
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5667
5682
|
*/
|
|
5668
5683
|
await this.loadMarkets();
|
|
5669
5684
|
let market = undefined;
|
|
@@ -5694,7 +5709,9 @@ class htx extends htx$1 {
|
|
|
5694
5709
|
response = await this.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(this.extend(request, params));
|
|
5695
5710
|
}
|
|
5696
5711
|
else {
|
|
5697
|
-
|
|
5712
|
+
if (symbol === undefined) {
|
|
5713
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
5714
|
+
}
|
|
5698
5715
|
if (market['future']) {
|
|
5699
5716
|
request['symbol'] = market['settleId'];
|
|
5700
5717
|
}
|
|
@@ -5815,7 +5832,7 @@ class htx extends htx$1 {
|
|
|
5815
5832
|
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
5816
5833
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
5817
5834
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5818
|
-
* @returns {object} a dictionary of [address structures]{@link https://
|
|
5835
|
+
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
5819
5836
|
*/
|
|
5820
5837
|
await this.loadMarkets();
|
|
5821
5838
|
const currency = this.currency(code);
|
|
@@ -5847,7 +5864,7 @@ class htx extends htx$1 {
|
|
|
5847
5864
|
* @description fetch the deposit address for a currency associated with this account
|
|
5848
5865
|
* @param {string} code unified currency code
|
|
5849
5866
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5850
|
-
* @returns {object} an [address structure]{@link https://
|
|
5867
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
5851
5868
|
*/
|
|
5852
5869
|
await this.loadMarkets();
|
|
5853
5870
|
const currency = this.currency(code);
|
|
@@ -5899,7 +5916,7 @@ class htx extends htx$1 {
|
|
|
5899
5916
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5900
5917
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5901
5918
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5902
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
5919
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5903
5920
|
*/
|
|
5904
5921
|
if (limit === undefined || limit > 100) {
|
|
5905
5922
|
limit = 100;
|
|
@@ -5958,7 +5975,7 @@ class htx extends htx$1 {
|
|
|
5958
5975
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5959
5976
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5960
5977
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5961
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
5978
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5962
5979
|
*/
|
|
5963
5980
|
if (limit === undefined || limit > 100) {
|
|
5964
5981
|
limit = 100;
|
|
@@ -6134,7 +6151,7 @@ class htx extends htx$1 {
|
|
|
6134
6151
|
* @param {string} address the address to withdraw to
|
|
6135
6152
|
* @param {string} tag
|
|
6136
6153
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6137
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
6154
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
6138
6155
|
*/
|
|
6139
6156
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
6140
6157
|
await this.loadMarkets();
|
|
@@ -6226,7 +6243,7 @@ class htx extends htx$1 {
|
|
|
6226
6243
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6227
6244
|
* @param {string} [params.symbol] used for isolated margin transfer
|
|
6228
6245
|
* @param {string} [params.subType] 'linear' or 'inverse', only used when transfering to/from swap accounts
|
|
6229
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
6246
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6230
6247
|
*/
|
|
6231
6248
|
await this.loadMarkets();
|
|
6232
6249
|
const currency = this.currency(code);
|
|
@@ -6304,82 +6321,17 @@ class htx extends htx$1 {
|
|
|
6304
6321
|
//
|
|
6305
6322
|
return this.parseTransfer(response, currency);
|
|
6306
6323
|
}
|
|
6307
|
-
async
|
|
6324
|
+
async fetchIsolatedBorrowRates(params = {}) {
|
|
6308
6325
|
/**
|
|
6309
6326
|
* @method
|
|
6310
|
-
* @name
|
|
6311
|
-
* @description fetch borrow rates for currencies within individual markets
|
|
6312
|
-
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6313
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} indexed by market symbol
|
|
6314
|
-
*/
|
|
6315
|
-
await this.loadMarkets();
|
|
6316
|
-
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6317
|
-
//
|
|
6318
|
-
// {
|
|
6319
|
-
// "status": "ok",
|
|
6320
|
-
// "data": [
|
|
6321
|
-
// {
|
|
6322
|
-
// "symbol": "1inchusdt",
|
|
6323
|
-
// "currencies": [
|
|
6324
|
-
// {
|
|
6325
|
-
// "currency": "1inch",
|
|
6326
|
-
// "interest-rate": "0.00098",
|
|
6327
|
-
// "min-loan-amt": "90.000000000000000000",
|
|
6328
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6329
|
-
// "loanable-amt": "0.0",
|
|
6330
|
-
// "actual-rate": "0.00098"
|
|
6331
|
-
// },
|
|
6332
|
-
// {
|
|
6333
|
-
// "currency": "usdt",
|
|
6334
|
-
// "interest-rate": "0.00098",
|
|
6335
|
-
// "min-loan-amt": "100.000000000000000000",
|
|
6336
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6337
|
-
// "loanable-amt": "0.0",
|
|
6338
|
-
// "actual-rate": "0.00098"
|
|
6339
|
-
// }
|
|
6340
|
-
// ]
|
|
6341
|
-
// },
|
|
6342
|
-
// ...
|
|
6343
|
-
// ]
|
|
6344
|
-
// }
|
|
6345
|
-
//
|
|
6346
|
-
const timestamp = this.milliseconds();
|
|
6347
|
-
const data = this.safeValue(response, 'data', []);
|
|
6348
|
-
const rates = {
|
|
6349
|
-
'info': response,
|
|
6350
|
-
};
|
|
6351
|
-
for (let i = 0; i < data.length; i++) {
|
|
6352
|
-
const rate = data[i];
|
|
6353
|
-
const currencies = this.safeValue(rate, 'currencies', []);
|
|
6354
|
-
const symbolRates = {};
|
|
6355
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6356
|
-
const currency = currencies[j];
|
|
6357
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6358
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6359
|
-
symbolRates[code] = {
|
|
6360
|
-
'currency': code,
|
|
6361
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6362
|
-
'span': 86400000,
|
|
6363
|
-
'timestamp': timestamp,
|
|
6364
|
-
'datetime': this.iso8601(timestamp),
|
|
6365
|
-
};
|
|
6366
|
-
}
|
|
6367
|
-
const marketId = this.safeString(rate, 'symbol');
|
|
6368
|
-
const symbol = this.safeSymbol(marketId);
|
|
6369
|
-
rates[symbol] = symbolRates;
|
|
6370
|
-
}
|
|
6371
|
-
return rates;
|
|
6372
|
-
}
|
|
6373
|
-
async fetchBorrowRates(params = {}) {
|
|
6374
|
-
/**
|
|
6375
|
-
* @method
|
|
6376
|
-
* @name huobi#fetchBorrowRates
|
|
6327
|
+
* @name htx#fetchIsolatedBorrowRates
|
|
6377
6328
|
* @description fetch the borrow interest rates of all currencies
|
|
6378
|
-
* @param {object} [params] extra parameters specific to the
|
|
6379
|
-
* @returns {object} a list of [borrow rate structures]{@link https://
|
|
6329
|
+
* @param {object} [params] extra parameters specific to the htx api endpoint
|
|
6330
|
+
* @returns {object} a list of [isolated borrow rate structures]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
|
|
6380
6331
|
*/
|
|
6381
6332
|
await this.loadMarkets();
|
|
6382
6333
|
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6334
|
+
//
|
|
6383
6335
|
// {
|
|
6384
6336
|
// "status": "ok",
|
|
6385
6337
|
// "data": [
|
|
@@ -6407,28 +6359,57 @@ class htx extends htx$1 {
|
|
|
6407
6359
|
// ...
|
|
6408
6360
|
// ]
|
|
6409
6361
|
// }
|
|
6410
|
-
|
|
6362
|
+
//
|
|
6411
6363
|
const data = this.safeValue(response, 'data', []);
|
|
6412
|
-
const rates =
|
|
6364
|
+
const rates = [];
|
|
6413
6365
|
for (let i = 0; i < data.length; i++) {
|
|
6414
|
-
|
|
6415
|
-
const currencies = this.safeValue(market, 'currencies', []);
|
|
6416
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6417
|
-
const currency = currencies[j];
|
|
6418
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6419
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6420
|
-
rates[code] = {
|
|
6421
|
-
'currency': code,
|
|
6422
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6423
|
-
'span': 86400000,
|
|
6424
|
-
'timestamp': timestamp,
|
|
6425
|
-
'datetime': this.iso8601(timestamp),
|
|
6426
|
-
'info': undefined,
|
|
6427
|
-
};
|
|
6428
|
-
}
|
|
6366
|
+
rates.push(this.parseIsolatedBorrowRate(data[i]));
|
|
6429
6367
|
}
|
|
6430
6368
|
return rates;
|
|
6431
6369
|
}
|
|
6370
|
+
parseIsolatedBorrowRate(info, market = undefined) {
|
|
6371
|
+
//
|
|
6372
|
+
// {
|
|
6373
|
+
// "symbol": "1inchusdt",
|
|
6374
|
+
// "currencies": [
|
|
6375
|
+
// {
|
|
6376
|
+
// "currency": "1inch",
|
|
6377
|
+
// "interest-rate": "0.00098",
|
|
6378
|
+
// "min-loan-amt": "90.000000000000000000",
|
|
6379
|
+
// "max-loan-amt": "1000.000000000000000000",
|
|
6380
|
+
// "loanable-amt": "0.0",
|
|
6381
|
+
// "actual-rate": "0.00098"
|
|
6382
|
+
// },
|
|
6383
|
+
// {
|
|
6384
|
+
// "currency": "usdt",
|
|
6385
|
+
// "interest-rate": "0.00098",
|
|
6386
|
+
// "min-loan-amt": "100.000000000000000000",
|
|
6387
|
+
// "max-loan-amt": "1000.000000000000000000",
|
|
6388
|
+
// "loanable-amt": "0.0",
|
|
6389
|
+
// "actual-rate": "0.00098"
|
|
6390
|
+
// }
|
|
6391
|
+
// ]
|
|
6392
|
+
// },
|
|
6393
|
+
//
|
|
6394
|
+
const marketId = this.safeString(info, 'symbol');
|
|
6395
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
6396
|
+
const currencies = this.safeValue(info, 'currencies', []);
|
|
6397
|
+
const baseData = this.safeValue(currencies, 0);
|
|
6398
|
+
const quoteData = this.safeValue(currencies, 1);
|
|
6399
|
+
const baseId = this.safeString(baseData, 'currency');
|
|
6400
|
+
const quoteId = this.safeString(quoteData, 'currency');
|
|
6401
|
+
return {
|
|
6402
|
+
'symbol': symbol,
|
|
6403
|
+
'base': this.safeCurrencyCode(baseId),
|
|
6404
|
+
'baseRate': this.safeNumber(baseData, 'actual-rate'),
|
|
6405
|
+
'quote': this.safeCurrencyCode(quoteId),
|
|
6406
|
+
'quoteRate': this.safeNumber(quoteData, 'actual-rate'),
|
|
6407
|
+
'period': 86400000,
|
|
6408
|
+
'timestamp': undefined,
|
|
6409
|
+
'datetime': undefined,
|
|
6410
|
+
'info': info,
|
|
6411
|
+
};
|
|
6412
|
+
}
|
|
6432
6413
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6433
6414
|
/**
|
|
6434
6415
|
* @method
|
|
@@ -6440,9 +6421,11 @@ class htx extends htx$1 {
|
|
|
6440
6421
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
6441
6422
|
* @param {int} [limit] not used by huobi, but filtered internally by ccxt
|
|
6442
6423
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6443
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://
|
|
6424
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
6444
6425
|
*/
|
|
6445
|
-
|
|
6426
|
+
if (symbol === undefined) {
|
|
6427
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
6428
|
+
}
|
|
6446
6429
|
let paginate = false;
|
|
6447
6430
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
6448
6431
|
if (paginate) {
|
|
@@ -6555,7 +6538,7 @@ class htx extends htx$1 {
|
|
|
6555
6538
|
* @description fetch the current funding rate
|
|
6556
6539
|
* @param {string} symbol unified market symbol
|
|
6557
6540
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6558
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
6541
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6559
6542
|
*/
|
|
6560
6543
|
await this.loadMarkets();
|
|
6561
6544
|
const market = this.market(symbol);
|
|
@@ -6598,7 +6581,7 @@ class htx extends htx$1 {
|
|
|
6598
6581
|
* @description fetch the funding rate for multiple markets
|
|
6599
6582
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
6600
6583
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6601
|
-
* @returns {object} a dictionary of [funding rates structures]{@link https://
|
|
6584
|
+
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
6602
6585
|
*/
|
|
6603
6586
|
await this.loadMarkets();
|
|
6604
6587
|
symbols = this.marketSymbols(symbols);
|
|
@@ -6647,7 +6630,7 @@ class htx extends htx$1 {
|
|
|
6647
6630
|
* @param {int} [since] the earliest time in ms to fetch borrrow interest for
|
|
6648
6631
|
* @param {int} [limit] the maximum number of structures to retrieve
|
|
6649
6632
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6650
|
-
* @returns {object[]} a list of [borrow interest structures]{@link https://
|
|
6633
|
+
* @returns {object[]} a list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
6651
6634
|
*/
|
|
6652
6635
|
await this.loadMarkets();
|
|
6653
6636
|
let marginMode = undefined;
|
|
@@ -6934,7 +6917,7 @@ class htx extends htx$1 {
|
|
|
6934
6917
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6935
6918
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6936
6919
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6937
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
6920
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6938
6921
|
*/
|
|
6939
6922
|
await this.loadMarkets();
|
|
6940
6923
|
const market = this.market(symbol);
|
|
@@ -7024,7 +7007,9 @@ class htx extends htx$1 {
|
|
|
7024
7007
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7025
7008
|
* @returns {object} response from the exchange
|
|
7026
7009
|
*/
|
|
7027
|
-
|
|
7010
|
+
if (symbol === undefined) {
|
|
7011
|
+
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
7012
|
+
}
|
|
7028
7013
|
await this.loadMarkets();
|
|
7029
7014
|
const market = this.market(symbol);
|
|
7030
7015
|
const [marketType, query] = this.handleMarketTypeAndParams('setLeverage', market, params);
|
|
@@ -7210,7 +7195,7 @@ class htx extends htx$1 {
|
|
|
7210
7195
|
* @description fetch all open positions
|
|
7211
7196
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7212
7197
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7213
|
-
* @returns {object[]} a list of [position structure]{@link https://
|
|
7198
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7214
7199
|
*/
|
|
7215
7200
|
await this.loadMarkets();
|
|
7216
7201
|
symbols = this.marketSymbols(symbols);
|
|
@@ -7339,7 +7324,7 @@ class htx extends htx$1 {
|
|
|
7339
7324
|
* @description fetch data on a single open contract trade position
|
|
7340
7325
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
7341
7326
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7342
|
-
* @returns {object} a [position structure]{@link https://
|
|
7327
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7343
7328
|
*/
|
|
7344
7329
|
await this.loadMarkets();
|
|
7345
7330
|
const market = this.market(symbol);
|
|
@@ -7659,7 +7644,7 @@ class htx extends htx$1 {
|
|
|
7659
7644
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7660
7645
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
7661
7646
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
7662
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
7647
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
7663
7648
|
*/
|
|
7664
7649
|
await this.loadMarkets();
|
|
7665
7650
|
let paginate = false;
|
|
@@ -7733,7 +7718,7 @@ class htx extends htx$1 {
|
|
|
7733
7718
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
7734
7719
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7735
7720
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7736
|
-
* @returns {object} a dictionary of [leverage tiers structures]{@link https://
|
|
7721
|
+
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
7737
7722
|
*/
|
|
7738
7723
|
await this.loadMarkets();
|
|
7739
7724
|
const response = await this.contractPublicGetLinearSwapApiV1SwapAdjustfactor(params);
|
|
@@ -7776,7 +7761,7 @@ class htx extends htx$1 {
|
|
|
7776
7761
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
7777
7762
|
* @param {string} symbol unified market symbol
|
|
7778
7763
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7779
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
7764
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
7780
7765
|
*/
|
|
7781
7766
|
await this.loadMarkets();
|
|
7782
7767
|
const request = {};
|
|
@@ -7869,7 +7854,7 @@ class htx extends htx$1 {
|
|
|
7869
7854
|
* @param {object} [params] Exchange specific parameters
|
|
7870
7855
|
* @param {int} [params.amount_type] *required* Open interest unit. 1-cont,2-cryptocurrency
|
|
7871
7856
|
* @param {int} [params.pair] eg BTC-USDT *Only for USDT-M*
|
|
7872
|
-
* @returns {object} an array of [open interest structures]{@link https://
|
|
7857
|
+
* @returns {object} an array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7873
7858
|
*/
|
|
7874
7859
|
if (timeframe !== '1h' && timeframe !== '4h' && timeframe !== '12h' && timeframe !== '1d') {
|
|
7875
7860
|
throw new errors.BadRequest(this.id + ' fetchOpenInterestHistory cannot only use the 1h, 4h, 12h and 1d timeframe');
|
|
@@ -7981,7 +7966,7 @@ class htx extends htx$1 {
|
|
|
7981
7966
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-swap-open-interest-information
|
|
7982
7967
|
* @param {string} symbol Unified CCXT market symbol
|
|
7983
7968
|
* @param {object} [params] exchange specific parameters
|
|
7984
|
-
* @returns {object} an open interest structure{@link https://
|
|
7969
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7985
7970
|
*/
|
|
7986
7971
|
await this.loadMarkets();
|
|
7987
7972
|
const market = this.market(symbol);
|
|
@@ -8154,7 +8139,7 @@ class htx extends htx$1 {
|
|
|
8154
8139
|
* @param {float} amount the amount to borrow
|
|
8155
8140
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8156
8141
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8157
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8142
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8158
8143
|
*/
|
|
8159
8144
|
await this.loadMarkets();
|
|
8160
8145
|
const currency = this.currency(code);
|
|
@@ -8167,7 +8152,9 @@ class htx extends htx$1 {
|
|
|
8167
8152
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
8168
8153
|
let method = undefined;
|
|
8169
8154
|
if (marginMode === 'isolated') {
|
|
8170
|
-
|
|
8155
|
+
if (symbol === undefined) {
|
|
8156
|
+
throw new errors.ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
|
|
8157
|
+
}
|
|
8171
8158
|
const market = this.market(symbol);
|
|
8172
8159
|
request['symbol'] = market['id'];
|
|
8173
8160
|
method = 'privatePostMarginOrders';
|
|
@@ -8206,7 +8193,7 @@ class htx extends htx$1 {
|
|
|
8206
8193
|
* @param {float} amount the amount to repay
|
|
8207
8194
|
* @param {string} symbol unified market symbol
|
|
8208
8195
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8209
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8196
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8210
8197
|
*/
|
|
8211
8198
|
await this.loadMarkets();
|
|
8212
8199
|
const currency = this.currency(code);
|
|
@@ -8286,9 +8273,11 @@ class htx extends htx$1 {
|
|
|
8286
8273
|
* @param {int} [params.until] timestamp in ms, value range = start_time -> current time,default = current time
|
|
8287
8274
|
* @param {int} [params.page_index] page index, default page 1 if not filled
|
|
8288
8275
|
* @param {int} [params.code] unified currency code, can be used when symbol is undefined
|
|
8289
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://
|
|
8276
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
8290
8277
|
*/
|
|
8291
|
-
|
|
8278
|
+
if (symbol === undefined) {
|
|
8279
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
8280
|
+
}
|
|
8292
8281
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
8293
8282
|
params = this.omit(params, ['until', 'till']);
|
|
8294
8283
|
const market = this.market(symbol);
|
|
@@ -8383,7 +8372,7 @@ class htx extends htx$1 {
|
|
|
8383
8372
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-currencies-v2
|
|
8384
8373
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
8385
8374
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8386
|
-
* @returns {object[]} a list of [fees structures]{@link https://
|
|
8375
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
8387
8376
|
*/
|
|
8388
8377
|
await this.loadMarkets();
|
|
8389
8378
|
const response = await this.spotPublicGetV2ReferenceCurrencies(params);
|
|
@@ -8599,7 +8588,7 @@ class htx extends htx$1 {
|
|
|
8599
8588
|
* @param {object} [params] exchange specific parameters for the huobi api endpoint
|
|
8600
8589
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
8601
8590
|
* @param {int} [params.tradeType] default 0, linear swap 0: all liquidated orders, 5: liquidated longs; 6: liquidated shorts, inverse swap and future 0: filled liquidated orders, 5: liquidated close orders, 6: liquidated open orders
|
|
8602
|
-
* @returns {object} an array of [liquidation structures]{@link https://
|
|
8591
|
+
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
8603
8592
|
*/
|
|
8604
8593
|
await this.loadMarkets();
|
|
8605
8594
|
const market = this.market(symbol);
|