OANDA API GET /v3/accounts/{accountID}/candles/latest
The candle still forming and the most recently completed ones, for several combinations of instrument, granularity and price component in one call.
Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.
Read on OANDA's own pricing endpoints page on 12 Oct 2026: method, path, parameters and the top level response fields. The page names one top level field, latestCandles. The candle fields in the mock follow this site's record for instrument candles. The format of a candle specification was not read.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| Accept-Datetime-Format | header | string | Optional. RFC3339 (default) or UNIX for epoch seconds in datetime fields. |
| accountIDrequired | path | string | Account ID from GET /v3/accounts. Mock value shown. |
| candleSpecificationsrequired | query | string | Candle specifications to fetch, separated by commas. |
| units | query | string | Number of units used to work out the volume weighted average bid and ask. Default 1. |
| smooth | query | boolean | Use the previous close as the open. Default false. |
| dailyAlignment | query | integer | Hour (0 to 23) daily candles align to. Default 17. |
| alignmentTimezone | query | string | Timezone for dailyAlignment. Default America/New_York. |
| weeklyAlignment | query | string | Day weekly candles start on. Default Friday. |
Authentication headers
| Name | Type | Description |
|---|---|---|
| Authorizationrequired | string | Send Bearer followed by your personal access token. Placeholder only: never paste a real token into this site. |
Request
Written from the method, path and parameters recorded on this page, against the demo host. Not executed against a live or demo account. Credentials are read from environment variables on your own machine and are never entered on this site. The request builder writes these same snippets, from the same record.
Python
# Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: headers Accept-Datetime-Format; query parameters units, smooth, dailyAlignment, alignmentTimezone, weeklyAlignment.
import os
import requests
BASE_URL = "https://api-fxpractice.oanda.com" # the demo host
headers = {
"Authorization": "Bearer " + os.environ["OANDA_TOKEN"],
}
params = {"candleSpecifications": "{candleSpecifications}"}
resp = requests.get(BASE_URL + "/v3/accounts/" + os.environ["OANDA_ACCOUNT_ID"] + "/candles/latest", headers=headers, params=params, timeout=10)
resp.raise_for_status()
print(resp.json())JavaScript
// Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
// Replace each {placeholder}, "..." and 0 with a real value before running.
// Optional and not shown: headers Accept-Datetime-Format; query parameters units, smooth, dailyAlignment, alignmentTimezone, weeklyAlignment.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = "https://api-fxpractice.oanda.com"; // the demo host
const res = await fetch(BASE_URL + "/v3/accounts/" + process.env.OANDA_ACCOUNT_ID + "/candles/latest" + "?candleSpecifications={candleSpecifications}", {
method: "GET",
headers: {
"Authorization": "Bearer " + process.env.OANDA_TOKEN,
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());curl
# Set OANDA_TOKEN, OANDA_ACCOUNT_ID as environment variables first. Never paste real values into code.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: headers Accept-Datetime-Format; query parameters units, smooth, dailyAlignment, alignmentTimezone, weeklyAlignment.
curl -X GET "https://api-fxpractice.oanda.com/v3/accounts/$OANDA_ACCOUNT_ID/candles/latest?candleSpecifications={candleSpecifications}" \
-H "Authorization: Bearer $OANDA_TOKEN"Response
A mock response. The values are invented, so check field names against the official reference.
{
"_mock": true,
"latestCandles": [
{
"instrument": "EUR_USD",
"granularity": "H1",
"candles": [
{
"complete": false,
"volume": 321,
"time": "2026-09-18T09:00:00.000000000Z",
"mid": {
"o": "1.10120",
"h": "1.10180",
"l": "1.10090",
"c": "1.10150"
}
}
]
}
]
}Limits that apply at OANDA
| Limit | Value | Scope | Source |
|---|---|---|---|
| Headline limit | 120/s per IP address, HTTP 429 above it | ip | developer.oanda.comchecked |
OANDA API errors you may meet
- HTTP 401 (invalid or missing token)HTTP 401. The access token is invalid or missing.
- HTTP 405HTTP 405. The endpoint was called with the wrong HTTP method.
- HTTP 429HTTP 429. OANDA returned HTTP 429 because requests arrived faster than it would accept them.
- ACCOUNT_CONFIGURATION_LOCKEDThe account is locked for configuration changes.
- ACCOUNT_DEPOSIT_LOCKEDThe account is locked for deposits.
- ACCOUNT_LOCKEDThe account is locked.
All OANDA API error codes, including 236 more not listed here.