# OANDA API GET /v3/instruments/{instrument}/candles

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/brokers/oanda/endpoints/candles, written from the same records as that page.

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.

Historical candlesticks (OHLC) for one instrument. Up to 5000 candles per request.

- Request: `GET /v3/instruments/{instrument}/candles`
- Version: v3
- Group: Instruments
- Status: unverified. Source: [raw.githubusercontent.com](https://raw.githubusercontent.com/oanda/v20-openapi/master/json/v20.json), checked 2026-10-12.
- Official reference: https://developer.oanda.com/rest-live-v20/pricing-ep/

Note: Not verified on OANDA's own site today. The instrument endpoints page this record was read on (developer.oanda.com/rest-live-v20/instrument-ep/) answered 404 on 12 Oct 2026 and the site's menu no longer lists it. That is not evidence that the call has gone. OANDA's own OpenAPI file on GitHub (oanda/v20-openapi, version 3.0.25), opened the same day, still defines GET /instruments/{instrument}/candles under the base path /v3 with the parameters listed here, and is the source linked on this record. What OANDA's site documents today is the account scoped call, GET /v3/accounts/{accountID}/instruments/{instrument}/candles, on its pricing endpoints page: the same query parameters plus units, with count defaulting to 500 and capped at 5000.

## Parameters

- `Accept-Datetime-Format` (in header, type string, optional): Optional. RFC3339 (default) or UNIX for epoch seconds in datetime fields.
- `instrument` (in path, type string, required): Instrument name with an underscore.
- `price` (in query, type string, optional): Price component: M (mid, default), B (bid), A (ask), or a combination such as BA.
- `granularity` (in query, type string, optional): Candle size, for example S5 (default), M1, H1, D.
- `count` (in query, type integer, optional): Number of candles. Default 500, maximum 5000. Do not combine with both from and to.
- `from` (in query, type string, optional): Start of the range, RFC3339 or UNIX per Accept-Datetime-Format.
- `to` (in query, type string, optional): End of the range.
- `smooth` (in query, type boolean, optional): Use the previous close as the open. Default false.
- `includeFirst` (in query, type boolean, optional): Include the candle covered by the from time. Default true.
- `dailyAlignment` (in query, type integer, optional): Hour (0 to 23) daily candles align to. Default 17.
- `alignmentTimezone` (in query, type string, optional): Timezone for dailyAlignment. Default America/New_York.
- `weeklyAlignment` (in query, type string, optional): Day weekly candles start on. Default Friday.

### Authentication headers

- `Authorization` (type string, required): 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 at https://openbrokerapi.com/tools/request-builder writes these same snippets, from the same record.

### Python

```python
# Set OANDA_TOKEN as an environment variable 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 price, granularity, count, from, to, smooth, includeFirst, dailyAlignment, alignmentTimezone, weeklyAlignment.
import os
import requests

BASE_URL = "https://api-fxpractice.oanda.com"  # the demo host
headers = {
    "Authorization": "Bearer " + os.environ["OANDA_TOKEN"],
}
resp = requests.get(BASE_URL + "/v3/instruments/{instrument}/candles", headers=headers, timeout=10)
resp.raise_for_status()
print(resp.json())
```

### JavaScript

```javascript
// Set OANDA_TOKEN as an environment variable 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 price, granularity, count, from, to, smooth, includeFirst, 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/instruments/{instrument}/candles", {
  method: "GET",
  headers: {
    "Authorization": "Bearer " + process.env.OANDA_TOKEN,
  },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

### curl

```bash
# Set OANDA_TOKEN as an environment variable 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 price, granularity, count, from, to, smooth, includeFirst, dailyAlignment, alignmentTimezone, weeklyAlignment.
curl -X GET "https://api-fxpractice.oanda.com/v3/instruments/{instrument}/candles" \
  -H "Authorization: Bearer $OANDA_TOKEN"
```

## Response

A mock response. The values are invented, so check field names against the [official reference](https://developer.oanda.com/rest-live-v20/pricing-ep/).

```json
{
  "_mock": true,
  "instrument": "EUR_USD",
  "granularity": "H1",
  "candles": [
    {
      "complete": true,
      "volume": 1234,
      "time": "2026-09-18T08:00:00.000000000Z",
      "mid": {
        "o": "1.10000",
        "h": "1.10250",
        "l": "1.09900",
        "c": "1.10120"
      }
    }
  ]
}
```

## Response schema, HTTP 200

Every field this site's OpenAPI file for OANDA (https://openbrokerapi.com/specs/oanda.json) declares for this response.

- `instrument` (string): Not recorded
- `granularity` (string): Not recorded
- `candles` (array of objects): Not recorded
  - `complete` (boolean): Not recorded
  - `volume` (number): Not recorded
  - `time` (string): Not recorded
  - `mid` (object): Not recorded
    - `o` (string): Not recorded
    - `h` (string): Not recorded
    - `l` (string): Not recorded
    - `c` (string): Not recorded

Status: unverified. No source opened. This schema is not sourced to a page of the provider's own that we opened, so check field names against the official reference.

## Limits that apply at OANDA

- Headline limit: 120/s per IP address, HTTP 429 above it
  - Scope: ip
  - Status: verified. Source: [developer.oanda.com](https://developer.oanda.com/rest-live-v20/development-guide/), checked 2026-10-03.
  - Note: Best practices. Also 2 new connections a second. The development guide separately states 120 requests a second per IP address, read 24 Sep 2026; the two figures are in different units and neither replaces the other.

## More on the OANDA API

- [All OANDA API endpoints](https://openbrokerapi.com/brokers/oanda/endpoints): 33 documented, grouped by what they do.
- [OANDA API quickstart](https://openbrokerapi.com/brokers/oanda/quickstart)
- [All OANDA API error codes](https://openbrokerapi.com/errors/oanda)
- [OANDA API page](https://openbrokerapi.com/brokers/oanda): The full record: access, authentication, limits and the source for each.
- [OANDA API as an OpenAPI file](https://openbrokerapi.com/specs/oanda.json): Generated from these endpoint records. Independent and unofficial.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: OANDA API GET /v3/instruments/{instrument}/candles. Broker API Hub, https://openbrokerapi.com/brokers/oanda/endpoints/candles, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
