AI-native runtime for FOREX.com trading strategies
Author FOREX.com REST and StoneX GAIN Capital REST strategies in Cursor, Claude Code or any AI IDE. Deploy from GitHub into a managed cloud runtime with first-class MCP control, logs and region selection.
Section 01 · At a glance
At a glance
- Broker
- FOREX.com (GAIN Capital, a StoneX Group subsidiary)
- Broker type
- Forex and CFD broker, US-accessible
- Asset class
- Forex, indices CFDs, commodities CFDs, metals, share CFDs (per entity)
- Supported products
- 80+ spot FX currency pairs, major and minor indices CFDs, metals (XAU/USD, XAG/USD), energies, soft commodities and share CFDs in non-US entities. US clients access spot FX and the futures-style indices and metals products permitted under CFTC retail rules.
- Runtime model
- Containerised strategy runtime
- Deployment source
- GitHub
- Languages
- Any language that runs in a container
- Common integrations
- FOREX.com REST API (ciapi.cityindex.com shared StoneX infrastructure), NautilusTrader, native REST clients, custom connectors
- AI workflow integration
- MCP control surface for Cursor, Claude Code, GitHub Copilot and CLI agents
- TradingHost role
- Runtime, deployment, logs, health checks, region selection, MCP control
- FOREX.com role
- Broker account, API access, market access, execution venue
- Regulators
- GAIN Capital Group LLC (CFTC RFED, NFA-registered, US); GAIN Capital UK Limited (FCA firm reference 113942); StoneX Financial Pty Ltd (ASIC AFSL 345646, Australia, FOREX.com); GAIN Global Markets Inc (CIMA, Cayman Islands).
- Retail leverage caps
- US (GAIN Capital Group LLC, NFA Rule 2-43b): 50:1 on major FX, 20:1 on non-major FX. UK (FCA, ESMA-aligned) and EU and Australia (ASIC): 30:1 on major FX, 20:1 on non-major FX and gold, 10:1 on non-gold commodities and non-major indices, 5:1 on stocks, 2:1 on crypto CFDs. Cayman entity may permit higher leverage per CIMA rules.
- Parent disclosure
- GAIN Capital was acquired by StoneX Group Inc. (NASDAQ: SNEX) in July 2020 and is now a wholly owned subsidiary.
- Affiliation
- TradingHost is independent and is not affiliated with FOREX.com, GAIN Capital, StoneX Group, or City Index (a sister brand under GAIN Capital)
Section 02 · What FOREX.com offers
What FOREX.com offers
FOREX.com offers spot FX, indices and commodities CFDs, precious metals and share CFDs (in non-US entities) through a REST API hosted on the shared GAIN Capital / StoneX infrastructure at ciapi.cityindex.com. US clients use the CFTC-permitted subset. Endpoint specifics, instrument identifiers and rate-limit caps live in the StoneX-GAIN developer documentation.
Markets and strategy patterns
- REST strategies on 80+ FX currency pairs
- US-accessible major FX strategies (NFA Rule 2-43b)
- Major and minor indices CFD breakout (US/UK entities only)
- XAU/USD and XAG/USD precious-metals strategies
- Energy CFD strategies on WTI and Brent
- Demo-validated deployments promoted to live
API surface
- Product surfaces
- 80+ spot FX currency pairs, major and minor indices CFDs, metals (XAU/USD, XAG/USD), energies (WTI, Brent) and soft commodities. Non-US entities (UK, AU, CIMA) offer share CFDs. US clients see the CFTC-permitted subset: spot FX plus the futures-style indices and metals products. Demo and live accounts are separate.
- Connection methods
- REST API hosted at ciapi.cityindex.com (the shared StoneX-GAIN infrastructure used by FOREX.com and the City Index sister brand). The same REST surface covers session management, accounts, orders, positions, market data and historical prices. WebSocket streaming is exposed for real-time prices and trade events.
- Authentication
- Session-based authentication with a username and password (or AppKey, depending on entity onboarding). The initial /Session call returns a session token used on subsequent requests. Live API access often requires emailing the FOREX.com support team to enable REST on a live account; demo accounts have REST enabled by default for development.
For specifics, refer to FOREX.com and StoneX-GAIN
Specific endpoints, host paths, authentication flow and rate-limit caps live in the GAIN Capital REST documentation. Treat these as the source of truth.
- forex.com/en/trading-tools/api-tradingFOREX.com REST API overview
- docs.labs.gaincapital.comGAIN Capital / StoneX REST API documentation
- docs.labs.gaincapital.com (getting started)REST authentication and host references
- nfa.futures.org BASIC databaseCFTC/NFA registration check for GAIN Capital Group LLC
- stonex.comStoneX Group, FOREX.com parent (NASDAQ: SNEX)
Section 03 · Build with AI
Build your FOREX.com strategy with AI
Pick an integration method, fork a TradingHost framework starter, and author your strategy in an AI IDE. The FOREX.com REST API is the canonical TradingHost-compatible path. US clients work within the CFTC-permitted product set.
Native FOREX.com REST
Direct control over FOREX.com behaviour, session tokens, account state and the StoneX-GAIN order model.
NautilusTrader
Python framework with FX-broker integrations. Useful for event-driven strategies that share code with backtests.
MetaTrader 4 / 5 (entity-dependent)
FOREX.com offers MT4 and MT5 in selected entities. EA model in the terminal, not a TradingHost container workload.
Custom connector
Your own Python, JavaScript, Java, .NET, Go or Rust client over FOREX.com REST and the WebSocket streaming endpoint.
Framework support for FOREX.com products
FOREX.com REST and the shared StoneX-GAIN REST cover the full product surface, with share CFDs available only in non-US entities. US clients trade within the CFTC-permitted subset. Crypto CFDs are not currently part of the FOREX.com retail offering.
✓ confirmed support per FOREX.com REST docs and StoneX-GAIN documentation. "non-US" indicates the product is offered outside the US retail tier. "limited" indicates partial framework adapter coverage. Workflow links target /workflows/ pages currently in authoring.
TradingHost does not force a framework. It runs your project.
Author with AI
The framework starters above pair naturally with AI IDEs. The TradingHost MCP control surface closes the loop: AI tools can inspect deployments, review logs and manage the runtime alongside you, never the trade execution path.
Section 04 · Run on TradingHost
Run your code on TradingHost
FOREX.com (GAIN Capital, a StoneX Group subsidiary) provides the broker account and REST API. TradingHost provides the production environment where your FOREX.com-connected strategy runs.
Instead of running strategy code on a laptop, desktop machine, generic VPS or manually configured server, you deploy from GitHub into a TradingHost-managed container runtime.
You
- Your repo contains your code.
- Your deployment defines how it runs.
- Your strategy connects to FOREX.com via REST.
TradingHost
- Keeps the runtime online.
- Surfaces logs and health checks.
- Region selection.
- Controlled deployment surface.
Deployment flow
- STEP 01
Connect GitHub
Authorise TradingHost to access your GitHub account.
- STEP 02
Link a repo or start from a framework
Point TradingHost at your existing strategy repo, or fork a TradingHost FOREX.com REST starter for a working baseline.
- STEP 03
Deploy into a TradingHost container
Pick a region (US-East for GAIN Capital Group LLC US-accessible accounts and the StoneX matching venues, EU for the GAIN Capital UK FCA entity), supply the environment values your strategy needs (FOREX.com username and password or AppKey, account identifier, demo or live host), and deploy. TradingHost builds your container from the repo and runs your strategy on managed Kubernetes infrastructure.
- STEP 04
Monitor logs and health
Watch live logs, health and runtime state from the TradingHost dashboard. The same surface is reachable through MCP from any AI IDE, so Cursor, Claude Code or a CLI agent can read deployment state and manage the runtime alongside you.
- STEP 05
Update and redeploy
Push changes to your GitHub main branch and TradingHost redeploys automatically.
Section 05 · Operational notes
Operational notes for FOREX.com
Things that bite you when you actually run a FOREX.com strategy in a containerised cloud runtime. Every claim is paraphrased from FOREX.com, StoneX-GAIN documentation or the relevant regulator; the deployment-side guidance is from running these strategies on TradingHost.
01 · Shared infrastructure
FOREX.com REST runs on the shared StoneX-GAIN ciapi.cityindex.com host
The REST API for FOREX.com is the same StoneX-GAIN platform used by the City Index sister brand. Base URL is ciapi.cityindex.com/tradingapi/. The shared infrastructure means session endpoints, account endpoints and the order model are common; documentation at docs.labs.gaincapital.com applies to both FOREX.com and City Index entities. Use the host that matches your environment (live versus demo) and the entity your account is under.
02 · Session auth
Session-token authentication; live API enablement is a manual request
FOREX.com REST authenticates via a /Session call that returns a session token used in subsequent requests. Demo accounts have REST enabled by default for development. Live accounts often require explicit enablement: send an email to the FOREX.com support team referencing your account number, and they enable REST on the live account. Keep the session token in process memory; do not commit it to your repo.
03 · NFA Rule 2-43b
GAIN Capital Group LLC (US) enforces FIFO order matching and no-hedge per instrument
Under NFA Rule 2-43b, GAIN Capital Group LLC's US retail customers cannot hold simultaneous long and short positions on the same instrument and must close opposing positions in the order they were opened (first-in, first-out). A strategy that places a hedging order on the same pair will see the order net against the existing position. This rule does not apply to FOREX.com's non-US entities (GAIN Capital UK, StoneX Financial Pty Ltd). For strategies that ship across entities, the same code can produce different P&L attribution between US and non-US accounts.
04 · Parent transfer
FOREX.com inherited FXCM's US retail book in 2017; StoneX acquired GAIN in 2020
Two ownership events matter for FOREX.com history. First, in February 2017 the CFTC permanently banned FXCM from US retail FX, and FXCM transferred its US customer accounts to GAIN Capital, which already operated FOREX.com. Second, StoneX Group Inc. (NASDAQ: SNEX) acquired GAIN Capital in July 2020. The current FOREX.com entity is therefore a US-accessible broker (via GAIN Capital Group LLC), backed by a NASDAQ-listed parent, and is the formal successor of FXCM's US retail book.
05 · US product set
US clients see the CFTC-permitted retail subset, not the full FOREX.com international menu
Under CFTC retail rules, US clients of GAIN Capital Group LLC can trade spot FX and the regulator-permitted indices and metals products. Many CFD products available in the UK, Australia and Cayman entities (e.g. share CFDs) are not offered to US retail. A strategy that hard-codes share-CFD instruments will fail at order placement when targeting the US entity. Read the available instruments from the API at startup and branch on entity if your code ships across.
06 · Trade reporting
Dodd-Frank, EMIR and ASIC reporting is FOREX.com's responsibility
GAIN Capital Group LLC reports under Dodd-Frank Title VII swap-data-reporting rules as a CFTC RFED. GAIN Capital UK Limited reports under FCA / MiFID II / EMIR rules. StoneX Financial Pty Ltd reports under ASIC derivative trade-reporting rules. TradingHost does not perform regulatory trade reporting on your behalf and is not a reporting service. The strategy code you run on TradingHost is your own algorithmic activity; reporting attaches to the FOREX.com entity holding the account.
Section 06 · Built for
Built for
TradingHost FOREX.com runtimes are best suited to:
- Developers building strategies in AI IDEs (Cursor, Claude Code)
- US-accessible algorithmic FX traders (NFA Rule 2-43b aware)
- Quant FX strategy developers using StoneX-GAIN infrastructure
- Indices and metals systematic traders
- Teams moving from MetaTrader and VPS hosting to containerised deployment
Connecting GitHub and creating your first strategy is free.
Section 08 · FAQ
FAQ
No. TradingHost is independent and is not affiliated with FOREX.com, GAIN Capital, StoneX Group or any City Index entity.
No. TradingHost is not a broker and is not a registered investment firm. TradingHost is a cloud runtime that runs your strategy code. The broker relationship, the account, the leverage, the execution and the regulatory protections all live with the FOREX.com entity that holds your account.
No. Your strategy code connects to FOREX.com's REST API and sends instructions according to your own logic. TradingHost provides the runtime where that code runs.
No. FOREX.com REST API access is provided by FOREX.com (GAIN Capital / StoneX). You request live API enablement from the FOREX.com support team and you are responsible for your account, credentials and compliance with FOREX.com's terms.
Yes. GAIN Capital Group LLC is CFTC-registered and NFA-member, and FOREX.com US accepts US retail clients. Strategies running on TradingHost in the US-East region pair naturally with the US entity. NFA Rule 2-43b applies: no hedging on a single instrument, FIFO order matching.
Yes. The FOREX.com REST API is HTTP and any Python HTTP client works. The WebSocket streaming endpoint is consumed with any standard Python WebSocket library.
Yes. TradingHost supports any language that can run inside a container. FOREX.com REST is HTTP and the streaming endpoint is WebSocket, so any language with HTTP and WebSocket clients works.
FOREX.com offers MT4 and MT5 in some entities. If your strategy is an MQL Expert Advisor, that EA runs inside the MetaTrader terminal and traditionally needs a Windows VPS. For TradingHost, port the logic to FOREX.com REST; that becomes the TradingHost-compatible shape.
Open a FOREX.com account, email the support team to enable REST on a live account (or use a demo account where REST is enabled by default). Fork a TradingHost FOREX.com REST starter, or connect your own GitHub strategy repo. Linking a GitHub repo and creating a strategy is free; runtime plans are listed on the pricing page.
Yes. Leverage is set by the FOREX.com entity that holds your account. GAIN Capital Group LLC (US, NFA Rule 2-43b): 50:1 majors, 20:1 non-majors. GAIN Capital UK (FCA) and StoneX Financial Pty Ltd (ASIC) apply ESMA-aligned caps. The Cayman entity may permit higher leverage per CIMA rules. The API surface is the same across entities.
In your GitHub-controlled secrets workflow. TradingHost reads the FOREX.com username, password (or AppKey) and the session token lifecycle at runtime through GitHub repository secrets, environment secrets or your own approved secret-management process.
Yes. TradingHost supports MCP-based control for AI IDEs including Cursor, Claude Code, GitHub Copilot and CLI-based AI agents. AI tools can inspect deployments, review logs, restart strategies and manage runtime workflows. MCP is a control and observability surface, not the trade execution path.
No. Dodd-Frank, EMIR and MiFID II trade reporting is the broker's responsibility. GAIN Capital Group LLC reports under Dodd-Frank Title VII swap-data-reporting rules. GAIN Capital UK reports under MiFID II and EMIR. StoneX Financial Pty Ltd reports under ASIC rules. TradingHost runs your code; the FOREX.com entity holding the account handles regulatory reporting.
No. TradingHost is focused on production runtime and deployment. Backtesting belongs in your research stack, in a framework like NautilusTrader, or in AlgoBuilder.