Skip to main content

Setup

Put them in your environment or .env; Data APIs 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

List the token’s accounts

  • Use it to find the accountID the other calls need; it reads nothing about balances or positions.

List tradeable instruments

  • The list depends on the account’s regulatory division.

Get current prices

Get candles for an instrument

  • 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