Choose a Free Forex Historical Data API
for Rates and OHLC
Compare free historical FX APIs by data type, coverage, interval, limits, and output—then retrieve and validate the right series.
Free forex historical data API: quick answer
Daily reference rates and intraday OHLC candles solve different jobs. Confirm the required pair, interval, history, and timezone first.
A free plan may limit calls, symbols, history, redistribution, or commercial use. Verify current provider terms before building.
Check timestamps, missing bars, weekends, bid/ask versus midpoint, duplicates, and candle definitions before analysis.
QVeris can help an agent discover and inspect available FX data capabilities; provider availability and cost signals must be checked at call time.
What a forex historical data API can return
Historical reference rates and tradable market candles solve different tasks. A useful forex historical-data response identifies the base and quote currencies, timestamp, source or price basis, and requested interval instead of returning an unexplained number.
Daily or periodic reference rates suit accounting, reporting, conversion, and long-range analysis. They are not necessarily executable trading prices.
Open, high, low, and close values support charting and backtesting. Confirm whether candles use bid, ask, midpoint, or a provider-specific composite.
Higher-frequency strategies may need bid/ask quotes or ticks. These datasets are larger and are less commonly included in a permanent free tier.
JSON is convenient for applications; CSV or NDJSON is often easier for long date ranges, pandas, and reproducible research.
Reference rates, candles, and ticks are not interchangeable
A central-bank reference series may publish one rate per working day and can be ideal for accounting or macro analysis. A broker candle aggregates quotes over a fixed interval and may use bid, ask, midpoint, or another convention. Tick data records individual quote changes. Choosing the wrong class can make a chart look plausible while making a backtest invalid.
Historical availability is not always point-in-time availability
Reference series can be revised, corrected, or backfilled, while vendor candles may be rebuilt after late ticks or feed repairs. For research that claims point-in-time realism, keep retrieval time, raw-file checksum, revision status, and the first date the observation was available. A clean download today may contain information that was not present on the original trading date.
A price history alone does not make a tradable backtest
A midpoint candle omits spread, liquidity, slippage, financing, rollover, and execution delay. Model those costs separately and align them with the strategy's session and holding period. If the provider does not expose historical bid/ask or spread, state that limitation instead of treating midpoint returns as executable performance.
Fields to require in a historical forex response
- Explicit base and quote currencies, plus unambiguous pair orientation.
- ISO-8601 timestamps with a documented timezone and interval boundary.
- A price basis such as reference, bid, ask, midpoint, or composite.
- For candles: open, high, low, close, and—only when meaningful—volume.
- Pagination or continuation metadata for date ranges larger than one response.
Invert a candle without corrupting its high and low
Suppose a EUR/USD candle has open 1.1000, high 1.1200, low 1.0800, and close 1.1100. The inverse USD/EUR candle does not keep the original high and low positions. Its open is 1 ÷ 1.1000 = 0.9091, its high is 1 ÷ 1.0800 = 0.9259, its low is 1 ÷ 1.1200 = 0.8929, and its close is 1 ÷ 1.1100 = 0.9009.
Validation rule: after inversion, require low ≤ open/close ≤ high, preserve the original pair and transformation, and avoid inverting rounded display values when higher-precision source values exist. A provider-native inverse pair may still differ because it can use a separate quote stream, spread, or liquidity source.
How to compare a free forex historical data API
| Check | Questions to ask | Why it matters | Red flag |
|---|---|---|---|
| Coverage | Which pairs, dates, and sessions are available? | Determines whether the dataset fits the research period. | No source or history boundary. |
| Granularity | Daily rates, hourly candles, minutes, or ticks? | Controls charting and backtest resolution. | “Real time” without an interval definition. |
| Free limits | Calls, rows, symbols, retention, and license? | Prevents a prototype from failing at scale. | No published quota or terms. |
| Data quality | Timezone, gaps, revisions, bid/ask, and timestamps? | Avoids false backtest signals. | Undocumented candle construction. |
Free tier, open endpoint, and free trial mean different things
An open endpoint may work without registration but still require attribution and enforce fair-use limits. A free tier normally needs an API key and resets a quota daily or monthly. A trial may expire or expose premium history temporarily. Record the plan name, quota, historical depth, allowed use, attribution rule, and review date instead of storing a single “free: true” flag.
A practical shortlist decision
Keep a provider only if it satisfies the non-negotiable pair, date range, interval, price basis, and license. Then compare authentication effort, pagination, quota, response format, documentation quality, and failure behavior. This prevents a generous request allowance from masking an unusable dataset.
How to get forex historical data with an API in Python
Write down EUR/USD versus USD/EUR, UTC handling, start and end dates, and whether you need daily reference rates or OHLC candles.
Confirm authentication, pagination, rate limits, date format, response fields, error codes, and whether the API supports JSON, CSV, or both.
Use a timeout, check the HTTP status, parse timestamps as timezone-aware values, sort by time, and map provider fields to a stable internal schema.
Reject duplicates, impossible high/low values, inverted pairs, unexpected gaps, and records outside the requested interval. Cache immutable history within the license terms.
Provider-neutral Python request pattern
requests.get(url, params={"base":"EUR","quote":"USD","from":"2024-01-01","to":"2024-12-31"}, timeout=20)
Treat this as a request shape, not a universal endpoint: every provider names parameters differently. After raise_for_status(), verify that the content type is expected, the response pair matches the request, timestamps are parseable, and the returned range is complete. Follow pagination until no continuation token remains.
Backtest quality checks before using the file
- Convert all timestamps to one timezone without silently dropping daylight-saving transitions.
- Confirm
low ≤ open/close ≤ highfor every candle and reject duplicates. - Explain weekend and holiday gaps separately from unexpected missing intervals.
- Do not invent volume when an OTC forex source does not provide meaningful centralized volume.
- Keep the raw response alongside normalized data so transformations remain auditable.
Keep the trading-day label separate from UTC
A provider that defines its daily FX boundary at 17:00 in America/New_York reaches 22:00 UTC during standard time and 21:00 UTC during daylight-saving time. Do not hard-code one UTC offset or derive the provider's trading date from the UTC calendar date alone. Preserve the original timestamp, IANA timezone, local trading-date label, interval start and end, and the rule used for holidays and shortened sessions.
Execution approximation: if the historical quote is 1.0998 bid and 1.1002 ask, the midpoint is 1.1000 but the quoted spread is 0.0004, or four pips for EUR/USD. A simulated purchase enters at the ask and a sale exits at the bid before slippage and fees. When only midpoint candles exist, label the backtest as a spread-free research approximation and run an explicit spread sensitivity test rather than reporting midpoint returns as executable performance.
How QVeris helps find forex historical data APIs
QVeris is a capability routing layer, not the underlying source of every FX quote. An agent can search for a historical forex capability, inspect its parameters and current cost signals, then call the selected tool through the documented QVeris flow.
- Discover candidate capabilities with a natural-language description of the pair, date range, and interval.
- Inspect the returned schema, provider information, reliability signals, and cost metadata before execution.
- Call only after confirming that the selected capability matches the dataset and license your workflow needs.
Free forex historical data API FAQ
Free API plans, open central-bank reference-rate datasets, and downloadable market archives are common starting points. Match the source to daily rates, OHLC candles, or tick data.
Yes, but “free” may mean an open endpoint, a capped free tier, or a trial. Check authentication, quotas, history, license, and attribution requirements.
Yes. Use an HTTP client, validate the status and schema, parse timezone-aware timestamps, normalize pair orientation, and then load the records into pandas.
Some providers include daily or limited intraday candles; others supply reference rates only. Never infer OHLC support from the phrase “exchange rate API.”
Only when the data resolution, price basis, history, quality, and license match the test. Validate gaps and avoid treating reference rates as executable prices.
