Read time … min

AI-native runtime for OANDA trading strategies

Author OANDA v20 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.

By the TradingHost engineering team

Section 01 · At a glance

At a glance

Broker
OANDA
Broker type
Forex and CFD broker
Asset class
Forex, indices, commodities, metals, bonds
Supported products
70+ spot FX currency pairs, major indices CFDs, gold and silver (XAU/USD, XAG/USD), energies (WTI, Brent), bond CFDs
Runtime model
Containerised strategy runtime
Deployment source
GitHub
Languages
Any language that runs in a container
Common integrations
OANDA v20 REST and streaming, FIX 4.4, NautilusTrader, Backtrader, native Python and Java SDKs, 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
OANDA role
Broker account, API access, market access, execution venue
Regulators
OANDA Corporation (CFTC RFED, NFA ID 0325821, US), OANDA Australia Pty Limited (ASIC AFSL 412981), OANDA Europe Markets Ltd (CySEC, Malta), OANDA Global Markets Ltd (BVI FSC), OANDA (Canada) Corp (CIRO)
Retail leverage caps
US (OANDA Corporation, NFA Rule 2-43b): 50:1 on major FX, 20:1 on non-major FX. Australia (ASIC) and Europe (CySEC, ESMA-aligned): 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. Offshore entity (BVI FSC) may permit higher per the relevant onboarding entity.
Affiliation
TradingHost is independent and is not affiliated with OANDA Corporation or any OANDA Group entity

Section 02 · What OANDA offers

What OANDA offers

OANDA offers spot forex on 70+ currency pairs, indices and commodities CFDs, precious metals and bond CFDs via the v20 REST API, v20 streaming over long-poll HTTP, and a FIX 4.4 session. Strategies authenticate with a per-account bearer token. Practice (fxPractice) and live (fxTrade) are separate environments with separate hosts and tokens. Endpoint specifics live in OANDA's docs and change over time.

Markets and strategy patterns

  • OANDA v20 REST strategies on 70+ FX currency pairs
  • EUR/USD and USD/JPY carry trade strategies
  • Major indices CFD breakout (SPX500, US30, NAS100, UK100)
  • XAU/USD and XAG/USD precious-metals strategies
  • WTI and Brent oil CFD strategies
  • Streaming-pricing-driven momentum strategies (long-poll HTTP)
  • fxPractice-validated deployments promoted to fxTrade
  • NFA Rule 2-43b FIFO-compliant US retail strategies

API surface

Product surfaces
70+ spot FX currency pairs (majors, minors, exotics), major indices CFDs (SPX500, US30, NAS100, UK100, GER40, JP225), precious metals (XAU/USD, XAG/USD), energies (WTI, Brent), bond CFDs. The fxPractice environment mirrors the same product surface against a paper-trading host so strategies can be validated against the same v20 endpoints without real capital.
Connection methods
OANDA v20 REST for order placement, accounts, trades and positions. v20 streaming for pricing and transactions over long-poll chunked HTTP (a single open TCP connection rather than WebSocket). FIX 4.4 for pro retail and institutional flows. Native Python and Java SDKs wrap v20 REST and streaming.
Authentication
Bearer token: HTTP "Authorization: Bearer <token>" header on every authenticated request. One token per OANDA account, generated under Manage API Access in the user portal. Practice (fxPractice) and live (fxTrade) tokens are scoped to their environment and are not interchangeable.

Section 03 · Build with AI

Build your OANDA strategy with AI

Pick an integration method, fork a TradingHost framework starter, and author your strategy in an AI IDE. Cursor, Claude Code, GitHub Copilot and CLI-based AI agents all work with the same GitHub-native deployment loop.

  • Native OANDA v20 API

    Direct control over OANDA-specific behaviour, account state, streaming pricing and order execution.

  • NautilusTrader

    High-performance Python framework with a documented OANDA adapter and an event-driven actor model.

  • Backtrader

    Stable Python framework whose `OandaV20Store` broker class makes OANDA v20 a first-class venue.

  • FIX 4.4 or custom connector

    OANDA FIX 4.4 session, or your own Python or Java integration on top of v20 REST and streaming.

Framework support for OANDA products

Coverage tracks OANDA's product set. OANDA's retail entities do not offer share CFDs or crypto CFDs, so those columns are honestly marked "no" rather than left blank.

FrameworkFXIndicesCommoditiesCFDCrypto CFDs
Native OANDA v20SupportedSupportedSupportedNot documented as supportedNot documented as supported
NautilusTraderSupportedSupportedSupportedNot documented as supportedNot documented as supported
BacktraderSupportedSupportedSupportedNot documented as supportedNot documented as supported
FIX 4.4SupportedSupportedSupportedNot documented as supportedNot documented as supported

✓ confirmed support per official framework docs and OANDA's product set. "no" indicates OANDA does not offer the product class, not a framework limitation. 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

OANDA provides the broker account and API access. TradingHost provides the production environment where your OANDA-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 OANDA.

TradingHost

  • Keeps the runtime online.
  • Surfaces logs and health checks.
  • Region selection.
  • Controlled deployment surface.

Deployment flow

  1. STEP 01

    Connect GitHub

    Authorise TradingHost to access your GitHub account.

  2. STEP 02

    Link a repo or start from a framework

    Point TradingHost at your existing strategy repo, or fork a TradingHost framework runtime (NautilusTrader or Backtrader for OANDA, or the OANDA v20 starter) for a working baseline.

  3. STEP 03

    Deploy into a TradingHost container

    Pick a region (EU for European OANDA entities, US-East for OANDA Corporation in the US), supply the environment values your strategy needs (v20 bearer token, account ID, fxPractice or fxTrade host), and deploy. TradingHost builds your container from the repo and runs your strategy on managed Kubernetes infrastructure. No local Docker install required.

  4. 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.

  5. STEP 05

    Update and redeploy

    Push changes to your GitHub main branch and TradingHost redeploys automatically.

Section 05 · Operational notes

Operational notes for OANDA

Things that bite you when you actually run an OANDA strategy in a containerised cloud runtime, not in OANDA's marketing pages, not in framework READMEs. Every claim below is paraphrased from OANDA's own documentation or the relevant regulator's rulebook; the deployment-side guidance is from running these strategies on TradingHost.

  1. 01 · Host split

    fxTrade (live) and fxPractice (demo) are separate hosts with separate tokens

    Live REST host is api-fxtrade.oanda.com, practice REST host is api-fxpractice.oanda.com. Tokens are generated under Manage API Access in the matching environment and are not interchangeable: a fxTrade token will not authenticate against fxPractice and vice versa. Account IDs also differ between environments (fxPractice IDs typically prefix `101-`). Keep practice and live tokens in separate TradingHost Secrets entries; never reuse one across environments, and never hard-code the host string in code paths that ship between environments.

  2. 02 · Authentication

    Bearer token in the Authorization header, one token per OANDA account

    Every authenticated request to v20 carries `Authorization: Bearer <token>`. The token is generated in the OANDA user portal under Manage API Access and is scoped to the user it was generated for; account selection happens via the path (`/v3/accounts/<accountID>/...`), not via a separate header. Rotate the token if it leaks and store it in your repo's GitHub Secrets, not in committed code or environment files.

  3. 03 · Streaming

    Pricing and transactions stream over long-poll chunked HTTP, not WebSocket

    OANDA's streaming endpoints (`/v3/accounts/<accountID>/pricing/stream`, `/v3/accounts/<accountID>/transactions/stream`) hold a single open TCP connection and emit JSON chunks separated by newlines. There is no WebSocket frame layer. Container reconnect logic must treat connection drops, partial chunks and idle timeouts explicitly. The stream emits a periodic heartbeat object so the client can detect dead connections; act on missing heartbeats rather than waiting for the OS-level timeout.

  4. 04 · NFA Rule 2-43b

    OANDA Corporation (US) enforces FIFO order matching and no-hedge per instrument

    Under NFA Rule 2-43b, OANDA Corporation'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, not open a separate position. This rule does not apply to OANDA's non-US entities (Australia, Europe, BVI). For strategies that ship across entities, the same code can produce different P&L attribution between US and non-US accounts.

  5. 05 · Rate limits

    Per-token request rate caps; respect retry-after on 429

    OANDA enforces per-token request-rate ceilings on v20. Exceeded limits return HTTP 429 with a body indicating throttling. Containers under bursty market conditions (open-of-session, news prints) can trip the cap if every loop iteration calls account or pricing endpoints. Prefer the streaming pricing endpoint over polling, batch related requests, and back off exponentially on 429. Specific request-per-second caps live in OANDA's docs and change over time; treat the docs as authoritative.

  6. 06 · Account ID

    Account ID is path-bound on most v20 endpoints

    Trading, positions, transactions, pricing and most account endpoints take the form `/v3/accounts/<accountID>/<resource>`. The bearer token authenticates the user; the path selects the account. A user with both a sub-account and a primary account holds two distinct accountIDs and the strategy must pick the right one. The `/v3/accounts` endpoint lists every accountID the token can access, and `/v3/accounts/<accountID>/summary` confirms currency, leverage entity and balance before the strategy starts placing orders.

  7. 07 · Trade reporting

    EMIR, MiFID II, Dodd-Frank reporting is OANDA's responsibility, not TradingHost's

    OANDA Europe Markets Ltd reports under EMIR and MiFID II. OANDA Corporation reports under Dodd-Frank Title VII swap-data-reporting rules as a CFTC RFED. OANDA Australia 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 broker-of-record, which is the OANDA entity holding the account.

Section 06 · Built for

Built for

TradingHost OANDA runtimes are best suited to:

  • Developers building strategies in AI IDEs (Cursor, Claude Code)
  • Quant FX strategy developers
  • Carry trade and indices momentum traders
  • NautilusTrader and Backtrader users
  • 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 OANDA Corporation or any OANDA Group 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 OANDA. You sign up directly with the appropriate OANDA entity for your jurisdiction.

No. Your strategy code connects to OANDA and sends instructions according to your own logic, account permissions and integration method. TradingHost provides the runtime where that code runs.

No. OANDA v20 API access is provided by OANDA. You are responsible for your OANDA account, API access permissions, bearer token rotation and compliance with OANDA's terms.

Yes. TradingHost runs Python strategies; pick a framework runtime that matches your stack (NautilusTrader, Backtrader, or the OANDA v20 starter) or deploy your own repo. OANDA's native v20-python SDK is supported.

Yes. TradingHost supports any language that can run inside a container. OANDA's v20 REST and streaming endpoints are HTTP, so any language with an HTTP client can call them.

Yes, if your project is designed that way. You can run multiple strategy processes or services inside one runtime, or separate them into different runtimes for isolation and operational clarity. See the TradingHost runtime page for the multi-strategy model.

TradingHost runs containerised cloud workloads, not MetaTrader 4 or MetaTrader 5 desktop terminals. If your OANDA strategy is an MT4 or MT5 Expert Advisor compiled in MQL, that EA runs inside the MetaTrader terminal and traditionally needs a Windows VPS to stay online. For TradingHost, port the logic to a v20 REST or v20 streaming client; that becomes the TradingHost-compatible shape.

The fastest path is to fork a TradingHost framework runtime: NautilusTrader or Backtrader both have first-class OANDA support. 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 OANDA entity that holds your account, not by TradingHost. OANDA Corporation (US) caps retail leverage at 50:1 on major FX and 20:1 on non-major FX per NFA Rule 2-43b. OANDA Australia (ASIC) and OANDA Europe Markets (CySEC) cap major FX at 30:1, non-major FX and gold at 20:1, with lower caps on other instruments. OANDA Global Markets (BVI) permits higher leverage per BVI FSC rules. The leverage caps follow the regulator of your account-holding entity; the API surface is the same.

In your GitHub-controlled secrets workflow. TradingHost reads the token at runtime through GitHub repository secrets, environment secrets or your own approved secret-management process. TradingHost does not need custody of your token.

No. OANDA v20 tokens grant access to trading, account state and pricing, not to withdrawals or funding. Funding and withdrawals happen through the OANDA user portal, not the API. Keep withdrawal-permitted operations off the v20 surface entirely.

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. EMIR and MiFID II trade reporting is the broker's responsibility. OANDA Europe Markets Ltd reports under EMIR and MiFID II as the regulated investment firm. OANDA Corporation reports under Dodd-Frank Title VII swap-data-reporting rules as a CFTC RFED. OANDA Australia reports under ASIC derivative trade-reporting rules. TradingHost runs your code; the broker-of-record handles regulatory reporting.

TradingHost runs in the EU and US-East regions. The EU region is the natural fit for OANDA Europe Markets and OANDA Australia traffic; US-East is the natural fit for OANDA Corporation (US) traffic.

No. TradingHost is focused on production runtime and deployment. Backtesting belongs in your research stack, framework (NautilusTrader's backtester, Backtrader's engine, vectorbt) or in AlgoBuilder.