XTB Trading Platform API
Access XTB's xStation API for real-time market data, order management, and account information from Delphi.
Access XTB's xStation API for real-time market data, order management, and account information from Delphi.
Connect to XTB's xStation 5 API for forex, indices, commodities, and stock CFD trading.
The sgcWebSockets XTB component connects to the xStation 5 API via WebSocket, providing access to real-time price streaming, order placement, trade history, and account management. Trade forex, indices, commodities, and stock CFDs programmatically.
Connect and stream prices from XTB.
uses
sgcHTTP_API_XTB;
var
XTB: TsgcHTTPAPI_XTB;
procedure TForm1.FormCreate(Sender: TObject);
begin
XTB := TsgcHTTPAPI_XTB.Create(nil);
XTB.XTBOptions.UserId := 'your-user-id';
XTB.XTBOptions.Password := 'your-password';
XTB.OnXTBPrice := OnPrice;
XTB.Connect;
end;
procedure TForm1.Subscribe;
begin
XTB.SubscribePrice('EURUSD');
end;
procedure TForm1.OnPrice(Sender: TObject;
aSymbol, aAsk, aBid, aSpread: string);
begin
Label1.Caption := aSymbol + ' Bid: ' + aBid +
' Ask: ' + aAsk;
end;
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.