Guide
BrokerMarket dataForexCFDsIndices API key

FOREX.com API guide

For US forex traders, FOREX.com and OANDA are the two mainstream brokers with a programmable API.

Last verified · Also known as FOREX.com API, GAIN Capital API, StoneX API, City Index API

Quick answer

FOREX.com (StoneX) exposes the GAIN Capital REST trading API used by FOREX.com and City Index: log in with username, password and an app key to get a session, then trade forex and CFDs, read prices and stream through Lightstreamer. It is one of the few NFA-regulated FX brokers in the US with an API, and demo accounts work the same way.

FOREX.com API at a glance

Pricing
API free with an account
Availability
US (NFA-regulated), UK, EU, Canada, Australia, Japan
Paper trading
Demo account
Integration type
REST + API key
In AlgoGP
Design and backtest in AlgoGP, connect the exported code
Auth
Username + password + app key → session token
Streaming
Lightstreamer price feed
US
Available (NFA/CFTC regulated)
Sister brand
City Index (UK/EU/AU)

Build a FOREX.com strategy with AlgoGP

AlgoGP does not connect to FOREX.com natively yet. FOREX.com uses plain HTTPS with an API key, so it is a good candidate for a native adapter; it is not built in yet.

  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 FOREX.com

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

Built-in brokers for the same markets: OANDA, Interactive Brokers.

FOREX.com API: frequently asked questions

Can I trade FOREX.com through an API in the US?

Yes; FOREX.com US accounts can use the API.

How do I get a FOREX.com app key?

Request API access from FOREX.com support for your account.

Design and backtest your FOREX.com strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to FOREX.com. The exported code keeps the broker behind four small adapter methods.

  • AI copilot writes and revises the rules
  • Backtests with realistic costs
  • Exported Python ready to wire to FOREX.com

Free plan, no card required.

FOREX.com alternatives

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

Build a strategy