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/js/src/htx.js
CHANGED
|
@@ -50,14 +50,13 @@ export default class htx extends Exchange {
|
|
|
50
50
|
'fetchBalance': true,
|
|
51
51
|
'fetchBidsAsks': undefined,
|
|
52
52
|
'fetchBorrowInterest': true,
|
|
53
|
-
'fetchBorrowRate': undefined,
|
|
54
53
|
'fetchBorrowRateHistories': undefined,
|
|
55
54
|
'fetchBorrowRateHistory': undefined,
|
|
56
|
-
'fetchBorrowRates': true,
|
|
57
|
-
'fetchBorrowRatesPerSymbol': true,
|
|
58
55
|
'fetchCanceledOrders': undefined,
|
|
59
56
|
'fetchClosedOrder': undefined,
|
|
60
57
|
'fetchClosedOrders': true,
|
|
58
|
+
'fetchCrossBorrowRate': false,
|
|
59
|
+
'fetchCrossBorrowRates': false,
|
|
61
60
|
'fetchCurrencies': true,
|
|
62
61
|
'fetchDeposit': undefined,
|
|
63
62
|
'fetchDepositAddress': true,
|
|
@@ -71,6 +70,8 @@ export default class htx extends Exchange {
|
|
|
71
70
|
'fetchFundingRateHistory': true,
|
|
72
71
|
'fetchFundingRates': true,
|
|
73
72
|
'fetchIndexOHLCV': true,
|
|
73
|
+
'fetchIsolatedBorrowRate': false,
|
|
74
|
+
'fetchIsolatedBorrowRates': true,
|
|
74
75
|
'fetchL3OrderBook': undefined,
|
|
75
76
|
'fetchLedger': true,
|
|
76
77
|
'fetchLedgerEntry': undefined,
|
|
@@ -1488,7 +1489,7 @@ export default class htx extends Exchange {
|
|
|
1488
1489
|
* @description fetch the trading fees for a market
|
|
1489
1490
|
* @param {string} symbol unified market symbol
|
|
1490
1491
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
1491
|
-
* @returns {object} a [fee structure]{@link https://
|
|
1492
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1492
1493
|
*/
|
|
1493
1494
|
await this.loadMarkets();
|
|
1494
1495
|
const market = this.market(symbol);
|
|
@@ -2028,7 +2029,7 @@ export default class htx extends Exchange {
|
|
|
2028
2029
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2029
2030
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2030
2031
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2031
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
2032
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2032
2033
|
*/
|
|
2033
2034
|
await this.loadMarkets();
|
|
2034
2035
|
const market = this.market(symbol);
|
|
@@ -2111,7 +2112,7 @@ export default class htx extends Exchange {
|
|
|
2111
2112
|
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-a-batch-of-market-data-overview-v2
|
|
2112
2113
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2113
2114
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2114
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
2115
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2115
2116
|
*/
|
|
2116
2117
|
await this.loadMarkets();
|
|
2117
2118
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2265,7 +2266,7 @@ export default class htx extends Exchange {
|
|
|
2265
2266
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2266
2267
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2267
2268
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2268
|
-
* @returns {object} A dictionary of [order book structures]{@link https://
|
|
2269
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
2269
2270
|
*/
|
|
2270
2271
|
await this.loadMarkets();
|
|
2271
2272
|
const market = this.market(symbol);
|
|
@@ -2493,7 +2494,7 @@ export default class htx extends Exchange {
|
|
|
2493
2494
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2494
2495
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
2495
2496
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2496
|
-
* @returns {object[]} a list of [trade structures]{@link https://
|
|
2497
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2497
2498
|
*/
|
|
2498
2499
|
let market = undefined;
|
|
2499
2500
|
if (symbol !== undefined) {
|
|
@@ -2528,7 +2529,7 @@ export default class htx extends Exchange {
|
|
|
2528
2529
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2529
2530
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
2530
2531
|
* @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)
|
|
2531
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
2532
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2532
2533
|
*/
|
|
2533
2534
|
await this.loadMarkets();
|
|
2534
2535
|
let paginate = false;
|
|
@@ -2578,7 +2579,9 @@ export default class htx extends Exchange {
|
|
|
2578
2579
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
2579
2580
|
}
|
|
2580
2581
|
else {
|
|
2581
|
-
|
|
2582
|
+
if (symbol === undefined) {
|
|
2583
|
+
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
2584
|
+
}
|
|
2582
2585
|
request['contract'] = market['id'];
|
|
2583
2586
|
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
|
|
2584
2587
|
if (since !== undefined) {
|
|
@@ -2699,7 +2702,7 @@ export default class htx extends Exchange {
|
|
|
2699
2702
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2700
2703
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2701
2704
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2702
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
2705
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2703
2706
|
*/
|
|
2704
2707
|
await this.loadMarkets();
|
|
2705
2708
|
const market = this.market(symbol);
|
|
@@ -2946,7 +2949,7 @@ export default class htx extends Exchange {
|
|
|
2946
2949
|
* @name huobi#fetchAccounts
|
|
2947
2950
|
* @description fetch all the accounts associated with a profile
|
|
2948
2951
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2949
|
-
* @returns {object} a dictionary of [account structures]{@link https://
|
|
2952
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
2950
2953
|
*/
|
|
2951
2954
|
await this.loadMarkets();
|
|
2952
2955
|
const response = await this.spotPrivateGetV1AccountAccounts(params);
|
|
@@ -3190,7 +3193,7 @@ export default class htx extends Exchange {
|
|
|
3190
3193
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3191
3194
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3192
3195
|
* @param {bool} [params.unified] provide this parameter if you have a recent account with unified cross+isolated margin account
|
|
3193
|
-
* @returns {object} a [balance structure]{@link https://
|
|
3196
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3194
3197
|
*/
|
|
3195
3198
|
await this.loadMarkets();
|
|
3196
3199
|
let type = undefined;
|
|
@@ -3517,7 +3520,7 @@ export default class htx extends Exchange {
|
|
|
3517
3520
|
* @description fetches information on an order made by the user
|
|
3518
3521
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3519
3522
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3520
|
-
* @returns {object} An [order structure]{@link https://
|
|
3523
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3521
3524
|
*/
|
|
3522
3525
|
await this.loadMarkets();
|
|
3523
3526
|
let market = undefined;
|
|
@@ -3554,7 +3557,9 @@ export default class htx extends Exchange {
|
|
|
3554
3557
|
}
|
|
3555
3558
|
}
|
|
3556
3559
|
else {
|
|
3557
|
-
|
|
3560
|
+
if (symbol === undefined) {
|
|
3561
|
+
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3562
|
+
}
|
|
3558
3563
|
request['contract_code'] = market['id'];
|
|
3559
3564
|
if (market['linear']) {
|
|
3560
3565
|
let marginMode = undefined;
|
|
@@ -3739,7 +3744,9 @@ export default class htx extends Exchange {
|
|
|
3739
3744
|
async fetchSpotOrdersByStates(states, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3740
3745
|
const method = this.safeString(this.options, 'fetchOrdersByStatesMethod', 'spot_private_get_v1_order_orders'); // spot_private_get_v1_order_history
|
|
3741
3746
|
if (method === 'spot_private_get_v1_order_orders') {
|
|
3742
|
-
|
|
3747
|
+
if (symbol === undefined) {
|
|
3748
|
+
throw new ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
3749
|
+
}
|
|
3743
3750
|
}
|
|
3744
3751
|
await this.loadMarkets();
|
|
3745
3752
|
let market = undefined;
|
|
@@ -3809,7 +3816,9 @@ export default class htx extends Exchange {
|
|
|
3809
3816
|
return await this.fetchSpotOrdersByStates('filled,partial-canceled,canceled', symbol, since, limit, params);
|
|
3810
3817
|
}
|
|
3811
3818
|
async fetchContractOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3812
|
-
|
|
3819
|
+
if (symbol === undefined) {
|
|
3820
|
+
throw new ArgumentsRequired(this.id + ' fetchContractOrders() requires a symbol argument');
|
|
3821
|
+
}
|
|
3813
3822
|
await this.loadMarkets();
|
|
3814
3823
|
const market = this.market(symbol);
|
|
3815
3824
|
let request = {
|
|
@@ -4066,7 +4075,7 @@ export default class htx extends Exchange {
|
|
|
4066
4075
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4067
4076
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4068
4077
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4069
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4078
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4070
4079
|
*/
|
|
4071
4080
|
await this.loadMarkets();
|
|
4072
4081
|
let market = undefined;
|
|
@@ -4103,7 +4112,7 @@ export default class htx extends Exchange {
|
|
|
4103
4112
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4104
4113
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4105
4114
|
* @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)
|
|
4106
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4115
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4107
4116
|
*/
|
|
4108
4117
|
await this.loadMarkets();
|
|
4109
4118
|
let paginate = false;
|
|
@@ -4138,7 +4147,7 @@ export default class htx extends Exchange {
|
|
|
4138
4147
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4139
4148
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4140
4149
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4141
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4150
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4142
4151
|
*/
|
|
4143
4152
|
await this.loadMarkets();
|
|
4144
4153
|
let market = undefined;
|
|
@@ -4176,7 +4185,9 @@ export default class htx extends Exchange {
|
|
|
4176
4185
|
response = await this.spotPrivateGetV1OrderOpenOrders(this.extend(request, params));
|
|
4177
4186
|
}
|
|
4178
4187
|
else {
|
|
4179
|
-
|
|
4188
|
+
if (symbol === undefined) {
|
|
4189
|
+
throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
4190
|
+
}
|
|
4180
4191
|
if (limit !== undefined) {
|
|
4181
4192
|
request['page_size'] = limit;
|
|
4182
4193
|
}
|
|
@@ -5063,7 +5074,7 @@ export default class htx extends Exchange {
|
|
|
5063
5074
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
5064
5075
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
5065
5076
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
5066
|
-
* @returns {object} an [order structure]{@link https://
|
|
5077
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5067
5078
|
*/
|
|
5068
5079
|
await this.loadMarkets();
|
|
5069
5080
|
const market = this.market(symbol);
|
|
@@ -5211,7 +5222,7 @@ export default class htx extends Exchange {
|
|
|
5211
5222
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders
|
|
5212
5223
|
* @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
|
|
5213
5224
|
* @param {object} [params] extra parameters specific to the htx api endpoint
|
|
5214
|
-
* @returns {object} an [order structure]{@link https://
|
|
5225
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5215
5226
|
*/
|
|
5216
5227
|
await this.loadMarkets();
|
|
5217
5228
|
const ordersRequests = [];
|
|
@@ -5345,7 +5356,7 @@ export default class htx extends Exchange {
|
|
|
5345
5356
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5346
5357
|
* @param {bool} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
5347
5358
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5348
|
-
* @returns {object} An [order structure]{@link https://
|
|
5359
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5349
5360
|
*/
|
|
5350
5361
|
await this.loadMarkets();
|
|
5351
5362
|
let market = undefined;
|
|
@@ -5380,7 +5391,9 @@ export default class htx extends Exchange {
|
|
|
5380
5391
|
}
|
|
5381
5392
|
}
|
|
5382
5393
|
else {
|
|
5383
|
-
|
|
5394
|
+
if (symbol === undefined) {
|
|
5395
|
+
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
5396
|
+
}
|
|
5384
5397
|
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5385
5398
|
if (clientOrderId === undefined) {
|
|
5386
5399
|
request['order_id'] = id;
|
|
@@ -5487,7 +5500,7 @@ export default class htx extends Exchange {
|
|
|
5487
5500
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5488
5501
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5489
5502
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5490
|
-
* @returns {object} an list of [order structures]{@link https://
|
|
5503
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5491
5504
|
*/
|
|
5492
5505
|
await this.loadMarkets();
|
|
5493
5506
|
let market = undefined;
|
|
@@ -5530,7 +5543,9 @@ export default class htx extends Exchange {
|
|
|
5530
5543
|
response = await this.spotPrivatePostV1OrderOrdersBatchcancel(this.extend(request, params));
|
|
5531
5544
|
}
|
|
5532
5545
|
else {
|
|
5533
|
-
|
|
5546
|
+
if (symbol === undefined) {
|
|
5547
|
+
throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
5548
|
+
}
|
|
5534
5549
|
let clientOrderIds = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5535
5550
|
clientOrderIds = this.safeString2(params, 'client_order_ids', 'clientOrderIds', clientOrderIds);
|
|
5536
5551
|
if (clientOrderIds === undefined) {
|
|
@@ -5666,7 +5681,7 @@ export default class htx extends Exchange {
|
|
|
5666
5681
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5667
5682
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5668
5683
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5669
|
-
* @returns {object[]} a list of [order structures]{@link https://
|
|
5684
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5670
5685
|
*/
|
|
5671
5686
|
await this.loadMarkets();
|
|
5672
5687
|
let market = undefined;
|
|
@@ -5697,7 +5712,9 @@ export default class htx extends Exchange {
|
|
|
5697
5712
|
response = await this.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(this.extend(request, params));
|
|
5698
5713
|
}
|
|
5699
5714
|
else {
|
|
5700
|
-
|
|
5715
|
+
if (symbol === undefined) {
|
|
5716
|
+
throw new ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
5717
|
+
}
|
|
5701
5718
|
if (market['future']) {
|
|
5702
5719
|
request['symbol'] = market['settleId'];
|
|
5703
5720
|
}
|
|
@@ -5818,7 +5835,7 @@ export default class htx extends Exchange {
|
|
|
5818
5835
|
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
5819
5836
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
5820
5837
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5821
|
-
* @returns {object} a dictionary of [address structures]{@link https://
|
|
5838
|
+
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
5822
5839
|
*/
|
|
5823
5840
|
await this.loadMarkets();
|
|
5824
5841
|
const currency = this.currency(code);
|
|
@@ -5850,7 +5867,7 @@ export default class htx extends Exchange {
|
|
|
5850
5867
|
* @description fetch the deposit address for a currency associated with this account
|
|
5851
5868
|
* @param {string} code unified currency code
|
|
5852
5869
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5853
|
-
* @returns {object} an [address structure]{@link https://
|
|
5870
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
5854
5871
|
*/
|
|
5855
5872
|
await this.loadMarkets();
|
|
5856
5873
|
const currency = this.currency(code);
|
|
@@ -5902,7 +5919,7 @@ export default class htx extends Exchange {
|
|
|
5902
5919
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5903
5920
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5904
5921
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5905
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
5922
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5906
5923
|
*/
|
|
5907
5924
|
if (limit === undefined || limit > 100) {
|
|
5908
5925
|
limit = 100;
|
|
@@ -5961,7 +5978,7 @@ export default class htx extends Exchange {
|
|
|
5961
5978
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5962
5979
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5963
5980
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5964
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
5981
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5965
5982
|
*/
|
|
5966
5983
|
if (limit === undefined || limit > 100) {
|
|
5967
5984
|
limit = 100;
|
|
@@ -6137,7 +6154,7 @@ export default class htx extends Exchange {
|
|
|
6137
6154
|
* @param {string} address the address to withdraw to
|
|
6138
6155
|
* @param {string} tag
|
|
6139
6156
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6140
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
6157
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
6141
6158
|
*/
|
|
6142
6159
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
6143
6160
|
await this.loadMarkets();
|
|
@@ -6229,7 +6246,7 @@ export default class htx extends Exchange {
|
|
|
6229
6246
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6230
6247
|
* @param {string} [params.symbol] used for isolated margin transfer
|
|
6231
6248
|
* @param {string} [params.subType] 'linear' or 'inverse', only used when transfering to/from swap accounts
|
|
6232
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
6249
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6233
6250
|
*/
|
|
6234
6251
|
await this.loadMarkets();
|
|
6235
6252
|
const currency = this.currency(code);
|
|
@@ -6307,82 +6324,17 @@ export default class htx extends Exchange {
|
|
|
6307
6324
|
//
|
|
6308
6325
|
return this.parseTransfer(response, currency);
|
|
6309
6326
|
}
|
|
6310
|
-
async
|
|
6327
|
+
async fetchIsolatedBorrowRates(params = {}) {
|
|
6311
6328
|
/**
|
|
6312
6329
|
* @method
|
|
6313
|
-
* @name
|
|
6314
|
-
* @description fetch borrow rates for currencies within individual markets
|
|
6315
|
-
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6316
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} indexed by market symbol
|
|
6317
|
-
*/
|
|
6318
|
-
await this.loadMarkets();
|
|
6319
|
-
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6320
|
-
//
|
|
6321
|
-
// {
|
|
6322
|
-
// "status": "ok",
|
|
6323
|
-
// "data": [
|
|
6324
|
-
// {
|
|
6325
|
-
// "symbol": "1inchusdt",
|
|
6326
|
-
// "currencies": [
|
|
6327
|
-
// {
|
|
6328
|
-
// "currency": "1inch",
|
|
6329
|
-
// "interest-rate": "0.00098",
|
|
6330
|
-
// "min-loan-amt": "90.000000000000000000",
|
|
6331
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6332
|
-
// "loanable-amt": "0.0",
|
|
6333
|
-
// "actual-rate": "0.00098"
|
|
6334
|
-
// },
|
|
6335
|
-
// {
|
|
6336
|
-
// "currency": "usdt",
|
|
6337
|
-
// "interest-rate": "0.00098",
|
|
6338
|
-
// "min-loan-amt": "100.000000000000000000",
|
|
6339
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6340
|
-
// "loanable-amt": "0.0",
|
|
6341
|
-
// "actual-rate": "0.00098"
|
|
6342
|
-
// }
|
|
6343
|
-
// ]
|
|
6344
|
-
// },
|
|
6345
|
-
// ...
|
|
6346
|
-
// ]
|
|
6347
|
-
// }
|
|
6348
|
-
//
|
|
6349
|
-
const timestamp = this.milliseconds();
|
|
6350
|
-
const data = this.safeValue(response, 'data', []);
|
|
6351
|
-
const rates = {
|
|
6352
|
-
'info': response,
|
|
6353
|
-
};
|
|
6354
|
-
for (let i = 0; i < data.length; i++) {
|
|
6355
|
-
const rate = data[i];
|
|
6356
|
-
const currencies = this.safeValue(rate, 'currencies', []);
|
|
6357
|
-
const symbolRates = {};
|
|
6358
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6359
|
-
const currency = currencies[j];
|
|
6360
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6361
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6362
|
-
symbolRates[code] = {
|
|
6363
|
-
'currency': code,
|
|
6364
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6365
|
-
'span': 86400000,
|
|
6366
|
-
'timestamp': timestamp,
|
|
6367
|
-
'datetime': this.iso8601(timestamp),
|
|
6368
|
-
};
|
|
6369
|
-
}
|
|
6370
|
-
const marketId = this.safeString(rate, 'symbol');
|
|
6371
|
-
const symbol = this.safeSymbol(marketId);
|
|
6372
|
-
rates[symbol] = symbolRates;
|
|
6373
|
-
}
|
|
6374
|
-
return rates;
|
|
6375
|
-
}
|
|
6376
|
-
async fetchBorrowRates(params = {}) {
|
|
6377
|
-
/**
|
|
6378
|
-
* @method
|
|
6379
|
-
* @name huobi#fetchBorrowRates
|
|
6330
|
+
* @name htx#fetchIsolatedBorrowRates
|
|
6380
6331
|
* @description fetch the borrow interest rates of all currencies
|
|
6381
|
-
* @param {object} [params] extra parameters specific to the
|
|
6382
|
-
* @returns {object} a list of [borrow rate structures]{@link https://
|
|
6332
|
+
* @param {object} [params] extra parameters specific to the htx api endpoint
|
|
6333
|
+
* @returns {object} a list of [isolated borrow rate structures]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
|
|
6383
6334
|
*/
|
|
6384
6335
|
await this.loadMarkets();
|
|
6385
6336
|
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6337
|
+
//
|
|
6386
6338
|
// {
|
|
6387
6339
|
// "status": "ok",
|
|
6388
6340
|
// "data": [
|
|
@@ -6410,28 +6362,57 @@ export default class htx extends Exchange {
|
|
|
6410
6362
|
// ...
|
|
6411
6363
|
// ]
|
|
6412
6364
|
// }
|
|
6413
|
-
|
|
6365
|
+
//
|
|
6414
6366
|
const data = this.safeValue(response, 'data', []);
|
|
6415
|
-
const rates =
|
|
6367
|
+
const rates = [];
|
|
6416
6368
|
for (let i = 0; i < data.length; i++) {
|
|
6417
|
-
|
|
6418
|
-
const currencies = this.safeValue(market, 'currencies', []);
|
|
6419
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6420
|
-
const currency = currencies[j];
|
|
6421
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6422
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6423
|
-
rates[code] = {
|
|
6424
|
-
'currency': code,
|
|
6425
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6426
|
-
'span': 86400000,
|
|
6427
|
-
'timestamp': timestamp,
|
|
6428
|
-
'datetime': this.iso8601(timestamp),
|
|
6429
|
-
'info': undefined,
|
|
6430
|
-
};
|
|
6431
|
-
}
|
|
6369
|
+
rates.push(this.parseIsolatedBorrowRate(data[i]));
|
|
6432
6370
|
}
|
|
6433
6371
|
return rates;
|
|
6434
6372
|
}
|
|
6373
|
+
parseIsolatedBorrowRate(info, market = undefined) {
|
|
6374
|
+
//
|
|
6375
|
+
// {
|
|
6376
|
+
// "symbol": "1inchusdt",
|
|
6377
|
+
// "currencies": [
|
|
6378
|
+
// {
|
|
6379
|
+
// "currency": "1inch",
|
|
6380
|
+
// "interest-rate": "0.00098",
|
|
6381
|
+
// "min-loan-amt": "90.000000000000000000",
|
|
6382
|
+
// "max-loan-amt": "1000.000000000000000000",
|
|
6383
|
+
// "loanable-amt": "0.0",
|
|
6384
|
+
// "actual-rate": "0.00098"
|
|
6385
|
+
// },
|
|
6386
|
+
// {
|
|
6387
|
+
// "currency": "usdt",
|
|
6388
|
+
// "interest-rate": "0.00098",
|
|
6389
|
+
// "min-loan-amt": "100.000000000000000000",
|
|
6390
|
+
// "max-loan-amt": "1000.000000000000000000",
|
|
6391
|
+
// "loanable-amt": "0.0",
|
|
6392
|
+
// "actual-rate": "0.00098"
|
|
6393
|
+
// }
|
|
6394
|
+
// ]
|
|
6395
|
+
// },
|
|
6396
|
+
//
|
|
6397
|
+
const marketId = this.safeString(info, 'symbol');
|
|
6398
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
6399
|
+
const currencies = this.safeValue(info, 'currencies', []);
|
|
6400
|
+
const baseData = this.safeValue(currencies, 0);
|
|
6401
|
+
const quoteData = this.safeValue(currencies, 1);
|
|
6402
|
+
const baseId = this.safeString(baseData, 'currency');
|
|
6403
|
+
const quoteId = this.safeString(quoteData, 'currency');
|
|
6404
|
+
return {
|
|
6405
|
+
'symbol': symbol,
|
|
6406
|
+
'base': this.safeCurrencyCode(baseId),
|
|
6407
|
+
'baseRate': this.safeNumber(baseData, 'actual-rate'),
|
|
6408
|
+
'quote': this.safeCurrencyCode(quoteId),
|
|
6409
|
+
'quoteRate': this.safeNumber(quoteData, 'actual-rate'),
|
|
6410
|
+
'period': 86400000,
|
|
6411
|
+
'timestamp': undefined,
|
|
6412
|
+
'datetime': undefined,
|
|
6413
|
+
'info': info,
|
|
6414
|
+
};
|
|
6415
|
+
}
|
|
6435
6416
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6436
6417
|
/**
|
|
6437
6418
|
* @method
|
|
@@ -6443,9 +6424,11 @@ export default class htx extends Exchange {
|
|
|
6443
6424
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
6444
6425
|
* @param {int} [limit] not used by huobi, but filtered internally by ccxt
|
|
6445
6426
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6446
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://
|
|
6427
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
6447
6428
|
*/
|
|
6448
|
-
|
|
6429
|
+
if (symbol === undefined) {
|
|
6430
|
+
throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
6431
|
+
}
|
|
6449
6432
|
let paginate = false;
|
|
6450
6433
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
6451
6434
|
if (paginate) {
|
|
@@ -6558,7 +6541,7 @@ export default class htx extends Exchange {
|
|
|
6558
6541
|
* @description fetch the current funding rate
|
|
6559
6542
|
* @param {string} symbol unified market symbol
|
|
6560
6543
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6561
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
6544
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6562
6545
|
*/
|
|
6563
6546
|
await this.loadMarkets();
|
|
6564
6547
|
const market = this.market(symbol);
|
|
@@ -6601,7 +6584,7 @@ export default class htx extends Exchange {
|
|
|
6601
6584
|
* @description fetch the funding rate for multiple markets
|
|
6602
6585
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
6603
6586
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6604
|
-
* @returns {object} a dictionary of [funding rates structures]{@link https://
|
|
6587
|
+
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
6605
6588
|
*/
|
|
6606
6589
|
await this.loadMarkets();
|
|
6607
6590
|
symbols = this.marketSymbols(symbols);
|
|
@@ -6650,7 +6633,7 @@ export default class htx extends Exchange {
|
|
|
6650
6633
|
* @param {int} [since] the earliest time in ms to fetch borrrow interest for
|
|
6651
6634
|
* @param {int} [limit] the maximum number of structures to retrieve
|
|
6652
6635
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6653
|
-
* @returns {object[]} a list of [borrow interest structures]{@link https://
|
|
6636
|
+
* @returns {object[]} a list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
6654
6637
|
*/
|
|
6655
6638
|
await this.loadMarkets();
|
|
6656
6639
|
let marginMode = undefined;
|
|
@@ -6937,7 +6920,7 @@ export default class htx extends Exchange {
|
|
|
6937
6920
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6938
6921
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6939
6922
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6940
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
6923
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6941
6924
|
*/
|
|
6942
6925
|
await this.loadMarkets();
|
|
6943
6926
|
const market = this.market(symbol);
|
|
@@ -7027,7 +7010,9 @@ export default class htx extends Exchange {
|
|
|
7027
7010
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7028
7011
|
* @returns {object} response from the exchange
|
|
7029
7012
|
*/
|
|
7030
|
-
|
|
7013
|
+
if (symbol === undefined) {
|
|
7014
|
+
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
7015
|
+
}
|
|
7031
7016
|
await this.loadMarkets();
|
|
7032
7017
|
const market = this.market(symbol);
|
|
7033
7018
|
const [marketType, query] = this.handleMarketTypeAndParams('setLeverage', market, params);
|
|
@@ -7213,7 +7198,7 @@ export default class htx extends Exchange {
|
|
|
7213
7198
|
* @description fetch all open positions
|
|
7214
7199
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7215
7200
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7216
|
-
* @returns {object[]} a list of [position structure]{@link https://
|
|
7201
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7217
7202
|
*/
|
|
7218
7203
|
await this.loadMarkets();
|
|
7219
7204
|
symbols = this.marketSymbols(symbols);
|
|
@@ -7342,7 +7327,7 @@ export default class htx extends Exchange {
|
|
|
7342
7327
|
* @description fetch data on a single open contract trade position
|
|
7343
7328
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
7344
7329
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7345
|
-
* @returns {object} a [position structure]{@link https://
|
|
7330
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7346
7331
|
*/
|
|
7347
7332
|
await this.loadMarkets();
|
|
7348
7333
|
const market = this.market(symbol);
|
|
@@ -7662,7 +7647,7 @@ export default class htx extends Exchange {
|
|
|
7662
7647
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7663
7648
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
7664
7649
|
* @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)
|
|
7665
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
7650
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
7666
7651
|
*/
|
|
7667
7652
|
await this.loadMarkets();
|
|
7668
7653
|
let paginate = false;
|
|
@@ -7736,7 +7721,7 @@ export default class htx extends Exchange {
|
|
|
7736
7721
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
7737
7722
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7738
7723
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7739
|
-
* @returns {object} a dictionary of [leverage tiers structures]{@link https://
|
|
7724
|
+
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
7740
7725
|
*/
|
|
7741
7726
|
await this.loadMarkets();
|
|
7742
7727
|
const response = await this.contractPublicGetLinearSwapApiV1SwapAdjustfactor(params);
|
|
@@ -7779,7 +7764,7 @@ export default class htx extends Exchange {
|
|
|
7779
7764
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
7780
7765
|
* @param {string} symbol unified market symbol
|
|
7781
7766
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7782
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
7767
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
7783
7768
|
*/
|
|
7784
7769
|
await this.loadMarkets();
|
|
7785
7770
|
const request = {};
|
|
@@ -7872,7 +7857,7 @@ export default class htx extends Exchange {
|
|
|
7872
7857
|
* @param {object} [params] Exchange specific parameters
|
|
7873
7858
|
* @param {int} [params.amount_type] *required* Open interest unit. 1-cont,2-cryptocurrency
|
|
7874
7859
|
* @param {int} [params.pair] eg BTC-USDT *Only for USDT-M*
|
|
7875
|
-
* @returns {object} an array of [open interest structures]{@link https://
|
|
7860
|
+
* @returns {object} an array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7876
7861
|
*/
|
|
7877
7862
|
if (timeframe !== '1h' && timeframe !== '4h' && timeframe !== '12h' && timeframe !== '1d') {
|
|
7878
7863
|
throw new BadRequest(this.id + ' fetchOpenInterestHistory cannot only use the 1h, 4h, 12h and 1d timeframe');
|
|
@@ -7984,7 +7969,7 @@ export default class htx extends Exchange {
|
|
|
7984
7969
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-swap-open-interest-information
|
|
7985
7970
|
* @param {string} symbol Unified CCXT market symbol
|
|
7986
7971
|
* @param {object} [params] exchange specific parameters
|
|
7987
|
-
* @returns {object} an open interest structure{@link https://
|
|
7972
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7988
7973
|
*/
|
|
7989
7974
|
await this.loadMarkets();
|
|
7990
7975
|
const market = this.market(symbol);
|
|
@@ -8157,7 +8142,7 @@ export default class htx extends Exchange {
|
|
|
8157
8142
|
* @param {float} amount the amount to borrow
|
|
8158
8143
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8159
8144
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8160
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8145
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8161
8146
|
*/
|
|
8162
8147
|
await this.loadMarkets();
|
|
8163
8148
|
const currency = this.currency(code);
|
|
@@ -8170,7 +8155,9 @@ export default class htx extends Exchange {
|
|
|
8170
8155
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
8171
8156
|
let method = undefined;
|
|
8172
8157
|
if (marginMode === 'isolated') {
|
|
8173
|
-
|
|
8158
|
+
if (symbol === undefined) {
|
|
8159
|
+
throw new ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
|
|
8160
|
+
}
|
|
8174
8161
|
const market = this.market(symbol);
|
|
8175
8162
|
request['symbol'] = market['id'];
|
|
8176
8163
|
method = 'privatePostMarginOrders';
|
|
@@ -8209,7 +8196,7 @@ export default class htx extends Exchange {
|
|
|
8209
8196
|
* @param {float} amount the amount to repay
|
|
8210
8197
|
* @param {string} symbol unified market symbol
|
|
8211
8198
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8212
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8199
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8213
8200
|
*/
|
|
8214
8201
|
await this.loadMarkets();
|
|
8215
8202
|
const currency = this.currency(code);
|
|
@@ -8289,9 +8276,11 @@ export default class htx extends Exchange {
|
|
|
8289
8276
|
* @param {int} [params.until] timestamp in ms, value range = start_time -> current time,default = current time
|
|
8290
8277
|
* @param {int} [params.page_index] page index, default page 1 if not filled
|
|
8291
8278
|
* @param {int} [params.code] unified currency code, can be used when symbol is undefined
|
|
8292
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://
|
|
8279
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
8293
8280
|
*/
|
|
8294
|
-
|
|
8281
|
+
if (symbol === undefined) {
|
|
8282
|
+
throw new ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
8283
|
+
}
|
|
8295
8284
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
8296
8285
|
params = this.omit(params, ['until', 'till']);
|
|
8297
8286
|
const market = this.market(symbol);
|
|
@@ -8386,7 +8375,7 @@ export default class htx extends Exchange {
|
|
|
8386
8375
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-currencies-v2
|
|
8387
8376
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
8388
8377
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8389
|
-
* @returns {object[]} a list of [fees structures]{@link https://
|
|
8378
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
8390
8379
|
*/
|
|
8391
8380
|
await this.loadMarkets();
|
|
8392
8381
|
const response = await this.spotPublicGetV2ReferenceCurrencies(params);
|
|
@@ -8602,7 +8591,7 @@ export default class htx extends Exchange {
|
|
|
8602
8591
|
* @param {object} [params] exchange specific parameters for the huobi api endpoint
|
|
8603
8592
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
8604
8593
|
* @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
|
|
8605
|
-
* @returns {object} an array of [liquidation structures]{@link https://
|
|
8594
|
+
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
8606
8595
|
*/
|
|
8607
8596
|
await this.loadMarkets();
|
|
8608
8597
|
const market = this.market(symbol);
|