Huobi / HTX WebSocket API
Stream Huobi/HTX spot market data (kline, depth, trade detail, market overview, market detail) and the v2 account asset channel.
Stream Huobi/HTX spot market data (kline, depth, trade detail, market overview, market detail) and the v2 account asset channel.
Huobi (now HTX) WebSocket client — spot market streams plus authenticated v2 channels for orders, trades and account balances.
TsgcWSAPI_Huobi
Windows, macOS, Linux, iOS, Android
Standard / Professional / Enterprise
Pair with a TsgcWebSocketClient and subscribe to Huobi market topics — the component handles the gzip-compressed payloads transparently.
uses
sgcWebSocket, sgcWebSocket_API_Huobi;
var
WSClient: TsgcWebSocketClient;
Huobi: TsgcWSAPI_Huobi;
begin
WSClient := TsgcWebSocketClient.Create(nil);
Huobi := TsgcWSAPI_Huobi.Create(nil);
Huobi.Client := WSClient;
Huobi.Huobi.ApiKey := 'your-api-key';
Huobi.Huobi.ApiSecret := 'your-api-secret';
WSClient.Active := True;
Huobi.SubscribeKLine('btcusdt', hci5m);
Huobi.SubscribeDepth('btcusdt', hds0);
Huobi.SubscribeTradeDetail('btcusdt');
end;
// uses: sgcWebSocket, sgcWebSocket_API_Huobi
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
TsgcWSAPI_Huobi *Huobi = new TsgcWSAPI_Huobi(this);
Huobi->Client = WSClient;
WSClient->Active = true;
Huobi->SubscribeKLine("btcusdt", hci5m);
Huobi->SubscribeDepth("btcusdt", hds0);
Huobi->SubscribeTradeDetail("btcusdt");
gzip-aware market stream, signed v2 account channels, automatic ping/pong heartbeat.
SubscribeKLine, SubscribeDepth, SubscribeTradeDetail, SubscribeMarketDetail, SubscribeMarketOverview, SubscribeBBO cover the spot market surface.
Huobi compresses every WebSocket frame with gzip — the component decompresses on the way in and answers ping frames on the way out automatically.
v2-auth handshake with HMAC signing exposes accounts.update#v2, orders#$symbol and trade.clearing#$symbol private channels.
The TsgcWSAPI_HTX sibling is the same component re-exported under the new HTX brand — pick whichever name matches your codebase.
Point the underlying TsgcWebSocketClient at api.huobi.pro or api.huobi.com depending on your jurisdiction — the protocol is identical.
Huobi sends {"ping":...} at the application layer — the component answers each automatically so the connection stays open through proxies.
Authoritative sources for the APIs this component implements.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Online Help — API_Huobi Full property, method and event reference for this component. | Open | |
| Demo Project — Demos\05.Crypto\03.Huobi Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |