HTX(formerly Huobi) API Update sgcWebSockets

We are pleased to announce a significant update to the Huobi (HTX) WebSocket API component in sgcWebSockets for Delphi. This update brings expanded market data support, new futures-specific subscription channels, and improved parameter options to keep your trading applications up to date with the latest HTX exchange capabilities.

What's New

Expanded Kline Periods

The KLine (candlestick) subscription now supports the 4-hour period (hup4Hour), one of the most commonly used timeframes for technical analysis. The full list of supported periods is: 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, 1mon, 1year.


Extended Market Depth Aggregation Levels

Market depth subscriptions now support aggregation levels from step0 through step15 (previously only step0-step5). This gives you finer control over order book data granularity.


New Market By Price Levels

The Market By Price (MBP) subscription now supports deeper order book views with levels 150 and 400, in addition to the existing 5, 10, and 20 levels.


Improved SubscribeAccountChange

The SubscribeAccountChange method now accepts an aMode parameter to control the update behavior:

Mode Description
0 Only update when account balance changes.
1 Update when either account balance or available balance changes (separate updates).
2 Update when account balance or available balance changes (combined update).

New Futures Subscription Methods

The Futures API client (TsgcWS_API_Huobi_Fut) now includes seven new subscription channels for futures-specific market data:

Method Description
SubscribePremiumIndexKLine Subscribe to premium index kline/candlestick data for futures contracts.
SubscribeEstimatedRateKLine Subscribe to estimated funding rate kline data for futures contracts.
SubscribeBasisData Subscribe to basis data (spot-futures price spread). Supports price types: open, close, high, low.
SubscribeMarkPriceKLine Subscribe to mark price kline/candlestick data for futures contracts.
SubscribeLiquidationOrders Subscribe to the public liquidation orders feed. No authentication required.
SubscribeFundingRate Subscribe to public funding rate updates for a given contract.
SubscribeContractInfo Subscribe to contract parameter changes (listings, delistings, adjustments).

Code Example

// Subscribe to 4-hour kline for BTC/USDT
sgcWSHuobi1.SubscribeKLine('btcusdt', hup4Hour);

// Subscribe to deeper order book (150 levels)
sgcWSHuobi1.SubscribeMarketByPrice('btcusdt', hulLevel150);

// Subscribe to account changes with mode 1
sgcWSHuobi1.SubscribeAccountChange(1);

// Futures: Subscribe to mark price kline
sgcWSHuobiFut1.SubscribeMarkPriceKLine('BTC-USD', hup1Min);

// Futures: Subscribe to liquidation orders
sgcWSHuobiFut1.SubscribeLiquidationOrders('BTC-USD');

// Futures: Subscribe to basis data with close price type
sgcWSHuobiFut1.SubscribeBasisData('BTC_CQ', hup1Min, hbpClose);

// Futures: Subscribe to funding rate
sgcWSHuobiFut1.SubscribeFundingRate('BTC-USD');

Compatibility

All changes are backward compatible. Existing code will continue to work without modifications. The WebSocket endpoints remain unchanged (wss://api.huobi.pro/ws for public data and wss://api.huobi.pro/ws/v2 for authenticated channels). The authentication method (HmacSHA256 v2.1) is also unchanged.

Note: This update is available in sgcWebSockets 2026.3.0.
×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Pusher Client Delphi Update

Related Posts