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
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
Export the Python project
Every project exports
strategy.py,market_data.py,brokers.pyandlive.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format. - 3
Plug in XTB
Implement the four adapter methods (
account,positions,submit_market_orderand 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
- IG API GuideRegulated CFD, spread-betting and FX broker with a REST trading API, Lightstreamer streaming and a demo account.
- OANDA API Built into AlgoGPRegulated forex and CFD broker whose v20 REST API serves both orders and candles, with a free demo account.
- Saxo OpenAPI GuideThe API behind SaxoTraderGO: multi-asset trading in stocks, ETFs, options, futures, FX and CFDs, with a simulation environment.
- cTrader Open API GuideSpotware’s API for cTrader brokers: FX and CFD trading and data over TCP or WebSocket, JSON or Protobuf, with OAuth.
Independent guide. AlgoGP is not affiliated with XTB. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.