ccxt 4.1.43 → 4.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/change.sh +2 -4
- package/dist/ccxt.browser.js +12641 -12877
- package/dist/ccxt.browser.min.js +9 -9
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +4 -6
- package/dist/cjs/src/ascendex.js +65 -67
- package/dist/cjs/src/bigone.js +109 -113
- package/dist/cjs/src/binance.js +274 -269
- package/dist/cjs/src/bingx.js +117 -117
- package/dist/cjs/src/bit2c.js +6 -8
- package/dist/cjs/src/bitbank.js +19 -19
- package/dist/cjs/src/bitbns.js +5 -15
- package/dist/cjs/src/bitfinex.js +73 -75
- package/dist/cjs/src/bitfinex2.js +60 -62
- package/dist/cjs/src/bitflyer.js +4 -12
- package/dist/cjs/src/bitforex.js +4 -8
- package/dist/cjs/src/bitget.js +355 -355
- package/dist/cjs/src/bithumb.js +39 -45
- package/dist/cjs/src/bitmart.js +100 -95
- package/dist/cjs/src/bitmex.js +113 -117
- package/dist/cjs/src/bitopro.js +18 -28
- package/dist/cjs/src/bitpanda.js +8 -8
- package/dist/cjs/src/bitrue.js +23 -31
- package/dist/cjs/src/bitso.js +212 -212
- package/dist/cjs/src/bitstamp.js +95 -95
- package/dist/cjs/src/bittrex.js +28 -28
- package/dist/cjs/src/bitvavo.js +37 -42
- package/dist/cjs/src/bl3p.js +18 -18
- package/dist/cjs/src/blockchaincom.js +24 -24
- package/dist/cjs/src/btcalpha.js +27 -27
- package/dist/cjs/src/btctradeua.js +2 -4
- package/dist/cjs/src/btcturk.js +6 -6
- package/dist/cjs/src/bybit.js +50 -247
- package/dist/cjs/src/cex.js +107 -109
- package/dist/cjs/src/coinbase.js +179 -179
- package/dist/cjs/src/coinbasepro.js +115 -115
- package/dist/cjs/src/coincheck.js +21 -21
- package/dist/cjs/src/coinex.js +26 -43
- package/dist/cjs/src/coinfalcon.js +54 -56
- package/dist/cjs/src/coinlist.js +150 -150
- package/dist/cjs/src/coinmate.js +69 -71
- package/dist/cjs/src/coinone.js +11 -15
- package/dist/cjs/src/coinsph.js +113 -121
- package/dist/cjs/src/coinspot.js +28 -28
- package/dist/cjs/src/cryptocom.js +32 -32
- package/dist/cjs/src/currencycom.js +54 -58
- package/dist/cjs/src/delta.js +3 -3
- package/dist/cjs/src/deribit.js +285 -284
- package/dist/cjs/src/exmo.js +41 -41
- package/dist/cjs/src/gate.js +176 -180
- package/dist/cjs/src/gemini.js +5 -7
- package/dist/cjs/src/hitbtc.js +316 -127
- package/dist/cjs/src/hollaex.js +79 -81
- package/dist/cjs/src/huobi.js +270 -279
- package/dist/cjs/src/huobijp.js +126 -128
- package/dist/cjs/src/idex.js +202 -202
- package/dist/cjs/src/indodax.js +4 -10
- package/dist/cjs/src/kraken.js +161 -161
- package/dist/cjs/src/krakenfutures.js +223 -223
- package/dist/cjs/src/kucoin.js +122 -122
- package/dist/cjs/src/kucoinfutures.js +130 -135
- package/dist/cjs/src/kuna.js +24 -24
- package/dist/cjs/src/latoken.js +70 -70
- package/dist/cjs/src/lbank.js +6 -6
- package/dist/cjs/src/lbank2.js +35 -35
- package/dist/cjs/src/luno.js +6 -8
- package/dist/cjs/src/lykke.js +4 -4
- package/dist/cjs/src/mercado.js +24 -34
- package/dist/cjs/src/mexc.js +177 -187
- package/dist/cjs/src/ndax.js +9 -8
- package/dist/cjs/src/oceanex.js +11 -13
- package/dist/cjs/src/okcoin.js +65 -65
- package/dist/cjs/src/okx.js +81 -86
- package/dist/cjs/src/phemex.js +122 -143
- package/dist/cjs/src/poloniex.js +43 -43
- package/dist/cjs/src/poloniexfutures.js +98 -102
- package/dist/cjs/src/pro/alpaca.js +174 -174
- package/dist/cjs/src/pro/ascendex.js +151 -151
- package/dist/cjs/src/pro/binance.js +278 -278
- package/dist/cjs/src/pro/bingx.js +136 -136
- package/dist/cjs/src/pro/bitfinex.js +38 -38
- package/dist/cjs/src/pro/bitfinex2.js +57 -57
- package/dist/cjs/src/pro/bitget.js +227 -227
- package/dist/cjs/src/pro/bitmart.js +100 -102
- package/dist/cjs/src/pro/bitmex.js +584 -584
- package/dist/cjs/src/pro/bitopro.js +49 -49
- package/dist/cjs/src/pro/bitpanda.js +249 -249
- package/dist/cjs/src/pro/bitrue.js +79 -83
- package/dist/cjs/src/pro/bitstamp.js +61 -63
- package/dist/cjs/src/pro/bittrex.js +107 -107
- package/dist/cjs/src/pro/bitvavo.js +118 -122
- package/dist/cjs/src/pro/blockchaincom.js +169 -169
- package/dist/cjs/src/pro/bybit.js +57 -57
- package/dist/cjs/src/pro/cex.js +201 -205
- package/dist/cjs/src/pro/coinbase.js +4 -4
- package/dist/cjs/src/pro/coinbasepro.js +95 -95
- package/dist/cjs/src/pro/coinex.js +232 -232
- package/dist/cjs/src/pro/cryptocom.js +32 -32
- package/dist/cjs/src/pro/currencycom.js +108 -108
- package/dist/cjs/src/pro/deribit.js +140 -140
- package/dist/cjs/src/pro/exmo.js +72 -72
- package/dist/cjs/src/pro/gate.js +160 -160
- package/dist/cjs/src/pro/gemini.js +135 -135
- package/dist/cjs/src/pro/hitbtc.js +10 -10
- package/dist/cjs/src/pro/hollaex.js +88 -88
- package/dist/cjs/src/pro/huobi.js +277 -277
- package/dist/cjs/src/pro/huobijp.js +71 -71
- package/dist/cjs/src/pro/idex.js +58 -58
- package/dist/cjs/src/pro/independentreserve.js +29 -29
- package/dist/cjs/src/pro/kraken.js +113 -113
- package/dist/cjs/src/pro/krakenfutures.js +58 -58
- package/dist/cjs/src/pro/kucoin.js +95 -95
- package/dist/cjs/src/pro/kucoinfutures.js +100 -100
- package/dist/cjs/src/pro/luno.js +42 -42
- package/dist/cjs/src/pro/mexc.js +98 -98
- package/dist/cjs/src/pro/ndax.js +24 -24
- package/dist/cjs/src/pro/okcoin.js +104 -104
- package/dist/cjs/src/pro/okx.js +161 -161
- package/dist/cjs/src/pro/phemex.js +295 -295
- package/dist/cjs/src/pro/poloniex.js +79 -79
- package/dist/cjs/src/pro/poloniexfutures.js +172 -172
- package/dist/cjs/src/pro/probit.js +87 -87
- package/dist/cjs/src/pro/upbit.js +66 -66
- package/dist/cjs/src/pro/wazirx.js +11 -11
- package/dist/cjs/src/pro/whitebit.js +80 -84
- package/dist/cjs/src/pro/woo.js +78 -78
- package/dist/cjs/src/probit.js +45 -49
- package/dist/cjs/src/tidex.js +9 -9
- package/dist/cjs/src/tokocrypto.js +60 -64
- package/dist/cjs/src/upbit.js +157 -157
- package/dist/cjs/src/wavesexchange.js +127 -129
- package/dist/cjs/src/wazirx.js +4 -10
- package/dist/cjs/src/whitebit.js +66 -70
- package/dist/cjs/src/woo.js +244 -246
- package/dist/cjs/src/yobit.js +12 -16
- package/dist/cjs/src/zonda.js +103 -103
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bequant.d.ts +37 -7
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bitcoincom.d.ts +37 -7
- package/js/src/abstract/bybit.d.ts +16 -195
- package/js/src/abstract/fmfwio.d.ts +37 -7
- package/js/src/abstract/hitbtc.d.ts +37 -7
- package/js/src/abstract/hitbtc3.d.ts +37 -7
- package/js/src/abstract/okex.d.ts +6 -1
- package/js/src/abstract/okex5.d.ts +6 -1
- package/js/src/abstract/okx.d.ts +6 -1
- package/js/src/ace.d.ts +10 -10
- package/js/src/ace.js +5 -7
- package/js/src/alpaca.d.ts +4 -4
- package/js/src/ascendex.d.ts +12 -36
- package/js/src/ascendex.js +65 -67
- package/js/src/base/types.d.ts +8 -0
- package/js/src/bigone.d.ts +12 -50
- package/js/src/bigone.js +110 -114
- package/js/src/binance.d.ts +9 -66
- package/js/src/binance.js +274 -269
- package/js/src/bingx.d.ts +11 -35
- package/js/src/bingx.js +117 -117
- package/js/src/bit2c.d.ts +9 -9
- package/js/src/bit2c.js +7 -9
- package/js/src/bitbank.d.ts +11 -51
- package/js/src/bitbank.js +19 -19
- package/js/src/bitbns.d.ts +10 -30
- package/js/src/bitbns.js +5 -15
- package/js/src/bitfinex.d.ts +10 -58
- package/js/src/bitfinex.js +73 -75
- package/js/src/bitfinex2.d.ts +5 -29
- package/js/src/bitfinex2.js +60 -62
- package/js/src/bitflyer.d.ts +11 -51
- package/js/src/bitflyer.js +4 -12
- package/js/src/bitforex.d.ts +9 -9
- package/js/src/bitforex.js +5 -9
- package/js/src/bitget.d.ts +8 -28
- package/js/src/bitget.js +355 -355
- package/js/src/bithumb.d.ts +11 -51
- package/js/src/bithumb.js +39 -45
- package/js/src/bitmart.d.ts +12 -69
- package/js/src/bitmart.js +100 -95
- package/js/src/bitmex.d.ts +8 -56
- package/js/src/bitmex.js +113 -117
- package/js/src/bitopro.d.ts +13 -85
- package/js/src/bitopro.js +18 -28
- package/js/src/bitpanda.d.ts +13 -51
- package/js/src/bitpanda.js +8 -8
- package/js/src/bitrue.d.ts +13 -53
- package/js/src/bitrue.js +23 -31
- package/js/src/bitso.d.ts +13 -73
- package/js/src/bitso.js +212 -212
- package/js/src/bitstamp.d.ts +14 -66
- package/js/src/bitstamp.js +95 -95
- package/js/src/bitstamp1.d.ts +9 -9
- package/js/src/bittrex.d.ts +14 -58
- package/js/src/bittrex.js +28 -28
- package/js/src/bitvavo.d.ts +9 -45
- package/js/src/bitvavo.js +37 -42
- package/js/src/bl3p.d.ts +8 -8
- package/js/src/bl3p.js +18 -18
- package/js/src/blockchaincom.d.ts +13 -93
- package/js/src/blockchaincom.js +24 -24
- package/js/src/btcalpha.d.ts +11 -31
- package/js/src/btcalpha.js +27 -27
- package/js/src/btcbox.d.ts +8 -8
- package/js/src/btcmarkets.d.ts +12 -60
- package/js/src/btctradeua.d.ts +8 -8
- package/js/src/btctradeua.js +3 -5
- package/js/src/btcturk.d.ts +7 -7
- package/js/src/btcturk.js +6 -6
- package/js/src/bybit.d.ts +9 -47
- package/js/src/bybit.js +50 -247
- package/js/src/cex.d.ts +9 -9
- package/js/src/cex.js +107 -109
- package/js/src/coinbase.d.ts +10 -10
- package/js/src/coinbase.js +179 -179
- package/js/src/coinbasepro.d.ts +9 -57
- package/js/src/coinbasepro.js +115 -115
- package/js/src/coincheck.d.ts +10 -30
- package/js/src/coincheck.js +21 -21
- package/js/src/coinex.d.ts +9 -53
- package/js/src/coinex.js +26 -43
- package/js/src/coinfalcon.d.ts +9 -53
- package/js/src/coinfalcon.js +55 -57
- package/js/src/coinlist.d.ts +23 -61
- package/js/src/coinlist.js +150 -150
- package/js/src/coinmate.d.ts +10 -58
- package/js/src/coinmate.js +70 -72
- package/js/src/coinone.d.ts +10 -10
- package/js/src/coinone.js +11 -15
- package/js/src/coinsph.d.ts +14 -74
- package/js/src/coinsph.js +113 -121
- package/js/src/coinspot.d.ts +10 -10
- package/js/src/coinspot.js +28 -28
- package/js/src/cryptocom.d.ts +6 -46
- package/js/src/cryptocom.js +32 -32
- package/js/src/currencycom.d.ts +9 -33
- package/js/src/currencycom.js +54 -58
- package/js/src/delta.d.ts +10 -10
- package/js/src/delta.js +3 -3
- package/js/src/deribit.d.ts +14 -50
- package/js/src/deribit.js +285 -284
- package/js/src/digifinex.d.ts +12 -50
- package/js/src/exmo.d.ts +10 -106
- package/js/src/exmo.js +41 -41
- package/js/src/gate.d.ts +7 -51
- package/js/src/gate.js +176 -180
- package/js/src/gemini.d.ts +10 -48
- package/js/src/gemini.js +5 -7
- package/js/src/hitbtc.d.ts +8 -55
- package/js/src/hitbtc.js +317 -128
- package/js/src/hollaex.d.ts +13 -70
- package/js/src/hollaex.js +79 -81
- package/js/src/huobi.d.ts +7 -53
- package/js/src/huobi.js +270 -279
- package/js/src/huobijp.d.ts +9 -55
- package/js/src/huobijp.js +127 -129
- package/js/src/idex.d.ts +13 -89
- package/js/src/idex.js +202 -202
- package/js/src/independentreserve.d.ts +9 -9
- package/js/src/indodax.d.ts +11 -51
- package/js/src/indodax.js +4 -10
- package/js/src/kraken.d.ts +9 -53
- package/js/src/kraken.js +161 -161
- package/js/src/krakenfutures.d.ts +6 -6
- package/js/src/krakenfutures.js +223 -223
- package/js/src/kucoin.d.ts +7 -47
- package/js/src/kucoin.js +122 -122
- package/js/src/kucoinfutures.d.ts +6 -6
- package/js/src/kucoinfutures.js +130 -135
- package/js/src/kuna.d.ts +15 -107
- package/js/src/kuna.js +25 -24
- package/js/src/latoken.d.ts +9 -33
- package/js/src/latoken.js +70 -70
- package/js/src/lbank.d.ts +10 -64
- package/js/src/lbank.js +6 -6
- package/js/src/lbank2.d.ts +8 -29
- package/js/src/lbank2.js +35 -35
- package/js/src/luno.d.ts +10 -10
- package/js/src/luno.js +6 -8
- package/js/src/lykke.d.ts +12 -50
- package/js/src/lykke.js +4 -4
- package/js/src/mercado.d.ts +8 -48
- package/js/src/mercado.js +24 -34
- package/js/src/mexc.d.ts +11 -49
- package/js/src/mexc.js +177 -187
- package/js/src/ndax.d.ts +11 -47
- package/js/src/ndax.js +9 -8
- package/js/src/novadax.d.ts +13 -61
- package/js/src/oceanex.d.ts +8 -8
- package/js/src/oceanex.js +11 -13
- package/js/src/okcoin.d.ts +11 -55
- package/js/src/okcoin.js +65 -65
- package/js/src/okx.d.ts +10 -98
- package/js/src/okx.js +81 -86
- package/js/src/paymium.d.ts +8 -8
- package/js/src/phemex.d.ts +8 -27
- package/js/src/phemex.js +122 -143
- package/js/src/poloniex.d.ts +8 -56
- package/js/src/poloniex.js +43 -43
- package/js/src/poloniexfutures.d.ts +10 -10
- package/js/src/poloniexfutures.js +98 -102
- package/js/src/pro/alpaca.d.ts +2 -2
- package/js/src/pro/alpaca.js +174 -174
- package/js/src/pro/ascendex.js +151 -151
- package/js/src/pro/binance.d.ts +2 -19
- package/js/src/pro/binance.js +278 -278
- package/js/src/pro/bingx.js +136 -136
- package/js/src/pro/bitfinex.d.ts +2 -2
- package/js/src/pro/bitfinex.js +38 -38
- package/js/src/pro/bitfinex2.js +57 -57
- package/js/src/pro/bitget.js +227 -227
- package/js/src/pro/bitmart.js +100 -102
- package/js/src/pro/bitmex.js +584 -584
- package/js/src/pro/bitopro.js +49 -49
- package/js/src/pro/bitpanda.js +249 -249
- package/js/src/pro/bitrue.js +79 -83
- package/js/src/pro/bitstamp.js +62 -64
- package/js/src/pro/bittrex.js +107 -107
- package/js/src/pro/bitvavo.js +119 -123
- package/js/src/pro/blockchaincom.js +169 -169
- package/js/src/pro/bybit.js +57 -57
- package/js/src/pro/cex.js +202 -206
- package/js/src/pro/coinbase.js +4 -4
- package/js/src/pro/coinbasepro.d.ts +2 -2
- package/js/src/pro/coinbasepro.js +95 -95
- package/js/src/pro/coinex.js +232 -232
- package/js/src/pro/cryptocom.js +32 -32
- package/js/src/pro/currencycom.js +108 -108
- package/js/src/pro/deribit.js +140 -140
- package/js/src/pro/exmo.js +72 -72
- package/js/src/pro/gate.js +160 -160
- package/js/src/pro/gemini.js +135 -135
- package/js/src/pro/hitbtc.js +10 -10
- package/js/src/pro/hollaex.js +88 -88
- package/js/src/pro/huobi.js +277 -277
- package/js/src/pro/huobijp.js +71 -71
- package/js/src/pro/idex.js +58 -58
- package/js/src/pro/independentreserve.js +29 -29
- package/js/src/pro/kraken.js +113 -113
- package/js/src/pro/krakenfutures.js +58 -58
- package/js/src/pro/kucoin.js +95 -95
- package/js/src/pro/kucoinfutures.js +100 -100
- package/js/src/pro/luno.d.ts +2 -2
- package/js/src/pro/luno.js +42 -42
- package/js/src/pro/mexc.js +98 -98
- package/js/src/pro/ndax.js +24 -24
- package/js/src/pro/okcoin.js +104 -104
- package/js/src/pro/okx.js +161 -161
- package/js/src/pro/phemex.js +295 -295
- package/js/src/pro/poloniex.js +79 -79
- package/js/src/pro/poloniexfutures.js +172 -172
- package/js/src/pro/probit.js +87 -87
- package/js/src/pro/upbit.js +66 -66
- package/js/src/pro/wazirx.js +11 -11
- package/js/src/pro/whitebit.js +81 -85
- package/js/src/pro/woo.js +78 -78
- package/js/src/probit.d.ts +12 -50
- package/js/src/probit.js +46 -50
- package/js/src/tidex.d.ts +8 -62
- package/js/src/tidex.js +9 -9
- package/js/src/timex.d.ts +11 -44
- package/js/src/tokocrypto.d.ts +11 -61
- package/js/src/tokocrypto.js +61 -65
- package/js/src/upbit.d.ts +7 -51
- package/js/src/upbit.js +157 -157
- package/js/src/wavesexchange.d.ts +9 -49
- package/js/src/wavesexchange.js +128 -130
- package/js/src/wazirx.d.ts +9 -9
- package/js/src/wazirx.js +5 -11
- package/js/src/whitebit.d.ts +9 -55
- package/js/src/whitebit.js +66 -70
- package/js/src/woo.d.ts +10 -48
- package/js/src/woo.js +245 -247
- package/js/src/yobit.d.ts +3 -3
- package/js/src/yobit.js +12 -16
- package/js/src/zaif.d.ts +10 -50
- package/js/src/zonda.d.ts +8 -48
- package/js/src/zonda.js +103 -103
- package/package.json +2 -1
package/js/src/hitbtc.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import Exchange from './abstract/hitbtc.js';
|
|
8
8
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
9
9
|
import { Precise } from './base/Precise.js';
|
|
10
|
-
import { BadSymbol, BadRequest, OnMaintenance, AccountSuspended, PermissionDenied, ExchangeError, RateLimitExceeded, ExchangeNotAvailable, OrderNotFound, InsufficientFunds, InvalidOrder, AuthenticationError, ArgumentsRequired } from './base/errors.js';
|
|
10
|
+
import { BadSymbol, BadRequest, OnMaintenance, AccountSuspended, PermissionDenied, ExchangeError, RateLimitExceeded, ExchangeNotAvailable, OrderNotFound, InsufficientFunds, InvalidOrder, AuthenticationError, ArgumentsRequired, NotSupported } from './base/errors.js';
|
|
11
11
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
/**
|
|
13
13
|
* @class hitbtc
|
|
@@ -42,6 +42,7 @@ export default class hitbtc extends Exchange {
|
|
|
42
42
|
'createStopMarketOrder': true,
|
|
43
43
|
'createStopOrder': true,
|
|
44
44
|
'editOrder': true,
|
|
45
|
+
'fetchAccounts': false,
|
|
45
46
|
'fetchBalance': true,
|
|
46
47
|
'fetchBorrowRate': undefined,
|
|
47
48
|
'fetchBorrowRateHistories': undefined,
|
|
@@ -57,15 +58,20 @@ export default class hitbtc extends Exchange {
|
|
|
57
58
|
'fetchFundingHistory': undefined,
|
|
58
59
|
'fetchFundingRate': true,
|
|
59
60
|
'fetchFundingRateHistory': true,
|
|
60
|
-
'fetchFundingRates':
|
|
61
|
+
'fetchFundingRates': true,
|
|
61
62
|
'fetchIndexOHLCV': true,
|
|
62
63
|
'fetchLeverage': true,
|
|
63
64
|
'fetchLeverageTiers': undefined,
|
|
64
|
-
'
|
|
65
|
+
'fetchLiquidations': false,
|
|
66
|
+
'fetchMarginMode': false,
|
|
67
|
+
'fetchMarketLeverageTiers': false,
|
|
65
68
|
'fetchMarkets': true,
|
|
66
69
|
'fetchMarkOHLCV': true,
|
|
70
|
+
'fetchMyLiquidations': false,
|
|
67
71
|
'fetchMyTrades': true,
|
|
68
72
|
'fetchOHLCV': true,
|
|
73
|
+
'fetchOpenInterest': true,
|
|
74
|
+
'fetchOpenInterestHistory': false,
|
|
69
75
|
'fetchOpenOrder': true,
|
|
70
76
|
'fetchOpenOrders': true,
|
|
71
77
|
'fetchOrder': true,
|
|
@@ -85,6 +91,7 @@ export default class hitbtc extends Exchange {
|
|
|
85
91
|
'fetchWithdrawals': true,
|
|
86
92
|
'reduceMargin': true,
|
|
87
93
|
'setLeverage': true,
|
|
94
|
+
'setMargin': false,
|
|
88
95
|
'setMarginMode': false,
|
|
89
96
|
'setPositionMode': false,
|
|
90
97
|
'transfer': true,
|
|
@@ -116,56 +123,79 @@ export default class hitbtc extends Exchange {
|
|
|
116
123
|
'public': {
|
|
117
124
|
'get': {
|
|
118
125
|
'public/currency': 10,
|
|
126
|
+
'public/currency/{currency}': 10,
|
|
119
127
|
'public/symbol': 10,
|
|
128
|
+
'public/symbol/{symbol}': 10,
|
|
120
129
|
'public/ticker': 10,
|
|
130
|
+
'public/ticker/{symbol}': 10,
|
|
121
131
|
'public/price/rate': 10,
|
|
132
|
+
'public/price/history': 10,
|
|
133
|
+
'public/price/ticker': 10,
|
|
134
|
+
'public/price/ticker/{symbol}': 10,
|
|
122
135
|
'public/trades': 10,
|
|
136
|
+
'public/trades/{symbol}': 10,
|
|
123
137
|
'public/orderbook': 10,
|
|
138
|
+
'public/orderbook/{symbol}': 10,
|
|
124
139
|
'public/candles': 10,
|
|
140
|
+
'public/candles/{symbol}': 10,
|
|
125
141
|
'public/futures/info': 10,
|
|
142
|
+
'public/futures/info/{symbol}': 10,
|
|
126
143
|
'public/futures/history/funding': 10,
|
|
144
|
+
'public/futures/history/funding/{symbol}': 10,
|
|
127
145
|
'public/futures/candles/index_price': 10,
|
|
146
|
+
'public/futures/candles/index_price/{symbol}': 10,
|
|
128
147
|
'public/futures/candles/mark_price': 10,
|
|
148
|
+
'public/futures/candles/mark_price/{symbol}': 10,
|
|
129
149
|
'public/futures/candles/premium_index': 10,
|
|
150
|
+
'public/futures/candles/premium_index/{symbol}': 10,
|
|
130
151
|
'public/futures/candles/open_interest': 10,
|
|
152
|
+
'public/futures/candles/open_interest/{symbol}': 10,
|
|
131
153
|
},
|
|
132
154
|
},
|
|
133
155
|
'private': {
|
|
134
156
|
'get': {
|
|
135
157
|
'spot/balance': 15,
|
|
136
|
-
'spot/
|
|
137
|
-
'spot/order
|
|
158
|
+
'spot/balance/{currency}': 15,
|
|
159
|
+
'spot/order': 1,
|
|
160
|
+
'spot/order/{client_order_id}': 1,
|
|
138
161
|
'spot/fee': 15,
|
|
139
162
|
'spot/fee/{symbol}': 15,
|
|
140
163
|
'spot/history/order': 15,
|
|
141
164
|
'spot/history/trade': 15,
|
|
142
|
-
'margin/account':
|
|
143
|
-
'margin/account/isolated/{symbol}':
|
|
144
|
-
'margin/
|
|
145
|
-
'margin/order
|
|
146
|
-
'margin/
|
|
165
|
+
'margin/account': 1,
|
|
166
|
+
'margin/account/isolated/{symbol}': 1,
|
|
167
|
+
'margin/account/cross/{currency}': 1,
|
|
168
|
+
'margin/order': 1,
|
|
169
|
+
'margin/order/{client_order_id}': 1,
|
|
170
|
+
'margin/config': 15,
|
|
147
171
|
'margin/history/order': 15,
|
|
148
|
-
'margin/history/positions': 15,
|
|
149
172
|
'margin/history/trade': 15,
|
|
173
|
+
'margin/history/positions': 15,
|
|
174
|
+
'margin/history/clearing': 15,
|
|
150
175
|
'futures/balance': 15,
|
|
151
|
-
'futures/
|
|
152
|
-
'futures/account
|
|
153
|
-
'futures/
|
|
154
|
-
'futures/order
|
|
176
|
+
'futures/balance/{currency}': 15,
|
|
177
|
+
'futures/account': 1,
|
|
178
|
+
'futures/account/isolated/{symbol}': 1,
|
|
179
|
+
'futures/order': 1,
|
|
180
|
+
'futures/order/{client_order_id}': 1,
|
|
181
|
+
'futures/config': 15,
|
|
155
182
|
'futures/fee': 15,
|
|
156
183
|
'futures/fee/{symbol}': 15,
|
|
157
|
-
'futures/history/clearing': 15,
|
|
158
184
|
'futures/history/order': 15,
|
|
159
|
-
'futures/history/positions': 15,
|
|
160
185
|
'futures/history/trade': 15,
|
|
161
|
-
'
|
|
162
|
-
'
|
|
163
|
-
'wallet/
|
|
164
|
-
'wallet/
|
|
165
|
-
'wallet/crypto/address
|
|
166
|
-
'wallet/
|
|
167
|
-
'wallet/crypto/
|
|
168
|
-
'wallet/crypto/
|
|
186
|
+
'futures/history/positions': 15,
|
|
187
|
+
'futures/history/clearing': 15,
|
|
188
|
+
'wallet/balance': 30,
|
|
189
|
+
'wallet/balance/{currency}': 30,
|
|
190
|
+
'wallet/crypto/address': 30,
|
|
191
|
+
'wallet/crypto/address/recent-deposit': 30,
|
|
192
|
+
'wallet/crypto/address/recent-withdraw': 30,
|
|
193
|
+
'wallet/crypto/address/check-mine': 30,
|
|
194
|
+
'wallet/transactions': 30,
|
|
195
|
+
'wallet/transactions/{tx_id}': 30,
|
|
196
|
+
'wallet/crypto/fee/estimate': 30,
|
|
197
|
+
'wallet/airdrops': 30,
|
|
198
|
+
'wallet/amount-locks': 30,
|
|
169
199
|
'sub-account': 15,
|
|
170
200
|
'sub-account/acl': 15,
|
|
171
201
|
'sub-account/balance/{subAccID}': 15,
|
|
@@ -173,12 +203,19 @@ export default class hitbtc extends Exchange {
|
|
|
173
203
|
},
|
|
174
204
|
'post': {
|
|
175
205
|
'spot/order': 1,
|
|
206
|
+
'spot/order/list': 1,
|
|
176
207
|
'margin/order': 1,
|
|
208
|
+
'margin/order/list': 1,
|
|
177
209
|
'futures/order': 1,
|
|
178
|
-
'
|
|
179
|
-
'wallet/crypto/address':
|
|
180
|
-
'wallet/crypto/withdraw':
|
|
181
|
-
'wallet/
|
|
210
|
+
'futures/order/list': 1,
|
|
211
|
+
'wallet/crypto/address': 30,
|
|
212
|
+
'wallet/crypto/withdraw': 30,
|
|
213
|
+
'wallet/convert': 30,
|
|
214
|
+
'wallet/transfer': 30,
|
|
215
|
+
'wallet/internal/withdraw': 30,
|
|
216
|
+
'wallet/crypto/check-offchain-available': 30,
|
|
217
|
+
'wallet/crypto/fees/estimate': 30,
|
|
218
|
+
'wallet/airdrops/{id}/claim': 30,
|
|
182
219
|
'sub-account/freeze': 15,
|
|
183
220
|
'sub-account/activate': 15,
|
|
184
221
|
'sub-account/transfer': 15,
|
|
@@ -197,15 +234,15 @@ export default class hitbtc extends Exchange {
|
|
|
197
234
|
'margin/order': 1,
|
|
198
235
|
'margin/order/{client_order_id}': 1,
|
|
199
236
|
'futures/position': 1,
|
|
200
|
-
'futures/position/
|
|
237
|
+
'futures/position/{margin_mode}/{symbol}': 1,
|
|
201
238
|
'futures/order': 1,
|
|
202
239
|
'futures/order/{client_order_id}': 1,
|
|
203
|
-
'wallet/crypto/withdraw/{id}':
|
|
240
|
+
'wallet/crypto/withdraw/{id}': 30,
|
|
204
241
|
},
|
|
205
242
|
'put': {
|
|
206
243
|
'margin/account/isolated/{symbol}': 1,
|
|
207
244
|
'futures/account/isolated/{symbol}': 1,
|
|
208
|
-
'wallet/crypto/withdraw/{id}':
|
|
245
|
+
'wallet/crypto/withdraw/{id}': 30,
|
|
209
246
|
},
|
|
210
247
|
},
|
|
211
248
|
},
|
|
@@ -998,18 +1035,38 @@ export default class hitbtc extends Exchange {
|
|
|
998
1035
|
* @method
|
|
999
1036
|
* @name hitbtc#fetchTicker
|
|
1000
1037
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1038
|
+
* @see https://api.hitbtc.com/#tickers
|
|
1001
1039
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1002
1040
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
1003
1041
|
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
1004
1042
|
*/
|
|
1005
|
-
|
|
1006
|
-
|
|
1043
|
+
await this.loadMarkets();
|
|
1044
|
+
const market = this.market(symbol);
|
|
1045
|
+
const request = {
|
|
1046
|
+
'symbol': market['id'],
|
|
1047
|
+
};
|
|
1048
|
+
const response = await this.publicGetPublicTickerSymbol(this.extend(request, params));
|
|
1049
|
+
//
|
|
1050
|
+
// {
|
|
1051
|
+
// "ask": "0.020572",
|
|
1052
|
+
// "bid": "0.020566",
|
|
1053
|
+
// "last": "0.020574",
|
|
1054
|
+
// "low": "0.020388",
|
|
1055
|
+
// "high": "0.021084",
|
|
1056
|
+
// "open": "0.020913",
|
|
1057
|
+
// "volume": "138444.3666",
|
|
1058
|
+
// "volume_quote": "2853.6874972480",
|
|
1059
|
+
// "timestamp": "2021-06-02T17:52:36.731Z"
|
|
1060
|
+
// }
|
|
1061
|
+
//
|
|
1062
|
+
return this.parseTicker(response, market);
|
|
1007
1063
|
}
|
|
1008
1064
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
1009
1065
|
/**
|
|
1010
1066
|
* @method
|
|
1011
1067
|
* @name hitbtc#fetchTickers
|
|
1012
1068
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
1069
|
+
* @see https://api.hitbtc.com/#tickers
|
|
1013
1070
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1014
1071
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
1015
1072
|
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
@@ -1097,6 +1154,7 @@ export default class hitbtc extends Exchange {
|
|
|
1097
1154
|
* @method
|
|
1098
1155
|
* @name hitbtc#fetchTrades
|
|
1099
1156
|
* @description get the list of most recent trades for a particular symbol
|
|
1157
|
+
* @see https://api.hitbtc.com/#trades
|
|
1100
1158
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1101
1159
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1102
1160
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -1106,20 +1164,26 @@ export default class hitbtc extends Exchange {
|
|
|
1106
1164
|
await this.loadMarkets();
|
|
1107
1165
|
let market = undefined;
|
|
1108
1166
|
const request = {};
|
|
1109
|
-
if (symbol !== undefined) {
|
|
1110
|
-
market = this.market(symbol);
|
|
1111
|
-
// symbol is optional for hitbtc fetchTrades
|
|
1112
|
-
request['symbols'] = market['id'];
|
|
1113
|
-
}
|
|
1114
1167
|
if (limit !== undefined) {
|
|
1115
1168
|
request['limit'] = Math.min(limit, 1000);
|
|
1116
1169
|
}
|
|
1117
1170
|
if (since !== undefined) {
|
|
1118
1171
|
request['from'] = since;
|
|
1119
1172
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1173
|
+
let response = undefined;
|
|
1174
|
+
if (symbol !== undefined) {
|
|
1175
|
+
market = this.market(symbol);
|
|
1176
|
+
request['symbol'] = market['id'];
|
|
1177
|
+
response = await this.publicGetPublicTradesSymbol(this.extend(request, params));
|
|
1178
|
+
}
|
|
1179
|
+
else {
|
|
1180
|
+
response = await this.publicGetPublicTrades(this.extend(request, params));
|
|
1181
|
+
}
|
|
1182
|
+
if (symbol !== undefined) {
|
|
1183
|
+
return this.parseTrades(response, market);
|
|
1184
|
+
}
|
|
1122
1185
|
let trades = [];
|
|
1186
|
+
const marketIds = Object.keys(response);
|
|
1123
1187
|
for (let i = 0; i < marketIds.length; i++) {
|
|
1124
1188
|
const marketId = marketIds[i];
|
|
1125
1189
|
const marketInner = this.market(marketId);
|
|
@@ -1174,38 +1238,38 @@ export default class hitbtc extends Exchange {
|
|
|
1174
1238
|
// createOrder (market)
|
|
1175
1239
|
//
|
|
1176
1240
|
// {
|
|
1177
|
-
// id:
|
|
1178
|
-
// position_id:
|
|
1179
|
-
// quantity:
|
|
1180
|
-
// price:
|
|
1181
|
-
// fee:
|
|
1182
|
-
// timestamp:
|
|
1183
|
-
// taker: true
|
|
1241
|
+
// "id": "1569252895",
|
|
1242
|
+
// "position_id": "0",
|
|
1243
|
+
// "quantity": "10",
|
|
1244
|
+
// "price": "0.03919424",
|
|
1245
|
+
// "fee": "0.000979856000",
|
|
1246
|
+
// "timestamp": "2022-01-25T19:38:36.153Z",
|
|
1247
|
+
// "taker": true
|
|
1184
1248
|
// }
|
|
1185
1249
|
//
|
|
1186
1250
|
// fetchTrades
|
|
1187
1251
|
//
|
|
1188
1252
|
// {
|
|
1189
|
-
// id: 974786185,
|
|
1190
|
-
// price:
|
|
1191
|
-
// qty:
|
|
1192
|
-
// side:
|
|
1193
|
-
// timestamp:
|
|
1253
|
+
// "id": 974786185,
|
|
1254
|
+
// "price": "0.032462",
|
|
1255
|
+
// "qty": "0.3673",
|
|
1256
|
+
// "side": "buy",
|
|
1257
|
+
// "timestamp": "2020-10-16T12:57:39.846Z"
|
|
1194
1258
|
// }
|
|
1195
1259
|
//
|
|
1196
1260
|
// fetchMyTrades spot
|
|
1197
1261
|
//
|
|
1198
1262
|
// {
|
|
1199
|
-
// id: 277210397,
|
|
1200
|
-
// clientOrderId:
|
|
1201
|
-
// orderId: 28102855393,
|
|
1202
|
-
// symbol:
|
|
1203
|
-
// side:
|
|
1204
|
-
// quantity:
|
|
1205
|
-
// price:
|
|
1206
|
-
// fee:
|
|
1207
|
-
// timestamp:
|
|
1208
|
-
// taker: true
|
|
1263
|
+
// "id": 277210397,
|
|
1264
|
+
// "clientOrderId": "6e102f3e7f3f4e04aeeb1cdc95592f1a",
|
|
1265
|
+
// "orderId": 28102855393,
|
|
1266
|
+
// "symbol": "ETHBTC",
|
|
1267
|
+
// "side": "sell",
|
|
1268
|
+
// "quantity": "0.002",
|
|
1269
|
+
// "price": "0.073365",
|
|
1270
|
+
// "fee": "0.000000147",
|
|
1271
|
+
// "timestamp": "2018-04-28T18:39:55.345Z",
|
|
1272
|
+
// "taker": true
|
|
1209
1273
|
// }
|
|
1210
1274
|
//
|
|
1211
1275
|
// fetchMyTrades swap and margin
|
|
@@ -1394,7 +1458,6 @@ export default class hitbtc extends Exchange {
|
|
|
1394
1458
|
'id': id,
|
|
1395
1459
|
'txid': txhash,
|
|
1396
1460
|
'type': type,
|
|
1397
|
-
'code': code,
|
|
1398
1461
|
'currency': code,
|
|
1399
1462
|
'network': undefined,
|
|
1400
1463
|
'amount': amount,
|
|
@@ -1456,6 +1519,7 @@ export default class hitbtc extends Exchange {
|
|
|
1456
1519
|
* @method
|
|
1457
1520
|
* @name hitbtc#fetchOrderBooks
|
|
1458
1521
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
|
|
1522
|
+
* @see https://api.hitbtc.com/#order-books
|
|
1459
1523
|
* @param {string[]|undefined} symbols list of unified market symbols, all symbols fetched if undefined, default is undefined
|
|
1460
1524
|
* @param {int} [limit] max number of entries per orderbook to return, default is undefined
|
|
1461
1525
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
@@ -1487,13 +1551,23 @@ export default class hitbtc extends Exchange {
|
|
|
1487
1551
|
* @method
|
|
1488
1552
|
* @name hitbtc#fetchOrderBook
|
|
1489
1553
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1554
|
+
* @see https://api.hitbtc.com/#order-books
|
|
1490
1555
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1491
1556
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1492
1557
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
1493
1558
|
* @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
1494
1559
|
*/
|
|
1495
|
-
|
|
1496
|
-
|
|
1560
|
+
await this.loadMarkets();
|
|
1561
|
+
const market = this.market(symbol);
|
|
1562
|
+
const request = {
|
|
1563
|
+
'symbol': market['id'],
|
|
1564
|
+
};
|
|
1565
|
+
if (limit !== undefined) {
|
|
1566
|
+
request['depth'] = limit;
|
|
1567
|
+
}
|
|
1568
|
+
const response = await this.publicGetPublicOrderbookSymbol(this.extend(request, params));
|
|
1569
|
+
const timestamp = this.parse8601(this.safeString(response, 'timestamp'));
|
|
1570
|
+
return this.parseOrderBook(response, symbol, timestamp, 'bid', 'ask');
|
|
1497
1571
|
}
|
|
1498
1572
|
parseTradingFee(fee, market = undefined) {
|
|
1499
1573
|
//
|
|
@@ -1579,6 +1653,9 @@ export default class hitbtc extends Exchange {
|
|
|
1579
1653
|
* @name hitbtc#fetchOHLCV
|
|
1580
1654
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1581
1655
|
* @see https://api.hitbtc.com/#candles
|
|
1656
|
+
* @see https://api.hitbtc.com/#futures-index-price-candles
|
|
1657
|
+
* @see https://api.hitbtc.com/#futures-mark-price-candles
|
|
1658
|
+
* @see https://api.hitbtc.com/#futures-premium-index-candles
|
|
1582
1659
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1583
1660
|
* @param {string} timeframe the length of time each candle represents
|
|
1584
1661
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1596,7 +1673,7 @@ export default class hitbtc extends Exchange {
|
|
|
1596
1673
|
}
|
|
1597
1674
|
const market = this.market(symbol);
|
|
1598
1675
|
let request = {
|
|
1599
|
-
'
|
|
1676
|
+
'symbol': market['id'],
|
|
1600
1677
|
'period': this.safeString(this.timeframes, timeframe, timeframe),
|
|
1601
1678
|
};
|
|
1602
1679
|
[request, params] = this.handleUntilOption('till', request, params);
|
|
@@ -1608,50 +1685,47 @@ export default class hitbtc extends Exchange {
|
|
|
1608
1685
|
}
|
|
1609
1686
|
const price = this.safeString(params, 'price');
|
|
1610
1687
|
params = this.omit(params, 'price');
|
|
1611
|
-
let
|
|
1688
|
+
let response = undefined;
|
|
1612
1689
|
if (price === 'mark') {
|
|
1613
|
-
|
|
1690
|
+
response = await this.publicGetPublicFuturesCandlesMarkPriceSymbol(this.extend(request, params));
|
|
1614
1691
|
}
|
|
1615
1692
|
else if (price === 'index') {
|
|
1616
|
-
|
|
1693
|
+
response = await this.publicGetPublicFuturesCandlesIndexPriceSymbol(this.extend(request, params));
|
|
1617
1694
|
}
|
|
1618
1695
|
else if (price === 'premiumIndex') {
|
|
1619
|
-
|
|
1696
|
+
response = await this.publicGetPublicFuturesCandlesPremiumIndexSymbol(this.extend(request, params));
|
|
1697
|
+
}
|
|
1698
|
+
else {
|
|
1699
|
+
response = await this.publicGetPublicCandlesSymbol(this.extend(request, params));
|
|
1620
1700
|
}
|
|
1621
|
-
const response = await this[method](this.extend(request, params));
|
|
1622
1701
|
//
|
|
1623
1702
|
// Spot and Swap
|
|
1624
1703
|
//
|
|
1625
|
-
//
|
|
1626
|
-
//
|
|
1627
|
-
//
|
|
1628
|
-
//
|
|
1629
|
-
//
|
|
1630
|
-
//
|
|
1631
|
-
//
|
|
1632
|
-
//
|
|
1633
|
-
//
|
|
1634
|
-
//
|
|
1635
|
-
//
|
|
1636
|
-
// ]
|
|
1637
|
-
// }
|
|
1704
|
+
// [
|
|
1705
|
+
// {
|
|
1706
|
+
// "timestamp": "2021-10-25T07:38:00.000Z",
|
|
1707
|
+
// "open": "4173.391",
|
|
1708
|
+
// "close": "4170.923",
|
|
1709
|
+
// "min": "4170.923",
|
|
1710
|
+
// "max": "4173.986",
|
|
1711
|
+
// "volume": "0.1879",
|
|
1712
|
+
// "volume_quote": "784.2517846"
|
|
1713
|
+
// }
|
|
1714
|
+
// ]
|
|
1638
1715
|
//
|
|
1639
1716
|
// Mark, Index and Premium Index
|
|
1640
1717
|
//
|
|
1641
|
-
//
|
|
1642
|
-
//
|
|
1643
|
-
//
|
|
1644
|
-
//
|
|
1645
|
-
//
|
|
1646
|
-
//
|
|
1647
|
-
//
|
|
1648
|
-
//
|
|
1649
|
-
//
|
|
1650
|
-
// ]
|
|
1651
|
-
// }
|
|
1718
|
+
// [
|
|
1719
|
+
// {
|
|
1720
|
+
// "timestamp": "2022-04-01T01:28:00.000Z",
|
|
1721
|
+
// "open": "45146.39",
|
|
1722
|
+
// "close": "45219.43",
|
|
1723
|
+
// "min": "45146.39",
|
|
1724
|
+
// "max": "45219.43"
|
|
1725
|
+
// },
|
|
1726
|
+
// ]
|
|
1652
1727
|
//
|
|
1653
|
-
|
|
1654
|
-
return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
|
|
1728
|
+
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
1655
1729
|
}
|
|
1656
1730
|
parseOHLCV(ohlcv, market = undefined) {
|
|
1657
1731
|
//
|
|
@@ -2051,7 +2125,7 @@ export default class hitbtc extends Exchange {
|
|
|
2051
2125
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
2052
2126
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
2053
2127
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
2054
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both
|
|
2128
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both, default is 'cross'
|
|
2055
2129
|
* @param {bool} [params.margin] true for creating a margin order
|
|
2056
2130
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
2057
2131
|
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
@@ -2125,7 +2199,11 @@ export default class hitbtc extends Exchange {
|
|
|
2125
2199
|
throw new ExchangeError(this.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders');
|
|
2126
2200
|
}
|
|
2127
2201
|
params = this.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly']);
|
|
2128
|
-
if (
|
|
2202
|
+
if (marketType === 'swap') {
|
|
2203
|
+
// set default margin mode to cross
|
|
2204
|
+
if (marginMode === undefined) {
|
|
2205
|
+
marginMode = 'cross';
|
|
2206
|
+
}
|
|
2129
2207
|
request['margin_mode'] = marginMode;
|
|
2130
2208
|
}
|
|
2131
2209
|
let response = undefined;
|
|
@@ -2304,7 +2382,7 @@ export default class hitbtc extends Exchange {
|
|
|
2304
2382
|
const response = await this.privatePostWalletTransfer(this.extend(request, params));
|
|
2305
2383
|
//
|
|
2306
2384
|
// [
|
|
2307
|
-
//
|
|
2385
|
+
// "2db6ebab-fb26-4537-9ef8-1a689472d236"
|
|
2308
2386
|
// ]
|
|
2309
2387
|
//
|
|
2310
2388
|
return this.parseTransfer(response, currency);
|
|
@@ -2314,7 +2392,7 @@ export default class hitbtc extends Exchange {
|
|
|
2314
2392
|
// transfer
|
|
2315
2393
|
//
|
|
2316
2394
|
// [
|
|
2317
|
-
//
|
|
2395
|
+
// "2db6ebab-fb26-4537-9ef8-1a689472d236"
|
|
2318
2396
|
// ]
|
|
2319
2397
|
//
|
|
2320
2398
|
const timestamp = this.milliseconds();
|
|
@@ -2404,6 +2482,60 @@ export default class hitbtc extends Exchange {
|
|
|
2404
2482
|
//
|
|
2405
2483
|
return this.parseTransaction(response, currency);
|
|
2406
2484
|
}
|
|
2485
|
+
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
2486
|
+
/**
|
|
2487
|
+
* @method
|
|
2488
|
+
* @name hitbtc#fetchFundingRates
|
|
2489
|
+
* @description fetches funding rates for multiple markets
|
|
2490
|
+
* @see https://api.hitbtc.com/#futures-info
|
|
2491
|
+
* @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
|
2492
|
+
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
2493
|
+
* @returns {object} an array of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
|
|
2494
|
+
*/
|
|
2495
|
+
await this.loadMarkets();
|
|
2496
|
+
let market = undefined;
|
|
2497
|
+
const request = {};
|
|
2498
|
+
if (symbols !== undefined) {
|
|
2499
|
+
symbols = this.marketSymbols(symbols);
|
|
2500
|
+
market = this.market(symbols[0]);
|
|
2501
|
+
const queryMarketIds = this.marketIds(symbols);
|
|
2502
|
+
request['symbols'] = queryMarketIds.join(',');
|
|
2503
|
+
}
|
|
2504
|
+
let type = undefined;
|
|
2505
|
+
[type, params] = this.handleMarketTypeAndParams('fetchFundingRates', market, params);
|
|
2506
|
+
if (type !== 'swap') {
|
|
2507
|
+
throw new NotSupported(this.id + ' fetchFundingRates() does not support ' + type + ' markets');
|
|
2508
|
+
}
|
|
2509
|
+
const response = await this.publicGetPublicFuturesInfo(this.extend(request, params));
|
|
2510
|
+
//
|
|
2511
|
+
// {
|
|
2512
|
+
// "BTCUSDT_PERP": {
|
|
2513
|
+
// "contract_type": "perpetual",
|
|
2514
|
+
// "mark_price": "30897.68",
|
|
2515
|
+
// "index_price": "30895.29",
|
|
2516
|
+
// "funding_rate": "0.0001",
|
|
2517
|
+
// "open_interest": "93.7128",
|
|
2518
|
+
// "next_funding_time": "2021-07-21T16:00:00.000Z",
|
|
2519
|
+
// "indicative_funding_rate": "0.0001",
|
|
2520
|
+
// "premium_index": "0.000047541807127312",
|
|
2521
|
+
// "avg_premium_index": "0.000087063368020112",
|
|
2522
|
+
// "interest_rate": "0.0001",
|
|
2523
|
+
// "timestamp": "2021-07-21T09:48:37.235Z"
|
|
2524
|
+
// }
|
|
2525
|
+
// }
|
|
2526
|
+
//
|
|
2527
|
+
const marketIds = Object.keys(response);
|
|
2528
|
+
const fundingRates = {};
|
|
2529
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
2530
|
+
const marketId = this.safeString(marketIds, i);
|
|
2531
|
+
const rawFundingRate = this.safeValue(response, marketId);
|
|
2532
|
+
const marketInner = this.market(marketId);
|
|
2533
|
+
const symbol = marketInner['symbol'];
|
|
2534
|
+
const fundingRate = this.parseFundingRate(rawFundingRate, marketInner);
|
|
2535
|
+
fundingRates[symbol] = fundingRate;
|
|
2536
|
+
}
|
|
2537
|
+
return this.filterByArray(fundingRates, 'symbol', symbols);
|
|
2538
|
+
}
|
|
2407
2539
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2408
2540
|
/**
|
|
2409
2541
|
* @method
|
|
@@ -2694,11 +2826,75 @@ export default class hitbtc extends Exchange {
|
|
|
2694
2826
|
'takeProfitPrice': undefined,
|
|
2695
2827
|
});
|
|
2696
2828
|
}
|
|
2829
|
+
parseOpenInterest(interest, market = undefined) {
|
|
2830
|
+
//
|
|
2831
|
+
// {
|
|
2832
|
+
// "contract_type": "perpetual",
|
|
2833
|
+
// "mark_price": "42307.43",
|
|
2834
|
+
// "index_price": "42303.27",
|
|
2835
|
+
// "funding_rate": "0.0001",
|
|
2836
|
+
// "open_interest": "30.9826",
|
|
2837
|
+
// "next_funding_time": "2022-03-22T16:00:00.000Z",
|
|
2838
|
+
// "indicative_funding_rate": "0.0001",
|
|
2839
|
+
// "premium_index": "0",
|
|
2840
|
+
// "avg_premium_index": "0.000029587712038098",
|
|
2841
|
+
// "interest_rate": "0.0001",
|
|
2842
|
+
// "timestamp": "2022-03-22T08:08:26.687Z"
|
|
2843
|
+
// }
|
|
2844
|
+
//
|
|
2845
|
+
const datetime = this.safeString(interest, 'timestamp');
|
|
2846
|
+
const value = this.safeNumber(interest, 'open_interest');
|
|
2847
|
+
return this.safeOpenInterest({
|
|
2848
|
+
'symbol': market['symbol'],
|
|
2849
|
+
'openInterestAmount': undefined,
|
|
2850
|
+
'openInterestValue': value,
|
|
2851
|
+
'timestamp': this.parse8601(datetime),
|
|
2852
|
+
'datetime': datetime,
|
|
2853
|
+
'info': interest,
|
|
2854
|
+
}, market);
|
|
2855
|
+
}
|
|
2856
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
2857
|
+
/**
|
|
2858
|
+
* @method
|
|
2859
|
+
* @name hitbtc#fetchOpenInterest
|
|
2860
|
+
* @description Retrieves the open interest of a derivative trading pair
|
|
2861
|
+
* @see https://api.hitbtc.com/#futures-info
|
|
2862
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
2863
|
+
* @param {object} [params] exchange specific parameters
|
|
2864
|
+
* @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
|
|
2865
|
+
*/
|
|
2866
|
+
await this.loadMarkets();
|
|
2867
|
+
const market = this.market(symbol);
|
|
2868
|
+
if (!market['swap']) {
|
|
2869
|
+
throw new BadSymbol(this.id + ' fetchOpenInterest() supports swap contracts only');
|
|
2870
|
+
}
|
|
2871
|
+
const request = {
|
|
2872
|
+
'symbol': market['id'],
|
|
2873
|
+
};
|
|
2874
|
+
const response = await this.publicGetPublicFuturesInfoSymbol(this.extend(request, params));
|
|
2875
|
+
//
|
|
2876
|
+
// {
|
|
2877
|
+
// "contract_type": "perpetual",
|
|
2878
|
+
// "mark_price": "42307.43",
|
|
2879
|
+
// "index_price": "42303.27",
|
|
2880
|
+
// "funding_rate": "0.0001",
|
|
2881
|
+
// "open_interest": "30.9826",
|
|
2882
|
+
// "next_funding_time": "2022-03-22T16:00:00.000Z",
|
|
2883
|
+
// "indicative_funding_rate": "0.0001",
|
|
2884
|
+
// "premium_index": "0",
|
|
2885
|
+
// "avg_premium_index": "0.000029587712038098",
|
|
2886
|
+
// "interest_rate": "0.0001",
|
|
2887
|
+
// "timestamp": "2022-03-22T08:08:26.687Z"
|
|
2888
|
+
// }
|
|
2889
|
+
//
|
|
2890
|
+
return this.parseOpenInterest(response, market);
|
|
2891
|
+
}
|
|
2697
2892
|
async fetchFundingRate(symbol, params = {}) {
|
|
2698
2893
|
/**
|
|
2699
2894
|
* @method
|
|
2700
2895
|
* @name hitbtc#fetchFundingRate
|
|
2701
2896
|
* @description fetch the current funding rate
|
|
2897
|
+
* @see https://api.hitbtc.com/#futures-info
|
|
2702
2898
|
* @param {string} symbol unified market symbol
|
|
2703
2899
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
2704
2900
|
* @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
|
|
@@ -2708,31 +2904,26 @@ export default class hitbtc extends Exchange {
|
|
|
2708
2904
|
if (!market['swap']) {
|
|
2709
2905
|
throw new BadSymbol(this.id + ' fetchFundingRate() supports swap contracts only');
|
|
2710
2906
|
}
|
|
2711
|
-
const request = {
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
}
|
|
2716
|
-
const response = await this.publicGetPublicFuturesInfo(this.extend(request, params));
|
|
2907
|
+
const request = {
|
|
2908
|
+
'symbol': market['id'],
|
|
2909
|
+
};
|
|
2910
|
+
const response = await this.publicGetPublicFuturesInfoSymbol(this.extend(request, params));
|
|
2717
2911
|
//
|
|
2718
2912
|
// {
|
|
2719
|
-
// "
|
|
2720
|
-
//
|
|
2721
|
-
//
|
|
2722
|
-
//
|
|
2723
|
-
//
|
|
2724
|
-
//
|
|
2725
|
-
//
|
|
2726
|
-
//
|
|
2727
|
-
//
|
|
2728
|
-
//
|
|
2729
|
-
//
|
|
2730
|
-
// "timestamp": "2022-03-22T08:08:26.687Z"
|
|
2731
|
-
// }
|
|
2913
|
+
// "contract_type": "perpetual",
|
|
2914
|
+
// "mark_price": "42307.43",
|
|
2915
|
+
// "index_price": "42303.27",
|
|
2916
|
+
// "funding_rate": "0.0001",
|
|
2917
|
+
// "open_interest": "30.9826",
|
|
2918
|
+
// "next_funding_time": "2022-03-22T16:00:00.000Z",
|
|
2919
|
+
// "indicative_funding_rate": "0.0001",
|
|
2920
|
+
// "premium_index": "0",
|
|
2921
|
+
// "avg_premium_index": "0.000029587712038098",
|
|
2922
|
+
// "interest_rate": "0.0001",
|
|
2923
|
+
// "timestamp": "2022-03-22T08:08:26.687Z"
|
|
2732
2924
|
// }
|
|
2733
2925
|
//
|
|
2734
|
-
|
|
2735
|
-
return this.parseFundingRate(data, market);
|
|
2926
|
+
return this.parseFundingRate(response, market);
|
|
2736
2927
|
}
|
|
2737
2928
|
parseFundingRate(contract, market = undefined) {
|
|
2738
2929
|
//
|
|
@@ -2785,8 +2976,8 @@ export default class hitbtc extends Exchange {
|
|
|
2785
2976
|
const request = {
|
|
2786
2977
|
'symbol': market['id'],
|
|
2787
2978
|
'margin_balance': amount, // swap and margin
|
|
2788
|
-
//
|
|
2789
|
-
//
|
|
2979
|
+
// "leverage": "10", // swap only required
|
|
2980
|
+
// "strict_validate": false, // swap and margin
|
|
2790
2981
|
};
|
|
2791
2982
|
if (leverage !== undefined) {
|
|
2792
2983
|
request['leverage'] = leverage;
|
|
@@ -2936,10 +3127,8 @@ export default class hitbtc extends Exchange {
|
|
|
2936
3127
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
2937
3128
|
* @returns {object} response from the exchange
|
|
2938
3129
|
*/
|
|
3130
|
+
this.checkRequiredSymbol('setLeverage', symbol);
|
|
2939
3131
|
await this.loadMarkets();
|
|
2940
|
-
if (symbol === undefined) {
|
|
2941
|
-
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
2942
|
-
}
|
|
2943
3132
|
if (params['margin_balance'] === undefined) {
|
|
2944
3133
|
throw new ArgumentsRequired(this.id + ' setLeverage() requires a margin_balance parameter that will transfer margin to the specified trading pair');
|
|
2945
3134
|
}
|