XTB Trading Platform API

Access XTB's xStation API for real-time market data, order management, and account information from Delphi.

XTB Integration

Connect to XTB's xStation 5 API for forex, indices, commodities, and stock CFD trading.

XTB xStation Trading API

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.

  • Real-time price streaming for all instruments
  • Order placement and modification
  • Trade and profit calculation
  • Candlestick and tick data retrieval

Delphi XTB Example

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;

Documentation & Demos

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

Ready to Trade with XTB?

Download the free trial and connect to XTB's xStation API in minutes.