Skip to content

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.

ParameterTypeDefaultDescription
api_tokenstringRequiredOANDA API access token.
account_idstringRequiredOANDA account ID (e.g. "101-001-12345678-001").
practicestring"true""true" for practice (fxTrade Practice), "false" for live (fxTrade).
Terminal window
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"
}
}'
Terminal window
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"
}
}'

OANDA uses underscore-separated instrument names:

OANDA formatMeaning
EUR_USDEuro / US Dollar
GBP_JPYBritish Pound / Japanese Yen
USD_CHFUS Dollar / Swiss Franc
XAU_USDGold / US Dollar
US30_USDDow Jones Index CFD
SPX500_USDS&P 500 Index CFD
Terminal window
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.

FeaturePracticeLive
Base URLapi-fxpractice.oanda.comapi-fxtrade.oanda.com
Real moneyNoYes
Market dataDelayedReal-time
Token formatSameSame

Start with a practice account to test your agent’s strategy before going live.

  1. Log in to your OANDA account at fxtrade.oanda.com.
  2. Go to Manage API Access under your account settings.
  3. Generate a personal access token.
  4. Copy the token and your account ID.