Forex
ID: oanda | Markets: Forex, CFDs | API: v20 REST API
OANDA provides institutional-grade forex execution with tight spreads. The v20 API supports both practice and live accounts.
Connection parameters
Section titled “Connection parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
api_token | string | Required | OANDA API access token. |
account_id | string | Required | OANDA account ID (e.g. "101-001-12345678-001"). |
practice | string | "true" | "true" for practice (fxTrade Practice), "false" for live (fxTrade). |
Practice mode
Section titled “Practice mode”curl -X POST https://agents.systemr.ai/v1/broker/connect \ -H "X-API-Key: sr_agent_..." \ -H "Content-Type: application/json" \ -d '{ "broker_type": "oanda", "connection_params": { "api_token": "YOUR_PRACTICE_API_TOKEN", "account_id": "101-001-12345678-001", "practice": "true" } }'Live mode
Section titled “Live mode”curl -X POST https://agents.systemr.ai/v1/broker/connect \ -H "X-API-Key: sr_agent_..." \ -H "Content-Type: application/json" \ -d '{ "broker_type": "oanda", "connection_params": { "api_token": "YOUR_LIVE_API_TOKEN", "account_id": "101-001-12345678-001", "practice": "false" } }'Instrument format
Section titled “Instrument format”OANDA uses underscore-separated instrument names:
| OANDA format | Meaning |
|---|---|
EUR_USD | Euro / US Dollar |
GBP_JPY | British Pound / Japanese Yen |
USD_CHF | US Dollar / Swiss Franc |
XAU_USD | Gold / US Dollar |
US30_USD | Dow Jones Index CFD |
SPX500_USD | S&P 500 Index CFD |
Placing a forex order
Section titled “Placing a forex order”curl -X POST https://agents.systemr.ai/v1/broker/order \ -H "X-API-Key: sr_agent_..." \ -H "Content-Type: application/json" \ -d '{ "symbol": "EUR_USD", "side": "buy", "quantity": "10000", "order_type": "market" }'In forex, quantity represents units of the base currency. 10,000 units of EUR_USD is a mini lot.
Practice vs live
Section titled “Practice vs live”| Feature | Practice | Live |
|---|---|---|
| Base URL | api-fxpractice.oanda.com | api-fxtrade.oanda.com |
| Real money | No | Yes |
| Market data | Delayed | Real-time |
| Token format | Same | Same |
Start with a practice account to test your agent’s strategy before going live.
Getting API tokens
Section titled “Getting API tokens”- Log in to your OANDA account at fxtrade.oanda.com.
- Go to Manage API Access under your account settings.
- Generate a personal access token.
- Copy the token and your account ID.