> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# OANDA

> Forex, metals and CFD prices from OANDA's v20 REST API: tradeable instruments, live bid/ask pricing and historical candles.

![](https://mintcdn.com/webrouter/JBFYvcRI1PVnd4YX/logo/data-apis/oanda.webp?fit=max\&auto=format\&n=JBFYvcRI1PVnd4YX\&q=85\&s=5fc9ede79d57e294896271b0ee0deca7)

[Web Catalog · Finance](https://docs.webrouter.net/data-apis.md?category=finance)

Needs&#x20;

`OANDA_API_KEY`

Endpoints

5

Auth

Key in header

[Vendor docs](https://developer.oanda.com/rest-live-v20/introduction/)

## Setup

| Variable | | What it is |
| - | - | - |
| `OANDA_API_KEY` | required | An OANDA personal access token (fxTrade Account Management Portal > Manage API Access). Sent as an Authorization Bearer header. |
| `OANDA_HOST` | optional | api-fxpractice.oanda.com for a practice (demo) account token, api-fxtrade.oanda.com for a live account token. Use the host that matches the account the token belongs to. Default `api-fxpractice.oanda.com`. One of `api-fxpractice.oanda.com`, `api-fxtrade.oanda.com`. |

Put them in your environment or `.env`; [Data APIs](https://docs.webrouter.net/vendors.md) covers the other ways.

## Notes

* Needs an OANDA fxTrade account, practice or live; every data call is scoped to an account ID.
* Limit: 120 requests per second per IP, and at most 2 new connections per second; over it returns 429.
* Instruments are written BASE\_QUOTE with an underscore: EUR\_USD, XAU\_USD.
* Times come back RFC 3339 by default; an Accept-Datetime-Format: UNIX header switches them to Unix seconds.
* Only market-data reads are listed; the order, trade and transfer endpoints are left out on purpose.

## Endpoints

GET

List the token's accounts

IDs and tags of every account the access token can read.

[Open](#oanda-accounts-list)

GET

List tradeable instruments

Instruments the account can trade, with display precision, pip location, margin rate and type (CURRENCY, CFD or METAL).

[Open](#oanda-instruments-list)

GET

Get current prices

Latest bid and ask ladders, closeout prices and tradeable status for instruments.

[Open](#oanda-pricing-get)

GET

Get candles for an instrument

Mid, bid and/or ask OHLC candles and tick volume for one instrument.

[Open](#oanda-instrument-candles)

GET

Get the latest candles for several instruments

Current and last completed candle for several instrument, granularity and price combinations.

[Open](#oanda-pricing-latest-candles)

### List the token's accounts

GET

`/v3/accounts`

`oanda.accounts.list`

IDs and tags of every account the access token can read.

Input

No inputs.

[Vendor docs](https://developer.oanda.com/rest-live-v20/account-ep/)

```python Python theme={null}
router.call_data_api("oanda.accounts.list")
```

```text MCP theme={null}
call_data_api(endpoint="oanda.accounts.list")
```

> [!NOTE]
>
> * Use it to find the accountID the other calls need; it reads nothing about balances or positions.

### List tradeable instruments

GET

`/v3/accounts/{accountID}/instruments`

`oanda.instruments.list`

Instruments the account can trade, with display precision, pip location, margin rate and type (CURRENCY, CFD or METAL).

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `accountID`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Account ID (list them with oanda.accounts.list).
      </td>
    </tr>

    <tr><td>`instruments`</td><td>string</td><td>query</td><td>Comma-separated instruments to return, e.g. EUR\_USD,XAU\_USD. Example `EUR_USD,USD_JPY`</td></tr>
  </tbody>
</table>

[Vendor docs](https://developer.oanda.com/rest-live-v20/account-ep/) · Same job: [Binance](https://docs.webrouter.net/data-apis/binance.md#binance-exchange-info), [Coinbase Exchange](https://docs.webrouter.net/data-apis/coinbase-exchange.md#coinbase-exchange-products-list), [CoinMarketCap](https://docs.webrouter.net/data-apis/coinmarketcap.md#coinmarketcap-cryptocurrency-map), [Commodity Price API](https://docs.webrouter.net/data-apis/commoditypriceapi.md#commoditypriceapi-symbols), [Fixer](https://docs.webrouter.net/data-apis/fixer.md#fixer-symbols), [Open Exchange Rates](https://docs.webrouter.net/data-apis/open-exchange-rates.md#open-exchange-rates-currencies)

> [!NOTE]
>
> * The list depends on the account's regulatory division.

### Get current prices

GET

`/v3/accounts/{accountID}/pricing`

`oanda.pricing.get`

Latest bid and ask ladders, closeout prices and tradeable status for instruments.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `accountID`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Account ID (list them with oanda.accounts.list).
      </td>
    </tr>

    <tr><td>`instruments` required</td><td>string</td><td>query</td><td>Comma-separated instruments, e.g. EUR\_USD,USD\_CAD. Example `EUR_USD,USD_CAD`</td></tr>

    <tr>
      <td>
        `since`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Only prices that changed after this time (RFC 3339 or Unix seconds).
      </td>
    </tr>

    <tr>
      <td>
        `includeHomeConversions`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Add conversion factors to the account's home currency; default false.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://developer.oanda.com/rest-live-v20/pricing-ep/) · Same job: [currencylayer](https://docs.webrouter.net/data-apis/currencylayer.md#currencylayer-live), [exchangerate.host](https://docs.webrouter.net/data-apis/exchangerate-host.md#exchangerate-host-live), [Fixer](https://docs.webrouter.net/data-apis/fixer.md#fixer-latest), [Open Exchange Rates](https://docs.webrouter.net/data-apis/open-exchange-rates.md#open-exchange-rates-latest), [US Treasury Fiscal Data](https://docs.webrouter.net/data-apis/treasury-fiscal-data.md#treasury-fiscal-data-rates-of-exchange), [Wise](https://docs.webrouter.net/data-apis/wise.md#wise-rates-get)

### Get candles for an instrument

GET

`/v3/accounts/{accountID}/instruments/{instrument}/candles`

`oanda.instrument.candles`

Mid, bid and/or ask OHLC candles and tick volume for one instrument.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `accountID`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Account ID (list them with oanda.accounts.list).
      </td>
    </tr>

    <tr><td>`instrument` required</td><td>string</td><td>path</td><td>Instrument, e.g. EUR\_USD, XAU\_USD. Example `EUR_USD`</td></tr>
    <tr><td>`price`</td><td>string</td><td>query</td><td>Any mix of M (mid), B (bid), A (ask), e.g. MBA; default M. Example `M`</td></tr>
    <tr><td>`granularity`</td><td>string</td><td>query</td><td>Candle size: S5 (default) to M (month), e.g. M1, H1, D, W. One of `S5`, `S10`, `S15`, `S30`, `M1`, `M2`, `M4`, `M5`, `M10`, `M15`, `M30`, `H1`, `H2`, `H3`, `H4`, `H6`, `H8`, `H12`, `D`, `W`, `M` Example `H1`</td></tr>

    <tr>
      <td>
        `count`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Candles to return, default 500, at most 5000. Leave out when giving both from and to.
      </td>
    </tr>

    <tr><td>`from`</td><td>string</td><td>query</td><td>Range start, RFC 3339 or Unix seconds. Example `2024-01-01T00:00:00Z`</td></tr>

    <tr>
      <td>
        `to`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Range end, RFC 3339 or Unix seconds.
      </td>
    </tr>

    <tr>
      <td>
        `smooth`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Open each candle at the previous close; default false.
      </td>
    </tr>

    <tr>
      <td>
        `includeFirst`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Include the candle covering from; default true. false helps polling.
      </td>
    </tr>

    <tr>
      <td>
        `dailyAlignment`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Hour (0-23) daily candles close at, in alignmentTimezone; default 17.
      </td>
    </tr>

    <tr><td>`alignmentTimezone`</td><td>string</td><td>query</td><td>Time zone for dailyAlignment; default America/New\_York. Times still come back in UTC. Example `America/New_York`</td></tr>
    <tr><td>`weeklyAlignment`</td><td>string</td><td>query</td><td>Day weekly candles start on; default Friday. One of `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday`, `Sunday`</td></tr>
  </tbody>
</table>

[Vendor docs](https://developer.oanda.com/rest-live-v20/pricing-ep/) · Same job: [Alpha Vantage](https://docs.webrouter.net/data-apis/alphavantage.md#alphavantage-daily), [Bank of Canada](https://docs.webrouter.net/data-apis/bankofcanada.md#bankofcanada-observations-series), [Bank of England](https://docs.webrouter.net/data-apis/bankofengland.md#bankofengland-series-csv), [Binance](https://docs.webrouter.net/data-apis/binance.md#binance-klines), [Coinbase Exchange](https://docs.webrouter.net/data-apis/coinbase-exchange.md#coinbase-exchange-candles-get), [CoinGecko](https://docs.webrouter.net/data-apis/coingecko.md#coingecko-coins-market-chart)

> [!NOTE]
>
> * The last candle can be incomplete: check complete on each candle.
> * Prices are strings, to keep their precision.

### Get the latest candles for several instruments

GET

`/v3/accounts/{accountID}/candles/latest`

`oanda.pricing.latest_candles`

Current and last completed candle for several instrument, granularity and price combinations.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `accountID`

        required
      </td>

      <td>
        string
      </td>

      <td>
        path
      </td>

      <td>
        Account ID (list them with oanda.accounts.list).
      </td>
    </tr>

    <tr><td>`candleSpecifications` required</td><td>string</td><td>query</td><td>Comma-separated INSTRUMENT:GRANULARITY:PRICE specs, e.g. EUR\_USD:M1:M,USD\_JPY:H1:BA. Example `EUR_USD:S10:BM`</td></tr>

    <tr>
      <td>
        `smooth`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Open each candle at the previous close; default false.
      </td>
    </tr>

    <tr>
      <td>
        `dailyAlignment`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Hour (0-23) daily candles close at, in alignmentTimezone; default 17.
      </td>
    </tr>

    <tr><td>`alignmentTimezone`</td><td>string</td><td>query</td><td>Time zone for dailyAlignment; default America/New\_York. Times still come back in UTC. Example `America/New_York`</td></tr>
    <tr><td>`weeklyAlignment`</td><td>string</td><td>query</td><td>Day weekly candles start on; default Friday. One of `Monday`, `Tuesday`, `Wednesday`, `Thursday`, `Friday`, `Saturday`, `Sunday`</td></tr>
  </tbody>
</table>

[Vendor docs](https://developer.oanda.com/rest-live-v20/pricing-ep/) · Same job: [Alpha Vantage](https://docs.webrouter.net/data-apis/alphavantage.md#alphavantage-daily), [Bank of Canada](https://docs.webrouter.net/data-apis/bankofcanada.md#bankofcanada-observations-series), [Bank of England](https://docs.webrouter.net/data-apis/bankofengland.md#bankofengland-series-csv), [Binance](https://docs.webrouter.net/data-apis/binance.md#binance-klines), [Coinbase Exchange](https://docs.webrouter.net/data-apis/coinbase-exchange.md#coinbase-exchange-candles-get), [CoinGecko](https://docs.webrouter.net/data-apis/coingecko.md#coingecko-coins-market-chart)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.