Skip to main content

Huobi Futures Trade Connector

Features

crypto-huobifutConnector Key
Instruments
FUTURE
Request Types
SUBMITCANCEL
Order Types
MARKETLIMIT
Time In Force
GTCIOCFOK
Order ID Mapper
SEQUENCE
Order Status Request
Cancel On Disconnect
Commission
Post Only
Fast Cancel
Fast Replace

Notes

Rate Limits

The private API rate limit is 48 requests per 3 seconds per UID (24 for trade operations, 24 for read operations). This limit is shared across all altcoin contracts.

See the Huobi documentation for details:

Offset

Huobi Futures and Swap require an Offset parameter with each order to specify the order type.

Default offset is configured via defaultOffset. It can be overridden per order using the 6470 (Offset) attribute.

Order typeTransaction DirectionOffset
Open LongBUYopen
Close LongSELLclose
Open ShortSELLopen
Close ShortBUYclose
warning

Important: Huobi Swap USDT in One-Way mode requires Offset = both.

Post Only

In Huobi Futures and Swap APIs Post Only orders are represented via Huobi Time In Force.
When Post Only flag is defined in an order request, it takes precedence over the specified Time In Force.
I.e. if Post Only flag is present - request's Time In Force is ignored and order will be placed as Post Only.

Errors

List of possible errors can be obtained from the Huobi documentation:

Huobi Swap

Huobi Swap uses the same API format as Huobi Futures but with different REST and WebSocket URLs. See the Config Sample section to configure the connector for Huobi Swap.

Huobi Swap USDT

Huobi Swap USDT uses the same API format as Huobi Futures but with different REST and WebSocket URLs. See the Config Sample section to configure the connector for Huobi Swap USDT.

Margin Mode

Configure the Margin Mode for Huobi Swap USDT via the marginMode connector setting. The connector operates in one Margin Mode at a time — CROSS and ISOLATED orders cannot be sent simultaneously.

Symbology

Huobi Futures symbols use the Contract Code format: base currency code followed by expiration date (no separator), e.g. BTC201225, ETH200925.

Full list of supported contracts can be retrieved via public REST API:

Configuration

Connector settings

ParameterDefault ValueDescription
defaultLeverage10Default value for 6001 (LeverageRate) attribute.
defaultOffsetOPENDefault value for 6470 (Offset) attribute.
marginModeMargin mode for Huobi Swap USDT connector. Possible values: CROSS, ISOLATED.
huobiFuturesSyncSettings.ordersRequestPageSize50Limitation for the number of orders in one open orders response. Maximum value is 50.
huobiFuturesSyncSettings.tradesRequestPageSize50Limitation for the number of trades in one trades history response. Maximum value is 50.
huobiFuturesSyncSettings.ordersBatchRequestSizeLimit50Limitation for the number of orders in the orders status batch request. Maximum value is 50.
huobiFuturesSyncSettings.historicalDataDaysPeriod1The number of days to query for historical trades data. Maximum value is 90. It is highly recommended from exchange to use 1 day period in the requests.

Supported order attributes

KeyDescription
1818 (PostOnly) attribute relevant only for LIMIT orders with Good Till Cancel time in force. Switches between post_only and limit order price type. Possible values: 6.
6001All orders should have 6001 (LeverageRate) attribute to determine order leverage rate. Default value can be specified with defaultLeverage configuration parameter.
6470All orders should have 6470 (Offset) attribute to determine offset direction. Default value can be specified with defaultOffset configuration parameter. Possible values: OPEN, CLOSE or BOTH. See Offset section for detailed explanation.

Config sample

include classpath("crypto-connectors.conf")

connectors {
HUOBIFUT: ${template.connector.crypto.huobifut} {
settings {
restUrl = "https://api.hbdm.com"
websocketUrl = "wss://api.hbdm.com/notification"

apiKeys: [
{
apiKey = "<API_KEY>"
apiSecret = "<API_SECRET>"
}
]
}
}

HUOBISWP: ${template.connector.crypto.huobiswp} {
settings {
restUrl = "https://api.hbdm.com"
websocketUrl = "wss://api.hbdm.com/swap-notification"

apiKeys: [
{
apiKey = "<API_KEY>"
apiSecret = "<API_SECRET>"
}
]
}
}

HUOBISWPT: ${template.connector.crypto.huobiswpt} {
settings {
restUrl = "https://api.hbdm.com"
websocketUrl = "wss://api.hbdm.vn/linear-swap-notification"

marginMode = "ISOLATED" # or "CROSS"

apiKeys: [
{
apiKey = "<API_KEY>"
apiSecret = "<API_SECRET>"
}
]
}
}
}