Guide
PlatformForexCFDsStocks No key needed

XTB API guide

XTB’s xAPI powered many hobby forex bots. Its shutdown left them without a route to the market.

Last verified · Also known as XTB API, xAPI, xStation API

Quick answer

XTB disabled its xAPI (xapi.xtb.com and ws.xtb.com) on 14 March 2025 and has not offered a replacement, so XTB accounts can no longer be traded from code. To keep a forex or CFD bot running, move it to a broker with a supported API such as IG, OANDA, Saxo, or a cTrader or MT5 broker.

XTB API at a glance

Pricing
Discontinued
Availability
Discontinued (March 2025)
Paper trading
Not applicable (data only)
Integration type
No public API
In AlgoGP
Design and backtest in AlgoGP, connect the exported code
Status
Shut down 14 March 2025
Replacement
None announced
Alternatives
IG, OANDA, Saxo, cTrader, MT5 brokers

Build a XTB strategy with AlgoGP

AlgoGP does not connect to XTB natively yet. XTB has no supported public trading or data API.

  1. 1

    Design and backtest in AlgoGP

    Describe the strategy to the copilot and backtest it on years of normalized history. The result does not depend on any vendor.

  2. 2

    Export the Python project

    Every project exports strategy.py, market_data.py, brokers.py and live.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format.

  3. 3

    Plug in XTB

    Implement the four adapter methods (account, positions, submit_market_order and a candle fetcher) with XTB’s SDK, or keep a built-in platform for paper trading and add XTB when you go live.

Built-in data sources for the same markets: Alpaca, Yahoo Finance, Alpha Vantage, OANDA.

XTB API: frequently asked questions

Will XTB bring back its API?

XTB has announced no replacement; its help center says API access is no longer available.

What is the closest alternative to XTB’s API?

IG’s REST API covers similar CFDs; OANDA is simpler for forex.

Automate the strategy you would run on XTB

Describe your rules, backtest them on years of stock, crypto or forex data, and export Python for a broker that has a real API.

  • No API key needed to start
  • Built-in Alpaca, Tradier, OANDA, Binance and more
  • Free plan, no card

Free plan, no card required.

XTB alternatives

Independent guide. AlgoGP is not affiliated with XTB. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.

Build a strategy