Huobi Spot Trade Connector
Features
crypto-huobiConnector KeyNotes
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 type | 6061 attribute | Description |
|---|---|---|
| SPOT | api | Spot trading |
| MARGIN | margin-api | Isolated margin trading |
| SUPER_MARGIN | super-margin-api | Cross 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
| Parameter | Default Value | Description |
|---|---|---|
| tradingType | SPOT | Default value for the Trading Type. Possible values: SPOT, MARGIN and SUPER_MARGIN. |
| allowFillsWithoutFeeInfo | false | Allow to report earlier trade events without fee information. Possible values: true, false. |
| huobiSyncSettings.ordersRequestPageSize | 50 | Limitation for the number of orders in one open or closed orders response. Maximum value is 100. |
| huobiSyncSettings.tradesRequestPageSize | 50 | Limitation for the number of trades in one trades history response. Maximum value is 500. |
Supported order attributes
| Key | Description |
|---|---|
| 18 | 18 (PostOnly) attribute relevant only for LIMIT orders with Good Till Cancel time in force. Switches between taker and maker order types. Possible values: 6. |
| 6061 | The 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>"
}
]
}
}
}