ccxt 4.1.55 → 4.1.57
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/CONTRIBUTING.md +1 -1
- package/README.md +6 -6
- package/build.sh +30 -8
- package/dist/ccxt.browser.js +5592 -4907
- package/dist/ccxt.browser.min.js +13 -13
- 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/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 +17 -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 +129 -94
- 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 +101 -78
- 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 +135 -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 +92 -84
- package/dist/cjs/src/p2b.js +80 -83
- 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 +6 -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/bitbank.d.ts +1 -0
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +0 -20
- package/js/src/abstract/htx.d.ts +3 -0
- package/js/src/abstract/huobi.d.ts +3 -0
- package/js/src/abstract/huobipro.d.ts +3 -0
- package/js/src/abstract/okex.d.ts +3 -1
- package/js/src/abstract/okex5.d.ts +3 -1
- package/js/src/abstract/okx.d.ts +3 -1
- 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/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 +17 -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 +129 -94
- 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 +101 -78
- 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 +135 -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 +92 -84
- package/js/src/p2b.d.ts +8 -7
- package/js/src/p2b.js +80 -82
- 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 +6 -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 +2 -2
- package/js/src/bitstamp1.d.ts +0 -28
- package/js/src/bitstamp1.js +0 -430
- package/js/src/lbank2.d.ts +0 -90
- package/js/src/lbank2.js +0 -2779
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,
|
|
@@ -496,6 +497,7 @@ class htx extends htx$1 {
|
|
|
496
497
|
// Future Market Data interface
|
|
497
498
|
'api/v1/contract_contract_info': 1,
|
|
498
499
|
'api/v1/contract_index': 1,
|
|
500
|
+
'api/v1/contract_query_elements': 1,
|
|
499
501
|
'api/v1/contract_price_limit': 1,
|
|
500
502
|
'api/v1/contract_open_interest': 1,
|
|
501
503
|
'api/v1/contract_delivery_price': 1,
|
|
@@ -525,6 +527,7 @@ class htx extends htx$1 {
|
|
|
525
527
|
// Swap Market Data interface
|
|
526
528
|
'swap-api/v1/swap_contract_info': 1,
|
|
527
529
|
'swap-api/v1/swap_index': 1,
|
|
530
|
+
'swap-api/v1/swap_query_elements': 1,
|
|
528
531
|
'swap-api/v1/swap_price_limit': 1,
|
|
529
532
|
'swap-api/v1/swap_open_interest': 1,
|
|
530
533
|
'swap-ex/market/depth': 1,
|
|
@@ -557,6 +560,7 @@ class htx extends htx$1 {
|
|
|
557
560
|
// Swap Market Data interface
|
|
558
561
|
'linear-swap-api/v1/swap_contract_info': 1,
|
|
559
562
|
'linear-swap-api/v1/swap_index': 1,
|
|
563
|
+
'linear-swap-api/v1/swap_query_elements': 1,
|
|
560
564
|
'linear-swap-api/v1/swap_price_limit': 1,
|
|
561
565
|
'linear-swap-api/v1/swap_open_interest': 1,
|
|
562
566
|
'linear-swap-ex/market/depth': 1,
|
|
@@ -1482,7 +1486,7 @@ class htx extends htx$1 {
|
|
|
1482
1486
|
* @description fetch the trading fees for a market
|
|
1483
1487
|
* @param {string} symbol unified market symbol
|
|
1484
1488
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
1485
|
-
* @returns {object} a [fee structure]{@link https://
|
|
1489
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1486
1490
|
*/
|
|
1487
1491
|
await this.loadMarkets();
|
|
1488
1492
|
const market = this.market(symbol);
|
|
@@ -2022,7 +2026,7 @@ class htx extends htx$1 {
|
|
|
2022
2026
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2023
2027
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2024
2028
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2025
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
2029
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2026
2030
|
*/
|
|
2027
2031
|
await this.loadMarkets();
|
|
2028
2032
|
const market = this.market(symbol);
|
|
@@ -2105,7 +2109,7 @@ class htx extends htx$1 {
|
|
|
2105
2109
|
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-a-batch-of-market-data-overview-v2
|
|
2106
2110
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2107
2111
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2108
|
-
* @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}
|
|
2109
2113
|
*/
|
|
2110
2114
|
await this.loadMarkets();
|
|
2111
2115
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2259,7 +2263,7 @@ class htx extends htx$1 {
|
|
|
2259
2263
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2260
2264
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2261
2265
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2262
|
-
* @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
|
|
2263
2267
|
*/
|
|
2264
2268
|
await this.loadMarkets();
|
|
2265
2269
|
const market = this.market(symbol);
|
|
@@ -2487,7 +2491,7 @@ class htx extends htx$1 {
|
|
|
2487
2491
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2488
2492
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
2489
2493
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2490
|
-
* @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}
|
|
2491
2495
|
*/
|
|
2492
2496
|
let market = undefined;
|
|
2493
2497
|
if (symbol !== undefined) {
|
|
@@ -2522,7 +2526,7 @@ class htx extends htx$1 {
|
|
|
2522
2526
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2523
2527
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
2524
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)
|
|
2525
|
-
* @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}
|
|
2526
2530
|
*/
|
|
2527
2531
|
await this.loadMarkets();
|
|
2528
2532
|
let paginate = false;
|
|
@@ -2572,7 +2576,9 @@ class htx extends htx$1 {
|
|
|
2572
2576
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
2573
2577
|
}
|
|
2574
2578
|
else {
|
|
2575
|
-
|
|
2579
|
+
if (symbol === undefined) {
|
|
2580
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
2581
|
+
}
|
|
2576
2582
|
request['contract'] = market['id'];
|
|
2577
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
|
|
2578
2584
|
if (since !== undefined) {
|
|
@@ -2693,7 +2699,7 @@ class htx extends htx$1 {
|
|
|
2693
2699
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2694
2700
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2695
2701
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2696
|
-
* @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}
|
|
2697
2703
|
*/
|
|
2698
2704
|
await this.loadMarkets();
|
|
2699
2705
|
const market = this.market(symbol);
|
|
@@ -2940,7 +2946,7 @@ class htx extends htx$1 {
|
|
|
2940
2946
|
* @name huobi#fetchAccounts
|
|
2941
2947
|
* @description fetch all the accounts associated with a profile
|
|
2942
2948
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2943
|
-
* @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
|
|
2944
2950
|
*/
|
|
2945
2951
|
await this.loadMarkets();
|
|
2946
2952
|
const response = await this.spotPrivateGetV1AccountAccounts(params);
|
|
@@ -3184,7 +3190,7 @@ class htx extends htx$1 {
|
|
|
3184
3190
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3185
3191
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3186
3192
|
* @param {bool} [params.unified] provide this parameter if you have a recent account with unified cross+isolated margin account
|
|
3187
|
-
* @returns {object} a [balance structure]{@link https://
|
|
3193
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3188
3194
|
*/
|
|
3189
3195
|
await this.loadMarkets();
|
|
3190
3196
|
let type = undefined;
|
|
@@ -3511,7 +3517,7 @@ class htx extends htx$1 {
|
|
|
3511
3517
|
* @description fetches information on an order made by the user
|
|
3512
3518
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3513
3519
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3514
|
-
* @returns {object} An [order structure]{@link https://
|
|
3520
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3515
3521
|
*/
|
|
3516
3522
|
await this.loadMarkets();
|
|
3517
3523
|
let market = undefined;
|
|
@@ -3548,7 +3554,9 @@ class htx extends htx$1 {
|
|
|
3548
3554
|
}
|
|
3549
3555
|
}
|
|
3550
3556
|
else {
|
|
3551
|
-
|
|
3557
|
+
if (symbol === undefined) {
|
|
3558
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3559
|
+
}
|
|
3552
3560
|
request['contract_code'] = market['id'];
|
|
3553
3561
|
if (market['linear']) {
|
|
3554
3562
|
let marginMode = undefined;
|
|
@@ -3733,7 +3741,9 @@ class htx extends htx$1 {
|
|
|
3733
3741
|
async fetchSpotOrdersByStates(states, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3734
3742
|
const method = this.safeString(this.options, 'fetchOrdersByStatesMethod', 'spot_private_get_v1_order_orders'); // spot_private_get_v1_order_history
|
|
3735
3743
|
if (method === 'spot_private_get_v1_order_orders') {
|
|
3736
|
-
|
|
3744
|
+
if (symbol === undefined) {
|
|
3745
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
3746
|
+
}
|
|
3737
3747
|
}
|
|
3738
3748
|
await this.loadMarkets();
|
|
3739
3749
|
let market = undefined;
|
|
@@ -3803,7 +3813,9 @@ class htx extends htx$1 {
|
|
|
3803
3813
|
return await this.fetchSpotOrdersByStates('filled,partial-canceled,canceled', symbol, since, limit, params);
|
|
3804
3814
|
}
|
|
3805
3815
|
async fetchContractOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3806
|
-
|
|
3816
|
+
if (symbol === undefined) {
|
|
3817
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchContractOrders() requires a symbol argument');
|
|
3818
|
+
}
|
|
3807
3819
|
await this.loadMarkets();
|
|
3808
3820
|
const market = this.market(symbol);
|
|
3809
3821
|
let request = {
|
|
@@ -4060,7 +4072,7 @@ class htx extends htx$1 {
|
|
|
4060
4072
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4061
4073
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4062
4074
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4063
|
-
* @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}
|
|
4064
4076
|
*/
|
|
4065
4077
|
await this.loadMarkets();
|
|
4066
4078
|
let market = undefined;
|
|
@@ -4097,7 +4109,7 @@ class htx extends htx$1 {
|
|
|
4097
4109
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4098
4110
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4099
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)
|
|
4100
|
-
* @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}
|
|
4101
4113
|
*/
|
|
4102
4114
|
await this.loadMarkets();
|
|
4103
4115
|
let paginate = false;
|
|
@@ -4132,7 +4144,7 @@ class htx extends htx$1 {
|
|
|
4132
4144
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4133
4145
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4134
4146
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4135
|
-
* @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}
|
|
4136
4148
|
*/
|
|
4137
4149
|
await this.loadMarkets();
|
|
4138
4150
|
let market = undefined;
|
|
@@ -4170,7 +4182,9 @@ class htx extends htx$1 {
|
|
|
4170
4182
|
response = await this.spotPrivateGetV1OrderOpenOrders(this.extend(request, params));
|
|
4171
4183
|
}
|
|
4172
4184
|
else {
|
|
4173
|
-
|
|
4185
|
+
if (symbol === undefined) {
|
|
4186
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
4187
|
+
}
|
|
4174
4188
|
if (limit !== undefined) {
|
|
4175
4189
|
request['page_size'] = limit;
|
|
4176
4190
|
}
|
|
@@ -5057,7 +5071,7 @@ class htx extends htx$1 {
|
|
|
5057
5071
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
5058
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
|
|
5059
5073
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
5060
|
-
* @returns {object} an [order structure]{@link https://
|
|
5074
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5061
5075
|
*/
|
|
5062
5076
|
await this.loadMarkets();
|
|
5063
5077
|
const market = this.market(symbol);
|
|
@@ -5205,7 +5219,7 @@ class htx extends htx$1 {
|
|
|
5205
5219
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders
|
|
5206
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
|
|
5207
5221
|
* @param {object} [params] extra parameters specific to the htx api endpoint
|
|
5208
|
-
* @returns {object} an [order structure]{@link https://
|
|
5222
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5209
5223
|
*/
|
|
5210
5224
|
await this.loadMarkets();
|
|
5211
5225
|
const ordersRequests = [];
|
|
@@ -5339,7 +5353,7 @@ class htx extends htx$1 {
|
|
|
5339
5353
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5340
5354
|
* @param {bool} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
5341
5355
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5342
|
-
* @returns {object} An [order structure]{@link https://
|
|
5356
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5343
5357
|
*/
|
|
5344
5358
|
await this.loadMarkets();
|
|
5345
5359
|
let market = undefined;
|
|
@@ -5374,7 +5388,9 @@ class htx extends htx$1 {
|
|
|
5374
5388
|
}
|
|
5375
5389
|
}
|
|
5376
5390
|
else {
|
|
5377
|
-
|
|
5391
|
+
if (symbol === undefined) {
|
|
5392
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
5393
|
+
}
|
|
5378
5394
|
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5379
5395
|
if (clientOrderId === undefined) {
|
|
5380
5396
|
request['order_id'] = id;
|
|
@@ -5481,7 +5497,7 @@ class htx extends htx$1 {
|
|
|
5481
5497
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5482
5498
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5483
5499
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5484
|
-
* @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}
|
|
5485
5501
|
*/
|
|
5486
5502
|
await this.loadMarkets();
|
|
5487
5503
|
let market = undefined;
|
|
@@ -5524,7 +5540,9 @@ class htx extends htx$1 {
|
|
|
5524
5540
|
response = await this.spotPrivatePostV1OrderOrdersBatchcancel(this.extend(request, params));
|
|
5525
5541
|
}
|
|
5526
5542
|
else {
|
|
5527
|
-
|
|
5543
|
+
if (symbol === undefined) {
|
|
5544
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
5545
|
+
}
|
|
5528
5546
|
let clientOrderIds = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5529
5547
|
clientOrderIds = this.safeString2(params, 'client_order_ids', 'clientOrderIds', clientOrderIds);
|
|
5530
5548
|
if (clientOrderIds === undefined) {
|
|
@@ -5660,7 +5678,7 @@ class htx extends htx$1 {
|
|
|
5660
5678
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5661
5679
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5662
5680
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5663
|
-
* @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}
|
|
5664
5682
|
*/
|
|
5665
5683
|
await this.loadMarkets();
|
|
5666
5684
|
let market = undefined;
|
|
@@ -5691,7 +5709,9 @@ class htx extends htx$1 {
|
|
|
5691
5709
|
response = await this.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(this.extend(request, params));
|
|
5692
5710
|
}
|
|
5693
5711
|
else {
|
|
5694
|
-
|
|
5712
|
+
if (symbol === undefined) {
|
|
5713
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
5714
|
+
}
|
|
5695
5715
|
if (market['future']) {
|
|
5696
5716
|
request['symbol'] = market['settleId'];
|
|
5697
5717
|
}
|
|
@@ -5812,7 +5832,7 @@ class htx extends htx$1 {
|
|
|
5812
5832
|
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
5813
5833
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
5814
5834
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5815
|
-
* @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
|
|
5816
5836
|
*/
|
|
5817
5837
|
await this.loadMarkets();
|
|
5818
5838
|
const currency = this.currency(code);
|
|
@@ -5844,7 +5864,7 @@ class htx extends htx$1 {
|
|
|
5844
5864
|
* @description fetch the deposit address for a currency associated with this account
|
|
5845
5865
|
* @param {string} code unified currency code
|
|
5846
5866
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5847
|
-
* @returns {object} an [address structure]{@link https://
|
|
5867
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
5848
5868
|
*/
|
|
5849
5869
|
await this.loadMarkets();
|
|
5850
5870
|
const currency = this.currency(code);
|
|
@@ -5896,7 +5916,7 @@ class htx extends htx$1 {
|
|
|
5896
5916
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5897
5917
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5898
5918
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5899
|
-
* @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}
|
|
5900
5920
|
*/
|
|
5901
5921
|
if (limit === undefined || limit > 100) {
|
|
5902
5922
|
limit = 100;
|
|
@@ -5955,7 +5975,7 @@ class htx extends htx$1 {
|
|
|
5955
5975
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5956
5976
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5957
5977
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5958
|
-
* @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}
|
|
5959
5979
|
*/
|
|
5960
5980
|
if (limit === undefined || limit > 100) {
|
|
5961
5981
|
limit = 100;
|
|
@@ -6131,7 +6151,7 @@ class htx extends htx$1 {
|
|
|
6131
6151
|
* @param {string} address the address to withdraw to
|
|
6132
6152
|
* @param {string} tag
|
|
6133
6153
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6134
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
6154
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
6135
6155
|
*/
|
|
6136
6156
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
6137
6157
|
await this.loadMarkets();
|
|
@@ -6223,7 +6243,7 @@ class htx extends htx$1 {
|
|
|
6223
6243
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6224
6244
|
* @param {string} [params.symbol] used for isolated margin transfer
|
|
6225
6245
|
* @param {string} [params.subType] 'linear' or 'inverse', only used when transfering to/from swap accounts
|
|
6226
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
6246
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6227
6247
|
*/
|
|
6228
6248
|
await this.loadMarkets();
|
|
6229
6249
|
const currency = this.currency(code);
|
|
@@ -6301,82 +6321,17 @@ class htx extends htx$1 {
|
|
|
6301
6321
|
//
|
|
6302
6322
|
return this.parseTransfer(response, currency);
|
|
6303
6323
|
}
|
|
6304
|
-
async
|
|
6324
|
+
async fetchIsolatedBorrowRates(params = {}) {
|
|
6305
6325
|
/**
|
|
6306
6326
|
* @method
|
|
6307
|
-
* @name
|
|
6308
|
-
* @description fetch borrow rates for currencies within individual markets
|
|
6309
|
-
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6310
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} indexed by market symbol
|
|
6311
|
-
*/
|
|
6312
|
-
await this.loadMarkets();
|
|
6313
|
-
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6314
|
-
//
|
|
6315
|
-
// {
|
|
6316
|
-
// "status": "ok",
|
|
6317
|
-
// "data": [
|
|
6318
|
-
// {
|
|
6319
|
-
// "symbol": "1inchusdt",
|
|
6320
|
-
// "currencies": [
|
|
6321
|
-
// {
|
|
6322
|
-
// "currency": "1inch",
|
|
6323
|
-
// "interest-rate": "0.00098",
|
|
6324
|
-
// "min-loan-amt": "90.000000000000000000",
|
|
6325
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6326
|
-
// "loanable-amt": "0.0",
|
|
6327
|
-
// "actual-rate": "0.00098"
|
|
6328
|
-
// },
|
|
6329
|
-
// {
|
|
6330
|
-
// "currency": "usdt",
|
|
6331
|
-
// "interest-rate": "0.00098",
|
|
6332
|
-
// "min-loan-amt": "100.000000000000000000",
|
|
6333
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6334
|
-
// "loanable-amt": "0.0",
|
|
6335
|
-
// "actual-rate": "0.00098"
|
|
6336
|
-
// }
|
|
6337
|
-
// ]
|
|
6338
|
-
// },
|
|
6339
|
-
// ...
|
|
6340
|
-
// ]
|
|
6341
|
-
// }
|
|
6342
|
-
//
|
|
6343
|
-
const timestamp = this.milliseconds();
|
|
6344
|
-
const data = this.safeValue(response, 'data', []);
|
|
6345
|
-
const rates = {
|
|
6346
|
-
'info': response,
|
|
6347
|
-
};
|
|
6348
|
-
for (let i = 0; i < data.length; i++) {
|
|
6349
|
-
const rate = data[i];
|
|
6350
|
-
const currencies = this.safeValue(rate, 'currencies', []);
|
|
6351
|
-
const symbolRates = {};
|
|
6352
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6353
|
-
const currency = currencies[j];
|
|
6354
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6355
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6356
|
-
symbolRates[code] = {
|
|
6357
|
-
'currency': code,
|
|
6358
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6359
|
-
'span': 86400000,
|
|
6360
|
-
'timestamp': timestamp,
|
|
6361
|
-
'datetime': this.iso8601(timestamp),
|
|
6362
|
-
};
|
|
6363
|
-
}
|
|
6364
|
-
const marketId = this.safeString(rate, 'symbol');
|
|
6365
|
-
const symbol = this.safeSymbol(marketId);
|
|
6366
|
-
rates[symbol] = symbolRates;
|
|
6367
|
-
}
|
|
6368
|
-
return rates;
|
|
6369
|
-
}
|
|
6370
|
-
async fetchBorrowRates(params = {}) {
|
|
6371
|
-
/**
|
|
6372
|
-
* @method
|
|
6373
|
-
* @name huobi#fetchBorrowRates
|
|
6327
|
+
* @name htx#fetchIsolatedBorrowRates
|
|
6374
6328
|
* @description fetch the borrow interest rates of all currencies
|
|
6375
|
-
* @param {object} [params] extra parameters specific to the
|
|
6376
|
-
* @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}
|
|
6377
6331
|
*/
|
|
6378
6332
|
await this.loadMarkets();
|
|
6379
6333
|
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6334
|
+
//
|
|
6380
6335
|
// {
|
|
6381
6336
|
// "status": "ok",
|
|
6382
6337
|
// "data": [
|
|
@@ -6404,28 +6359,57 @@ class htx extends htx$1 {
|
|
|
6404
6359
|
// ...
|
|
6405
6360
|
// ]
|
|
6406
6361
|
// }
|
|
6407
|
-
|
|
6362
|
+
//
|
|
6408
6363
|
const data = this.safeValue(response, 'data', []);
|
|
6409
|
-
const rates =
|
|
6364
|
+
const rates = [];
|
|
6410
6365
|
for (let i = 0; i < data.length; i++) {
|
|
6411
|
-
|
|
6412
|
-
const currencies = this.safeValue(market, 'currencies', []);
|
|
6413
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6414
|
-
const currency = currencies[j];
|
|
6415
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6416
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6417
|
-
rates[code] = {
|
|
6418
|
-
'currency': code,
|
|
6419
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6420
|
-
'span': 86400000,
|
|
6421
|
-
'timestamp': timestamp,
|
|
6422
|
-
'datetime': this.iso8601(timestamp),
|
|
6423
|
-
'info': undefined,
|
|
6424
|
-
};
|
|
6425
|
-
}
|
|
6366
|
+
rates.push(this.parseIsolatedBorrowRate(data[i]));
|
|
6426
6367
|
}
|
|
6427
6368
|
return rates;
|
|
6428
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
|
+
}
|
|
6429
6413
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6430
6414
|
/**
|
|
6431
6415
|
* @method
|
|
@@ -6437,9 +6421,11 @@ class htx extends htx$1 {
|
|
|
6437
6421
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
6438
6422
|
* @param {int} [limit] not used by huobi, but filtered internally by ccxt
|
|
6439
6423
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6440
|
-
* @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}
|
|
6441
6425
|
*/
|
|
6442
|
-
|
|
6426
|
+
if (symbol === undefined) {
|
|
6427
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
6428
|
+
}
|
|
6443
6429
|
let paginate = false;
|
|
6444
6430
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
6445
6431
|
if (paginate) {
|
|
@@ -6552,7 +6538,7 @@ class htx extends htx$1 {
|
|
|
6552
6538
|
* @description fetch the current funding rate
|
|
6553
6539
|
* @param {string} symbol unified market symbol
|
|
6554
6540
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6555
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
6541
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6556
6542
|
*/
|
|
6557
6543
|
await this.loadMarkets();
|
|
6558
6544
|
const market = this.market(symbol);
|
|
@@ -6595,7 +6581,7 @@ class htx extends htx$1 {
|
|
|
6595
6581
|
* @description fetch the funding rate for multiple markets
|
|
6596
6582
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
6597
6583
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6598
|
-
* @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
|
|
6599
6585
|
*/
|
|
6600
6586
|
await this.loadMarkets();
|
|
6601
6587
|
symbols = this.marketSymbols(symbols);
|
|
@@ -6644,7 +6630,7 @@ class htx extends htx$1 {
|
|
|
6644
6630
|
* @param {int} [since] the earliest time in ms to fetch borrrow interest for
|
|
6645
6631
|
* @param {int} [limit] the maximum number of structures to retrieve
|
|
6646
6632
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6647
|
-
* @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}
|
|
6648
6634
|
*/
|
|
6649
6635
|
await this.loadMarkets();
|
|
6650
6636
|
let marginMode = undefined;
|
|
@@ -6931,7 +6917,7 @@ class htx extends htx$1 {
|
|
|
6931
6917
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6932
6918
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6933
6919
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6934
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
6920
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6935
6921
|
*/
|
|
6936
6922
|
await this.loadMarkets();
|
|
6937
6923
|
const market = this.market(symbol);
|
|
@@ -7021,7 +7007,9 @@ class htx extends htx$1 {
|
|
|
7021
7007
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7022
7008
|
* @returns {object} response from the exchange
|
|
7023
7009
|
*/
|
|
7024
|
-
|
|
7010
|
+
if (symbol === undefined) {
|
|
7011
|
+
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
7012
|
+
}
|
|
7025
7013
|
await this.loadMarkets();
|
|
7026
7014
|
const market = this.market(symbol);
|
|
7027
7015
|
const [marketType, query] = this.handleMarketTypeAndParams('setLeverage', market, params);
|
|
@@ -7207,7 +7195,7 @@ class htx extends htx$1 {
|
|
|
7207
7195
|
* @description fetch all open positions
|
|
7208
7196
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7209
7197
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7210
|
-
* @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}
|
|
7211
7199
|
*/
|
|
7212
7200
|
await this.loadMarkets();
|
|
7213
7201
|
symbols = this.marketSymbols(symbols);
|
|
@@ -7336,7 +7324,7 @@ class htx extends htx$1 {
|
|
|
7336
7324
|
* @description fetch data on a single open contract trade position
|
|
7337
7325
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
7338
7326
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7339
|
-
* @returns {object} a [position structure]{@link https://
|
|
7327
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7340
7328
|
*/
|
|
7341
7329
|
await this.loadMarkets();
|
|
7342
7330
|
const market = this.market(symbol);
|
|
@@ -7656,7 +7644,7 @@ class htx extends htx$1 {
|
|
|
7656
7644
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7657
7645
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
7658
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)
|
|
7659
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
7647
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
7660
7648
|
*/
|
|
7661
7649
|
await this.loadMarkets();
|
|
7662
7650
|
let paginate = false;
|
|
@@ -7730,7 +7718,7 @@ class htx extends htx$1 {
|
|
|
7730
7718
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
7731
7719
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7732
7720
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7733
|
-
* @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
|
|
7734
7722
|
*/
|
|
7735
7723
|
await this.loadMarkets();
|
|
7736
7724
|
const response = await this.contractPublicGetLinearSwapApiV1SwapAdjustfactor(params);
|
|
@@ -7773,7 +7761,7 @@ class htx extends htx$1 {
|
|
|
7773
7761
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
7774
7762
|
* @param {string} symbol unified market symbol
|
|
7775
7763
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7776
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
7764
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
7777
7765
|
*/
|
|
7778
7766
|
await this.loadMarkets();
|
|
7779
7767
|
const request = {};
|
|
@@ -7866,7 +7854,7 @@ class htx extends htx$1 {
|
|
|
7866
7854
|
* @param {object} [params] Exchange specific parameters
|
|
7867
7855
|
* @param {int} [params.amount_type] *required* Open interest unit. 1-cont,2-cryptocurrency
|
|
7868
7856
|
* @param {int} [params.pair] eg BTC-USDT *Only for USDT-M*
|
|
7869
|
-
* @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}
|
|
7870
7858
|
*/
|
|
7871
7859
|
if (timeframe !== '1h' && timeframe !== '4h' && timeframe !== '12h' && timeframe !== '1d') {
|
|
7872
7860
|
throw new errors.BadRequest(this.id + ' fetchOpenInterestHistory cannot only use the 1h, 4h, 12h and 1d timeframe');
|
|
@@ -7978,7 +7966,7 @@ class htx extends htx$1 {
|
|
|
7978
7966
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-swap-open-interest-information
|
|
7979
7967
|
* @param {string} symbol Unified CCXT market symbol
|
|
7980
7968
|
* @param {object} [params] exchange specific parameters
|
|
7981
|
-
* @returns {object} an open interest structure{@link https://
|
|
7969
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7982
7970
|
*/
|
|
7983
7971
|
await this.loadMarkets();
|
|
7984
7972
|
const market = this.market(symbol);
|
|
@@ -8151,7 +8139,7 @@ class htx extends htx$1 {
|
|
|
8151
8139
|
* @param {float} amount the amount to borrow
|
|
8152
8140
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8153
8141
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8154
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8142
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8155
8143
|
*/
|
|
8156
8144
|
await this.loadMarkets();
|
|
8157
8145
|
const currency = this.currency(code);
|
|
@@ -8164,7 +8152,9 @@ class htx extends htx$1 {
|
|
|
8164
8152
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
8165
8153
|
let method = undefined;
|
|
8166
8154
|
if (marginMode === 'isolated') {
|
|
8167
|
-
|
|
8155
|
+
if (symbol === undefined) {
|
|
8156
|
+
throw new errors.ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
|
|
8157
|
+
}
|
|
8168
8158
|
const market = this.market(symbol);
|
|
8169
8159
|
request['symbol'] = market['id'];
|
|
8170
8160
|
method = 'privatePostMarginOrders';
|
|
@@ -8203,7 +8193,7 @@ class htx extends htx$1 {
|
|
|
8203
8193
|
* @param {float} amount the amount to repay
|
|
8204
8194
|
* @param {string} symbol unified market symbol
|
|
8205
8195
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8206
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8196
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8207
8197
|
*/
|
|
8208
8198
|
await this.loadMarkets();
|
|
8209
8199
|
const currency = this.currency(code);
|
|
@@ -8283,9 +8273,11 @@ class htx extends htx$1 {
|
|
|
8283
8273
|
* @param {int} [params.until] timestamp in ms, value range = start_time -> current time,default = current time
|
|
8284
8274
|
* @param {int} [params.page_index] page index, default page 1 if not filled
|
|
8285
8275
|
* @param {int} [params.code] unified currency code, can be used when symbol is undefined
|
|
8286
|
-
* @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}
|
|
8287
8277
|
*/
|
|
8288
|
-
|
|
8278
|
+
if (symbol === undefined) {
|
|
8279
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
8280
|
+
}
|
|
8289
8281
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
8290
8282
|
params = this.omit(params, ['until', 'till']);
|
|
8291
8283
|
const market = this.market(symbol);
|
|
@@ -8380,7 +8372,7 @@ class htx extends htx$1 {
|
|
|
8380
8372
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-currencies-v2
|
|
8381
8373
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
8382
8374
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8383
|
-
* @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}
|
|
8384
8376
|
*/
|
|
8385
8377
|
await this.loadMarkets();
|
|
8386
8378
|
const response = await this.spotPublicGetV2ReferenceCurrencies(params);
|
|
@@ -8596,7 +8588,7 @@ class htx extends htx$1 {
|
|
|
8596
8588
|
* @param {object} [params] exchange specific parameters for the huobi api endpoint
|
|
8597
8589
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
8598
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
|
|
8599
|
-
* @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}
|
|
8600
8592
|
*/
|
|
8601
8593
|
await this.loadMarkets();
|
|
8602
8594
|
const market = this.market(symbol);
|