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/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,
|
|
@@ -499,6 +500,7 @@ export default class htx extends Exchange {
|
|
|
499
500
|
// Future Market Data interface
|
|
500
501
|
'api/v1/contract_contract_info': 1,
|
|
501
502
|
'api/v1/contract_index': 1,
|
|
503
|
+
'api/v1/contract_query_elements': 1,
|
|
502
504
|
'api/v1/contract_price_limit': 1,
|
|
503
505
|
'api/v1/contract_open_interest': 1,
|
|
504
506
|
'api/v1/contract_delivery_price': 1,
|
|
@@ -528,6 +530,7 @@ export default class htx extends Exchange {
|
|
|
528
530
|
// Swap Market Data interface
|
|
529
531
|
'swap-api/v1/swap_contract_info': 1,
|
|
530
532
|
'swap-api/v1/swap_index': 1,
|
|
533
|
+
'swap-api/v1/swap_query_elements': 1,
|
|
531
534
|
'swap-api/v1/swap_price_limit': 1,
|
|
532
535
|
'swap-api/v1/swap_open_interest': 1,
|
|
533
536
|
'swap-ex/market/depth': 1,
|
|
@@ -560,6 +563,7 @@ export default class htx extends Exchange {
|
|
|
560
563
|
// Swap Market Data interface
|
|
561
564
|
'linear-swap-api/v1/swap_contract_info': 1,
|
|
562
565
|
'linear-swap-api/v1/swap_index': 1,
|
|
566
|
+
'linear-swap-api/v1/swap_query_elements': 1,
|
|
563
567
|
'linear-swap-api/v1/swap_price_limit': 1,
|
|
564
568
|
'linear-swap-api/v1/swap_open_interest': 1,
|
|
565
569
|
'linear-swap-ex/market/depth': 1,
|
|
@@ -1485,7 +1489,7 @@ export default class htx extends Exchange {
|
|
|
1485
1489
|
* @description fetch the trading fees for a market
|
|
1486
1490
|
* @param {string} symbol unified market symbol
|
|
1487
1491
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
1488
|
-
* @returns {object} a [fee structure]{@link https://
|
|
1492
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
1489
1493
|
*/
|
|
1490
1494
|
await this.loadMarkets();
|
|
1491
1495
|
const market = this.market(symbol);
|
|
@@ -2025,7 +2029,7 @@ export default class htx extends Exchange {
|
|
|
2025
2029
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2026
2030
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2027
2031
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2028
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
2032
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2029
2033
|
*/
|
|
2030
2034
|
await this.loadMarkets();
|
|
2031
2035
|
const market = this.market(symbol);
|
|
@@ -2108,7 +2112,7 @@ export default class htx extends Exchange {
|
|
|
2108
2112
|
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-a-batch-of-market-data-overview-v2
|
|
2109
2113
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2110
2114
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2111
|
-
* @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}
|
|
2112
2116
|
*/
|
|
2113
2117
|
await this.loadMarkets();
|
|
2114
2118
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2262,7 +2266,7 @@ export default class htx extends Exchange {
|
|
|
2262
2266
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2263
2267
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2264
2268
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2265
|
-
* @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
|
|
2266
2270
|
*/
|
|
2267
2271
|
await this.loadMarkets();
|
|
2268
2272
|
const market = this.market(symbol);
|
|
@@ -2490,7 +2494,7 @@ export default class htx extends Exchange {
|
|
|
2490
2494
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2491
2495
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
2492
2496
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2493
|
-
* @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}
|
|
2494
2498
|
*/
|
|
2495
2499
|
let market = undefined;
|
|
2496
2500
|
if (symbol !== undefined) {
|
|
@@ -2525,7 +2529,7 @@ export default class htx extends Exchange {
|
|
|
2525
2529
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2526
2530
|
* @param {int} [params.until] the latest time in ms to fetch trades for
|
|
2527
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)
|
|
2528
|
-
* @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}
|
|
2529
2533
|
*/
|
|
2530
2534
|
await this.loadMarkets();
|
|
2531
2535
|
let paginate = false;
|
|
@@ -2575,7 +2579,9 @@ export default class htx extends Exchange {
|
|
|
2575
2579
|
method = 'spotPrivateGetV1OrderMatchresults';
|
|
2576
2580
|
}
|
|
2577
2581
|
else {
|
|
2578
|
-
|
|
2582
|
+
if (symbol === undefined) {
|
|
2583
|
+
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
2584
|
+
}
|
|
2579
2585
|
request['contract'] = market['id'];
|
|
2580
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
|
|
2581
2587
|
if (since !== undefined) {
|
|
@@ -2696,7 +2702,7 @@ export default class htx extends Exchange {
|
|
|
2696
2702
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2697
2703
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2698
2704
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2699
|
-
* @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}
|
|
2700
2706
|
*/
|
|
2701
2707
|
await this.loadMarkets();
|
|
2702
2708
|
const market = this.market(symbol);
|
|
@@ -2943,7 +2949,7 @@ export default class htx extends Exchange {
|
|
|
2943
2949
|
* @name huobi#fetchAccounts
|
|
2944
2950
|
* @description fetch all the accounts associated with a profile
|
|
2945
2951
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
2946
|
-
* @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
|
|
2947
2953
|
*/
|
|
2948
2954
|
await this.loadMarkets();
|
|
2949
2955
|
const response = await this.spotPrivateGetV1AccountAccounts(params);
|
|
@@ -3187,7 +3193,7 @@ export default class htx extends Exchange {
|
|
|
3187
3193
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
3188
3194
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3189
3195
|
* @param {bool} [params.unified] provide this parameter if you have a recent account with unified cross+isolated margin account
|
|
3190
|
-
* @returns {object} a [balance structure]{@link https://
|
|
3196
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
3191
3197
|
*/
|
|
3192
3198
|
await this.loadMarkets();
|
|
3193
3199
|
let type = undefined;
|
|
@@ -3514,7 +3520,7 @@ export default class htx extends Exchange {
|
|
|
3514
3520
|
* @description fetches information on an order made by the user
|
|
3515
3521
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3516
3522
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
3517
|
-
* @returns {object} An [order structure]{@link https://
|
|
3523
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3518
3524
|
*/
|
|
3519
3525
|
await this.loadMarkets();
|
|
3520
3526
|
let market = undefined;
|
|
@@ -3551,7 +3557,9 @@ export default class htx extends Exchange {
|
|
|
3551
3557
|
}
|
|
3552
3558
|
}
|
|
3553
3559
|
else {
|
|
3554
|
-
|
|
3560
|
+
if (symbol === undefined) {
|
|
3561
|
+
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3562
|
+
}
|
|
3555
3563
|
request['contract_code'] = market['id'];
|
|
3556
3564
|
if (market['linear']) {
|
|
3557
3565
|
let marginMode = undefined;
|
|
@@ -3736,7 +3744,9 @@ export default class htx extends Exchange {
|
|
|
3736
3744
|
async fetchSpotOrdersByStates(states, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3737
3745
|
const method = this.safeString(this.options, 'fetchOrdersByStatesMethod', 'spot_private_get_v1_order_orders'); // spot_private_get_v1_order_history
|
|
3738
3746
|
if (method === 'spot_private_get_v1_order_orders') {
|
|
3739
|
-
|
|
3747
|
+
if (symbol === undefined) {
|
|
3748
|
+
throw new ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
3749
|
+
}
|
|
3740
3750
|
}
|
|
3741
3751
|
await this.loadMarkets();
|
|
3742
3752
|
let market = undefined;
|
|
@@ -3806,7 +3816,9 @@ export default class htx extends Exchange {
|
|
|
3806
3816
|
return await this.fetchSpotOrdersByStates('filled,partial-canceled,canceled', symbol, since, limit, params);
|
|
3807
3817
|
}
|
|
3808
3818
|
async fetchContractOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3809
|
-
|
|
3819
|
+
if (symbol === undefined) {
|
|
3820
|
+
throw new ArgumentsRequired(this.id + ' fetchContractOrders() requires a symbol argument');
|
|
3821
|
+
}
|
|
3810
3822
|
await this.loadMarkets();
|
|
3811
3823
|
const market = this.market(symbol);
|
|
3812
3824
|
let request = {
|
|
@@ -4063,7 +4075,7 @@ export default class htx extends Exchange {
|
|
|
4063
4075
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4064
4076
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4065
4077
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4066
|
-
* @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}
|
|
4067
4079
|
*/
|
|
4068
4080
|
await this.loadMarkets();
|
|
4069
4081
|
let market = undefined;
|
|
@@ -4100,7 +4112,7 @@ export default class htx extends Exchange {
|
|
|
4100
4112
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4101
4113
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4102
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)
|
|
4103
|
-
* @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}
|
|
4104
4116
|
*/
|
|
4105
4117
|
await this.loadMarkets();
|
|
4106
4118
|
let paginate = false;
|
|
@@ -4135,7 +4147,7 @@ export default class htx extends Exchange {
|
|
|
4135
4147
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
4136
4148
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
4137
4149
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
4138
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4150
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4139
4151
|
*/
|
|
4140
4152
|
await this.loadMarkets();
|
|
4141
4153
|
let market = undefined;
|
|
@@ -4173,7 +4185,9 @@ export default class htx extends Exchange {
|
|
|
4173
4185
|
response = await this.spotPrivateGetV1OrderOpenOrders(this.extend(request, params));
|
|
4174
4186
|
}
|
|
4175
4187
|
else {
|
|
4176
|
-
|
|
4188
|
+
if (symbol === undefined) {
|
|
4189
|
+
throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
|
|
4190
|
+
}
|
|
4177
4191
|
if (limit !== undefined) {
|
|
4178
4192
|
request['page_size'] = limit;
|
|
4179
4193
|
}
|
|
@@ -5060,7 +5074,7 @@ export default class htx extends Exchange {
|
|
|
5060
5074
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
5061
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
|
|
5062
5076
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
5063
|
-
* @returns {object} an [order structure]{@link https://
|
|
5077
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5064
5078
|
*/
|
|
5065
5079
|
await this.loadMarkets();
|
|
5066
5080
|
const market = this.market(symbol);
|
|
@@ -5208,7 +5222,7 @@ export default class htx extends Exchange {
|
|
|
5208
5222
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders
|
|
5209
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
|
|
5210
5224
|
* @param {object} [params] extra parameters specific to the htx api endpoint
|
|
5211
|
-
* @returns {object} an [order structure]{@link https://
|
|
5225
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5212
5226
|
*/
|
|
5213
5227
|
await this.loadMarkets();
|
|
5214
5228
|
const ordersRequests = [];
|
|
@@ -5342,7 +5356,7 @@ export default class htx extends Exchange {
|
|
|
5342
5356
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5343
5357
|
* @param {bool} [params.stop] *contract only* if the order is a stop trigger order or not
|
|
5344
5358
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the order is a stop-loss or take-profit order
|
|
5345
|
-
* @returns {object} An [order structure]{@link https://
|
|
5359
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5346
5360
|
*/
|
|
5347
5361
|
await this.loadMarkets();
|
|
5348
5362
|
let market = undefined;
|
|
@@ -5377,7 +5391,9 @@ export default class htx extends Exchange {
|
|
|
5377
5391
|
}
|
|
5378
5392
|
}
|
|
5379
5393
|
else {
|
|
5380
|
-
|
|
5394
|
+
if (symbol === undefined) {
|
|
5395
|
+
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
5396
|
+
}
|
|
5381
5397
|
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5382
5398
|
if (clientOrderId === undefined) {
|
|
5383
5399
|
request['order_id'] = id;
|
|
@@ -5484,7 +5500,7 @@ export default class htx extends Exchange {
|
|
|
5484
5500
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5485
5501
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5486
5502
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5487
|
-
* @returns {object} an list of [order structures]{@link https://
|
|
5503
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5488
5504
|
*/
|
|
5489
5505
|
await this.loadMarkets();
|
|
5490
5506
|
let market = undefined;
|
|
@@ -5527,7 +5543,9 @@ export default class htx extends Exchange {
|
|
|
5527
5543
|
response = await this.spotPrivatePostV1OrderOrdersBatchcancel(this.extend(request, params));
|
|
5528
5544
|
}
|
|
5529
5545
|
else {
|
|
5530
|
-
|
|
5546
|
+
if (symbol === undefined) {
|
|
5547
|
+
throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
5548
|
+
}
|
|
5531
5549
|
let clientOrderIds = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
5532
5550
|
clientOrderIds = this.safeString2(params, 'client_order_ids', 'clientOrderIds', clientOrderIds);
|
|
5533
5551
|
if (clientOrderIds === undefined) {
|
|
@@ -5663,7 +5681,7 @@ export default class htx extends Exchange {
|
|
|
5663
5681
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5664
5682
|
* @param {bool} [params.stop] *contract only* if the orders are stop trigger orders or not
|
|
5665
5683
|
* @param {bool} [params.stopLossTakeProfit] *contract only* if the orders are stop-loss or take-profit orders
|
|
5666
|
-
* @returns {object[]} a list of [order structures]{@link https://
|
|
5684
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5667
5685
|
*/
|
|
5668
5686
|
await this.loadMarkets();
|
|
5669
5687
|
let market = undefined;
|
|
@@ -5694,7 +5712,9 @@ export default class htx extends Exchange {
|
|
|
5694
5712
|
response = await this.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(this.extend(request, params));
|
|
5695
5713
|
}
|
|
5696
5714
|
else {
|
|
5697
|
-
|
|
5715
|
+
if (symbol === undefined) {
|
|
5716
|
+
throw new ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
5717
|
+
}
|
|
5698
5718
|
if (market['future']) {
|
|
5699
5719
|
request['symbol'] = market['settleId'];
|
|
5700
5720
|
}
|
|
@@ -5815,7 +5835,7 @@ export default class htx extends Exchange {
|
|
|
5815
5835
|
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
5816
5836
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
5817
5837
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5818
|
-
* @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
|
|
5819
5839
|
*/
|
|
5820
5840
|
await this.loadMarkets();
|
|
5821
5841
|
const currency = this.currency(code);
|
|
@@ -5847,7 +5867,7 @@ export default class htx extends Exchange {
|
|
|
5847
5867
|
* @description fetch the deposit address for a currency associated with this account
|
|
5848
5868
|
* @param {string} code unified currency code
|
|
5849
5869
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5850
|
-
* @returns {object} an [address structure]{@link https://
|
|
5870
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
5851
5871
|
*/
|
|
5852
5872
|
await this.loadMarkets();
|
|
5853
5873
|
const currency = this.currency(code);
|
|
@@ -5899,7 +5919,7 @@ export default class htx extends Exchange {
|
|
|
5899
5919
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5900
5920
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5901
5921
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5902
|
-
* @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}
|
|
5903
5923
|
*/
|
|
5904
5924
|
if (limit === undefined || limit > 100) {
|
|
5905
5925
|
limit = 100;
|
|
@@ -5958,7 +5978,7 @@ export default class htx extends Exchange {
|
|
|
5958
5978
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5959
5979
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5960
5980
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
5961
|
-
* @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}
|
|
5962
5982
|
*/
|
|
5963
5983
|
if (limit === undefined || limit > 100) {
|
|
5964
5984
|
limit = 100;
|
|
@@ -6134,7 +6154,7 @@ export default class htx extends Exchange {
|
|
|
6134
6154
|
* @param {string} address the address to withdraw to
|
|
6135
6155
|
* @param {string} tag
|
|
6136
6156
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6137
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
6157
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
6138
6158
|
*/
|
|
6139
6159
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
6140
6160
|
await this.loadMarkets();
|
|
@@ -6226,7 +6246,7 @@ export default class htx extends Exchange {
|
|
|
6226
6246
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6227
6247
|
* @param {string} [params.symbol] used for isolated margin transfer
|
|
6228
6248
|
* @param {string} [params.subType] 'linear' or 'inverse', only used when transfering to/from swap accounts
|
|
6229
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
6249
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6230
6250
|
*/
|
|
6231
6251
|
await this.loadMarkets();
|
|
6232
6252
|
const currency = this.currency(code);
|
|
@@ -6304,82 +6324,17 @@ export default class htx extends Exchange {
|
|
|
6304
6324
|
//
|
|
6305
6325
|
return this.parseTransfer(response, currency);
|
|
6306
6326
|
}
|
|
6307
|
-
async
|
|
6327
|
+
async fetchIsolatedBorrowRates(params = {}) {
|
|
6308
6328
|
/**
|
|
6309
6329
|
* @method
|
|
6310
|
-
* @name
|
|
6311
|
-
* @description fetch borrow rates for currencies within individual markets
|
|
6312
|
-
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6313
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} indexed by market symbol
|
|
6314
|
-
*/
|
|
6315
|
-
await this.loadMarkets();
|
|
6316
|
-
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6317
|
-
//
|
|
6318
|
-
// {
|
|
6319
|
-
// "status": "ok",
|
|
6320
|
-
// "data": [
|
|
6321
|
-
// {
|
|
6322
|
-
// "symbol": "1inchusdt",
|
|
6323
|
-
// "currencies": [
|
|
6324
|
-
// {
|
|
6325
|
-
// "currency": "1inch",
|
|
6326
|
-
// "interest-rate": "0.00098",
|
|
6327
|
-
// "min-loan-amt": "90.000000000000000000",
|
|
6328
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6329
|
-
// "loanable-amt": "0.0",
|
|
6330
|
-
// "actual-rate": "0.00098"
|
|
6331
|
-
// },
|
|
6332
|
-
// {
|
|
6333
|
-
// "currency": "usdt",
|
|
6334
|
-
// "interest-rate": "0.00098",
|
|
6335
|
-
// "min-loan-amt": "100.000000000000000000",
|
|
6336
|
-
// "max-loan-amt": "1000.000000000000000000",
|
|
6337
|
-
// "loanable-amt": "0.0",
|
|
6338
|
-
// "actual-rate": "0.00098"
|
|
6339
|
-
// }
|
|
6340
|
-
// ]
|
|
6341
|
-
// },
|
|
6342
|
-
// ...
|
|
6343
|
-
// ]
|
|
6344
|
-
// }
|
|
6345
|
-
//
|
|
6346
|
-
const timestamp = this.milliseconds();
|
|
6347
|
-
const data = this.safeValue(response, 'data', []);
|
|
6348
|
-
const rates = {
|
|
6349
|
-
'info': response,
|
|
6350
|
-
};
|
|
6351
|
-
for (let i = 0; i < data.length; i++) {
|
|
6352
|
-
const rate = data[i];
|
|
6353
|
-
const currencies = this.safeValue(rate, 'currencies', []);
|
|
6354
|
-
const symbolRates = {};
|
|
6355
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6356
|
-
const currency = currencies[j];
|
|
6357
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6358
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6359
|
-
symbolRates[code] = {
|
|
6360
|
-
'currency': code,
|
|
6361
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6362
|
-
'span': 86400000,
|
|
6363
|
-
'timestamp': timestamp,
|
|
6364
|
-
'datetime': this.iso8601(timestamp),
|
|
6365
|
-
};
|
|
6366
|
-
}
|
|
6367
|
-
const marketId = this.safeString(rate, 'symbol');
|
|
6368
|
-
const symbol = this.safeSymbol(marketId);
|
|
6369
|
-
rates[symbol] = symbolRates;
|
|
6370
|
-
}
|
|
6371
|
-
return rates;
|
|
6372
|
-
}
|
|
6373
|
-
async fetchBorrowRates(params = {}) {
|
|
6374
|
-
/**
|
|
6375
|
-
* @method
|
|
6376
|
-
* @name huobi#fetchBorrowRates
|
|
6330
|
+
* @name htx#fetchIsolatedBorrowRates
|
|
6377
6331
|
* @description fetch the borrow interest rates of all currencies
|
|
6378
|
-
* @param {object} [params] extra parameters specific to the
|
|
6379
|
-
* @returns {object} a list of [borrow rate structures]{@link https://
|
|
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}
|
|
6380
6334
|
*/
|
|
6381
6335
|
await this.loadMarkets();
|
|
6382
6336
|
const response = await this.spotPrivateGetV1MarginLoanInfo(params);
|
|
6337
|
+
//
|
|
6383
6338
|
// {
|
|
6384
6339
|
// "status": "ok",
|
|
6385
6340
|
// "data": [
|
|
@@ -6407,28 +6362,57 @@ export default class htx extends Exchange {
|
|
|
6407
6362
|
// ...
|
|
6408
6363
|
// ]
|
|
6409
6364
|
// }
|
|
6410
|
-
|
|
6365
|
+
//
|
|
6411
6366
|
const data = this.safeValue(response, 'data', []);
|
|
6412
|
-
const rates =
|
|
6367
|
+
const rates = [];
|
|
6413
6368
|
for (let i = 0; i < data.length; i++) {
|
|
6414
|
-
|
|
6415
|
-
const currencies = this.safeValue(market, 'currencies', []);
|
|
6416
|
-
for (let j = 0; j < currencies.length; j++) {
|
|
6417
|
-
const currency = currencies[j];
|
|
6418
|
-
const currencyId = this.safeString(currency, 'currency');
|
|
6419
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
6420
|
-
rates[code] = {
|
|
6421
|
-
'currency': code,
|
|
6422
|
-
'rate': this.safeNumber(currency, 'actual-rate'),
|
|
6423
|
-
'span': 86400000,
|
|
6424
|
-
'timestamp': timestamp,
|
|
6425
|
-
'datetime': this.iso8601(timestamp),
|
|
6426
|
-
'info': undefined,
|
|
6427
|
-
};
|
|
6428
|
-
}
|
|
6369
|
+
rates.push(this.parseIsolatedBorrowRate(data[i]));
|
|
6429
6370
|
}
|
|
6430
6371
|
return rates;
|
|
6431
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
|
+
}
|
|
6432
6416
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6433
6417
|
/**
|
|
6434
6418
|
* @method
|
|
@@ -6440,9 +6424,11 @@ export default class htx extends Exchange {
|
|
|
6440
6424
|
* @param {int} [since] not used by huobi, but filtered internally by ccxt
|
|
6441
6425
|
* @param {int} [limit] not used by huobi, but filtered internally by ccxt
|
|
6442
6426
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6443
|
-
* @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}
|
|
6444
6428
|
*/
|
|
6445
|
-
|
|
6429
|
+
if (symbol === undefined) {
|
|
6430
|
+
throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
6431
|
+
}
|
|
6446
6432
|
let paginate = false;
|
|
6447
6433
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
6448
6434
|
if (paginate) {
|
|
@@ -6555,7 +6541,7 @@ export default class htx extends Exchange {
|
|
|
6555
6541
|
* @description fetch the current funding rate
|
|
6556
6542
|
* @param {string} symbol unified market symbol
|
|
6557
6543
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6558
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
6544
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6559
6545
|
*/
|
|
6560
6546
|
await this.loadMarkets();
|
|
6561
6547
|
const market = this.market(symbol);
|
|
@@ -6598,7 +6584,7 @@ export default class htx extends Exchange {
|
|
|
6598
6584
|
* @description fetch the funding rate for multiple markets
|
|
6599
6585
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
6600
6586
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6601
|
-
* @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
|
|
6602
6588
|
*/
|
|
6603
6589
|
await this.loadMarkets();
|
|
6604
6590
|
symbols = this.marketSymbols(symbols);
|
|
@@ -6647,7 +6633,7 @@ export default class htx extends Exchange {
|
|
|
6647
6633
|
* @param {int} [since] the earliest time in ms to fetch borrrow interest for
|
|
6648
6634
|
* @param {int} [limit] the maximum number of structures to retrieve
|
|
6649
6635
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6650
|
-
* @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}
|
|
6651
6637
|
*/
|
|
6652
6638
|
await this.loadMarkets();
|
|
6653
6639
|
let marginMode = undefined;
|
|
@@ -6934,7 +6920,7 @@ export default class htx extends Exchange {
|
|
|
6934
6920
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6935
6921
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6936
6922
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
6937
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
6923
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6938
6924
|
*/
|
|
6939
6925
|
await this.loadMarkets();
|
|
6940
6926
|
const market = this.market(symbol);
|
|
@@ -7024,7 +7010,9 @@ export default class htx extends Exchange {
|
|
|
7024
7010
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7025
7011
|
* @returns {object} response from the exchange
|
|
7026
7012
|
*/
|
|
7027
|
-
|
|
7013
|
+
if (symbol === undefined) {
|
|
7014
|
+
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
7015
|
+
}
|
|
7028
7016
|
await this.loadMarkets();
|
|
7029
7017
|
const market = this.market(symbol);
|
|
7030
7018
|
const [marketType, query] = this.handleMarketTypeAndParams('setLeverage', market, params);
|
|
@@ -7210,7 +7198,7 @@ export default class htx extends Exchange {
|
|
|
7210
7198
|
* @description fetch all open positions
|
|
7211
7199
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7212
7200
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7213
|
-
* @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}
|
|
7214
7202
|
*/
|
|
7215
7203
|
await this.loadMarkets();
|
|
7216
7204
|
symbols = this.marketSymbols(symbols);
|
|
@@ -7339,7 +7327,7 @@ export default class htx extends Exchange {
|
|
|
7339
7327
|
* @description fetch data on a single open contract trade position
|
|
7340
7328
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
7341
7329
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7342
|
-
* @returns {object} a [position structure]{@link https://
|
|
7330
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7343
7331
|
*/
|
|
7344
7332
|
await this.loadMarkets();
|
|
7345
7333
|
const market = this.market(symbol);
|
|
@@ -7659,7 +7647,7 @@ export default class htx extends Exchange {
|
|
|
7659
7647
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7660
7648
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
7661
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)
|
|
7662
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
7650
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
7663
7651
|
*/
|
|
7664
7652
|
await this.loadMarkets();
|
|
7665
7653
|
let paginate = false;
|
|
@@ -7733,7 +7721,7 @@ export default class htx extends Exchange {
|
|
|
7733
7721
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
7734
7722
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7735
7723
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7736
|
-
* @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
|
|
7737
7725
|
*/
|
|
7738
7726
|
await this.loadMarkets();
|
|
7739
7727
|
const response = await this.contractPublicGetLinearSwapApiV1SwapAdjustfactor(params);
|
|
@@ -7776,7 +7764,7 @@ export default class htx extends Exchange {
|
|
|
7776
7764
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
7777
7765
|
* @param {string} symbol unified market symbol
|
|
7778
7766
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
7779
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
7767
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
7780
7768
|
*/
|
|
7781
7769
|
await this.loadMarkets();
|
|
7782
7770
|
const request = {};
|
|
@@ -7869,7 +7857,7 @@ export default class htx extends Exchange {
|
|
|
7869
7857
|
* @param {object} [params] Exchange specific parameters
|
|
7870
7858
|
* @param {int} [params.amount_type] *required* Open interest unit. 1-cont,2-cryptocurrency
|
|
7871
7859
|
* @param {int} [params.pair] eg BTC-USDT *Only for USDT-M*
|
|
7872
|
-
* @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}
|
|
7873
7861
|
*/
|
|
7874
7862
|
if (timeframe !== '1h' && timeframe !== '4h' && timeframe !== '12h' && timeframe !== '1d') {
|
|
7875
7863
|
throw new BadRequest(this.id + ' fetchOpenInterestHistory cannot only use the 1h, 4h, 12h and 1d timeframe');
|
|
@@ -7981,7 +7969,7 @@ export default class htx extends Exchange {
|
|
|
7981
7969
|
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-swap-open-interest-information
|
|
7982
7970
|
* @param {string} symbol Unified CCXT market symbol
|
|
7983
7971
|
* @param {object} [params] exchange specific parameters
|
|
7984
|
-
* @returns {object} an open interest structure{@link https://
|
|
7972
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7985
7973
|
*/
|
|
7986
7974
|
await this.loadMarkets();
|
|
7987
7975
|
const market = this.market(symbol);
|
|
@@ -8154,7 +8142,7 @@ export default class htx extends Exchange {
|
|
|
8154
8142
|
* @param {float} amount the amount to borrow
|
|
8155
8143
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
8156
8144
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8157
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8145
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8158
8146
|
*/
|
|
8159
8147
|
await this.loadMarkets();
|
|
8160
8148
|
const currency = this.currency(code);
|
|
@@ -8167,7 +8155,9 @@ export default class htx extends Exchange {
|
|
|
8167
8155
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
8168
8156
|
let method = undefined;
|
|
8169
8157
|
if (marginMode === 'isolated') {
|
|
8170
|
-
|
|
8158
|
+
if (symbol === undefined) {
|
|
8159
|
+
throw new ArgumentsRequired(this.id + ' borrowMargin() requires a symbol argument');
|
|
8160
|
+
}
|
|
8171
8161
|
const market = this.market(symbol);
|
|
8172
8162
|
request['symbol'] = market['id'];
|
|
8173
8163
|
method = 'privatePostMarginOrders';
|
|
@@ -8206,7 +8196,7 @@ export default class htx extends Exchange {
|
|
|
8206
8196
|
* @param {float} amount the amount to repay
|
|
8207
8197
|
* @param {string} symbol unified market symbol
|
|
8208
8198
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8209
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
8199
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8210
8200
|
*/
|
|
8211
8201
|
await this.loadMarkets();
|
|
8212
8202
|
const currency = this.currency(code);
|
|
@@ -8286,9 +8276,11 @@ export default class htx extends Exchange {
|
|
|
8286
8276
|
* @param {int} [params.until] timestamp in ms, value range = start_time -> current time,default = current time
|
|
8287
8277
|
* @param {int} [params.page_index] page index, default page 1 if not filled
|
|
8288
8278
|
* @param {int} [params.code] unified currency code, can be used when symbol is undefined
|
|
8289
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://
|
|
8279
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
8290
8280
|
*/
|
|
8291
|
-
|
|
8281
|
+
if (symbol === undefined) {
|
|
8282
|
+
throw new ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
8283
|
+
}
|
|
8292
8284
|
const until = this.safeInteger2(params, 'until', 'till');
|
|
8293
8285
|
params = this.omit(params, ['until', 'till']);
|
|
8294
8286
|
const market = this.market(symbol);
|
|
@@ -8383,7 +8375,7 @@ export default class htx extends Exchange {
|
|
|
8383
8375
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-currencies-v2
|
|
8384
8376
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
8385
8377
|
* @param {object} [params] extra parameters specific to the huobi api endpoint
|
|
8386
|
-
* @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}
|
|
8387
8379
|
*/
|
|
8388
8380
|
await this.loadMarkets();
|
|
8389
8381
|
const response = await this.spotPublicGetV2ReferenceCurrencies(params);
|
|
@@ -8599,7 +8591,7 @@ export default class htx extends Exchange {
|
|
|
8599
8591
|
* @param {object} [params] exchange specific parameters for the huobi api endpoint
|
|
8600
8592
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
8601
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
|
|
8602
|
-
* @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}
|
|
8603
8595
|
*/
|
|
8604
8596
|
await this.loadMarkets();
|
|
8605
8597
|
const market = this.market(symbol);
|