Skip to main content

Huobi Spot Trade Connector

Features​

crypto-huobiConnector Key
Instruments
FX
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​

Rate limits are applied per UID. The combined request rate across all API keys under the same UID to a single endpoint must not exceed that endpoint's limit.

Trading Type​

Margin, cross-margin and spot trading can be switched in settings.

Default trading type is set via the tradingType configuration property. It can be overridden per order using the 6061 (TradingType) attribute.

Trading type6061 attributeDescription
SPOTapiSpot trading
MARGINmargin-apiIsolated margin trading
SUPER_MARGINsuper-margin-apiCross margin trading

Quantity adjustment​

Ember stores quantities in Decimal64 format with 16 significant digits. Huobi uses more than 16 significant digits, which may cause rounding mismatches on the Ember side.

The connector performs internal calculations with higher precision. For fully filled orders, the connector corrects the last fill's quantity if the sum of fill quantities differs from the order quantity.

Correction is performed as follows:

lastTradeQuantity = orderQuantity - sum( tradeQuantitiesExceptLastOne )

Post Only​

In Huobi Spot API 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.

Symbology​

Currency pairs in lowercase without separator, e.g. btcusdt, ltcusdt. Symbols are case-sensitive — lowercase is required.

Full list of supported symbols can be retrieved via public REST API: https://api.huobi.pro/v1/common/symbols

Configuration​

Connector settings​

ParameterDefault ValueDescription
tradingTypeSPOTDefault value for the Trading Type. Possible values: SPOT, MARGIN and SUPER_MARGIN.
allowFillsWithoutFeeInfofalseAllow to report earlier trade events without fee information. Possible values: true, false.
huobiSyncSettings.ordersRequestPageSize50Limitation for the number of orders in one open or closed orders response. Maximum value is 100.
huobiSyncSettings.tradesRequestPageSize50Limitation for the number of trades in one trades history response. Maximum value is 500.

Supported order attributes​

KeyDescription
1818 (PostOnly) attribute relevant only for LIMIT orders with Good Till Cancel time in force. Switches between taker and maker order types. Possible values: 6.
6061The Trading Type can be configured with 6061 (TradingType) attribute. Default value can be specified with the tradingType configuration property. Possible values: api, margin-api and super-margin-api. See Trading Type section for detailed explanation.

Config sample​

include classpath("crypto-connectors.conf")

connectors {
HUOBI: ${template.connector.crypto.huobi} {
settings {
restUrl = "https://api.huobi.pro"
websocketUrl = "wss://api.huobi.pro/ws/v2"

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