BitMEX WebSocket API

Stream BitMEX derivatives data (orderBookL2, quote, trade, funding) and authenticated account/order/position channels from a typed Delphi component.

TsgcWSAPI_Bitmex

BitMEX derivatives WebSocket API client — full Level 2 order book, trade tape, quote stream and HMAC-signed private channels.

Component class

TsgcWSAPI_Bitmex

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Drop the component, set keys, subscribe

Pair the component with a TsgcWebSocketClient, set Bitmex.ApiKey / Bitmex.ApiSecret for signed streams, then subscribe to instrument channels.

uses
  sgcWebSocket, sgcWebSocket_API_Bitmex;

var
  WSClient: TsgcWebSocketClient;
  Bitmex: TsgcWSAPI_Bitmex;
begin
  WSClient := TsgcWebSocketClient.Create(nil);

  Bitmex := TsgcWSAPI_Bitmex.Create(nil);
  Bitmex.Client := WSClient;
  Bitmex.Bitmex.ApiKey    := 'your-api-key';
  Bitmex.Bitmex.ApiSecret := 'your-api-secret';

  WSClient.Active := True;

  Bitmex.SubscribeQuote('XBTUSD');
  Bitmex.SubscribeTrade('XBTUSD');
  Bitmex.SubscribeOrderBookL2('XBTUSD');
end;
// uses: sgcWebSocket, sgcWebSocket_API_Bitmex
TsgcWebSocketClient *WSClient = new TsgcWebSocketClient(this);
TsgcWSAPI_Bitmex *Bitmex = new TsgcWSAPI_Bitmex(this);
Bitmex->Client = WSClient;

WSClient->Active = true;
Bitmex->SubscribeQuote("XBTUSD");
Bitmex->SubscribeTrade("XBTUSD");
Bitmex->SubscribeOrderBookL2("XBTUSD");

What's inside

Level 2 book snapshots and deltas, trade tape, quote stream, instrument metadata, plus authenticated execution and margin channels.

Public market data

SubscribeQuote, SubscribeTrade, SubscribeOrderBookL2, SubscribeOrderBook10, SubscribeInstrument, SubscribeFunding, SubscribeLiquidation cover the full BitMEX market surface.

Level 2 book delta

OrderBookL2 publishes the partial snapshot then per-row insert / update / delete deltas. Apply each delta to maintain a synchronised local book.

Authenticated channels

Set Bitmex.ApiKey and Bitmex.ApiSecret then subscribe to position, execution, order, margin, wallet — the component signs each request with HMAC-SHA256.

TestNet support

Toggle Bitmex.TestNet to switch the WebSocket endpoint to testnet.bitmex.com for sandbox testing.

Per-symbol routing

Each channel:symbol pair routes through its own event so a single component can multiplex hundreds of subscribed contracts on one connection.

Heartbeat & reconnection

Bind to the underlying TsgcWebSocketClient for HeartBeat (ping/pong every 5s) and WatchDog auto-reconnect with state restoration.

Specifications & references

Authoritative sources for the APIs this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — API_Bitmex Full property, method and event reference for this component.
Demo Project — Demos\05.Crypto\06.Bitmex Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Trade on BitMEX?

Download the free trial and stream BitMEX derivatives data into your Delphi applications.