OKX Exchange API
Stream spot, futures, perpetual swap, and options market data from OKX via WebSocket channels.
Stream spot, futures, perpetual swap, and options market data from OKX via WebSocket channels.
Access OKX's comprehensive WebSocket API for real-time data across all instrument types.
The sgcWebSockets OKX component connects to the OKX WebSocket API, providing unified access to spot, margin, futures, perpetual swaps, and options markets. Subscribe to tickers, order books, trades, candlesticks, and funding rates across all instrument types.
Subscribe to OKX ticker data.
uses
sgcHTTP_API_OKX;
var
OKX: TsgcHTTPAPI_OKX;
procedure TForm1.FormCreate(Sender: TObject);
begin
OKX := TsgcHTTPAPI_OKX.Create(nil);
OKX.OnOKXTicker := OnTicker;
OKX.Connect;
end;
procedure TForm1.Subscribe;
begin
OKX.SubscribeTicker('BTC-USDT');
end;
procedure TForm1.OnTicker(Sender: TObject;
aInstId, aLast, aBidPx, aAskPx: string);
begin
Label1.Caption := aInstId + ': $' + aLast;
end;
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.