
If you’ve ever copied exchange rates off a website into a spreadsheet, one cell at a time, you already know the problem. A forex API solves it: your code requests currency prices directly – a live EURUSD quote, years of daily bars, whatever you need – and gets back clean, structured data it can chart, backtest, or wire into an app. No copy-paste, no stale numbers, no refreshing a browser tab at 2am (the FX market doesn’t sleep, but you should).
Let’s get into what a forex API returns, how developers actually put one to work, and how to pull real currency data in a few lines of code.
What a Forex API Actually Returns
Two things cover most of it: quotes and bars.
Quotes are the current state of the market for a pair. A good FX API gives you the bid (the price you can sell at), the ask (the price you can buy at), and usually the mid (the midpoint of the two), along with a timestamp. The gap between bid and ask is the spread, and it’s effectively your cost of trading – which is why quote data with real bid and ask prices matters more than a single blended number.
Bars – also called candles or OHLC data – summarize price over an interval: the open, high, low, and close. Daily bars are the workhorse for long-horizon analysis; intraday bars serve shorter strategies. This is the format charting libraries and backtesting frameworks expect, so historical endpoints usually hand you data this way.
Cutting across both is the real-time vs historical split. Real-time quotes power live dashboards, alerts, and trading logic. Historical prices power research, charting, and backtests. Most projects end up wanting both, which is worth remembering when you pick a provider.
A Quick Word on Pair Conventions
Currency pairs are written as base/quote. EURUSD is euros priced in dollars: a quote of 1.10 means one euro costs $1.10. Flip the pair and you flip the meaning – USDJPY is dollars priced in yen. In an exchange rate API you’ll usually see the six-letter ticker with no slash: eurusd, usdjpy, gbpusd.
One more thing that surprises people coming from equities: forex trades around the clock, roughly 24 hours a day, 5 days a week. There’s no single closing bell, so a “daily close” is a convention rather than an event, and your data has weekend gaps instead of overnight ones. If your code assumes stock-market hours, FX will cheerfully break that assumption.
How Developers Actually Use a Forex API
Four patterns cover most of what we see.
1. Feeding Indicators and Analysis
Pull OHLC bars into pandas (or a spreadsheet, or a charting library) and compute whatever you like: moving averages, volatility, momentum. A live quote endpoint keeps the picture current. This is the gateway use – nearly everyone starts here, and it makes a solid afternoon project.
2. Backtesting a Strategy
Download history, replay your rules over it, and see how the strategy would have behaved. Two practical notes. First, a backtest run purely on mid prices ignores the spread you’d actually pay, and that flatters results – be conservative. Second, check how deep a provider’s FX history goes before you design a ten-year backtest, because history depth varies enormously between providers.
3. Alerts and Dashboards
Poll a quote endpoint on a schedule, compare against a threshold, and fire off a Slack message or email when a level breaks. A cron job and a dozen lines of code will do it. The same loop, pointed at a web page instead of a chat channel, gives you a live rates dashboard.
4. Currency Conversion and Reporting
Not everyone using currency data is trading it. If your app invoices customers in three currencies, or your portfolio report needs everything converted back to dollars, you need reliable exchange rates on demand – and an API is a far steadier source than a scraped web page that changes layout without warning.
What to Look For in a Forex API
A quick checklist we’d apply to anyone, ourselves included:
- Pair coverage. Every provider has the majors. If you need specific crosses or less-traded pairs, confirm they’re covered before you commit.
- Real-time vs delayed. Know exactly which you’re getting. Delayed data is good for reporting but not great for live alerts.
- History depth. This varies a lot between providers – some datasets run decades, others a few years. Match it to what you’re actually building.
- Licensing and redistribution. Analyzing data yourself and displaying it to your users are different rights. If you’re building a product, make sure the license actually covers it.
- Pricing model. Flat-rate plans are predictable; metered or per-symbol pricing can grow with your usage in ways that surprise you. Neither is wrong, but know which one you’re signing up for.
- Documentation. Ten minutes with the docs tells you a lot. If you can’t get from zero to a first successful request quickly, that friction won’t improve later.
- Reliability and stability. APIs change. The question is whether the provider warns you first. Look for versioning policies and advance notice on breaking changes.
Using Tiingo’s Forex API
Now the hands-on part, using ours. Quick context: we’ve been making high-end financial data accessible and affordable since 2014 (we’re the oldest accessible retail market-data API still around), with no outside investors – which is why our pricing question has always been “how much can we give and get away with it?” rather than the other way around.
Our forex API covers 140+ currency pairs with both real-time and historical data going back to 2020. It is clean, properly licensed, and built for exactly this kind of work: live quotes, alerts, currency conversion, dashboards, and backtests. Same standard we hold every dataset to – we error-check it, we document it, and we price it so you can actually use it.
Getting a first quote takes two steps. Grab a free API token at tiingo.com, then request the latest top-of-book quote (the best current bid and ask):
curl "https://api.tiingo.com/tiingo/fx/top?tickers=eurusd&token=YOUR_TOKEN"
Back comes the latest quote for the pair: bid, ask, and mid, with a timestamp. The tickers parameter accepts more than one pair, so a single call can cover your whole watchlist.
Historical prices live at the prices endpoint. In Python:
import requests
url = "https://api.tiingo.com/tiingo/fx/eurusd/prices"
resp = requests.get(url, params={"token": "YOUR_TOKEN"})
print(resp.json())
Swap eurusd for any pair we cover and you have the raw material for charts and backtests. The full set of options is in our forex API documentation.
On the checklist above, here’s how we stack up. Pricing is flat-rate with no per-symbol metering:
| Plan | Price | What you get |
|---|---|---|
| Starter | $0 | 500 unique symbols/month, 50 requests/hour, 1,000 requests/day, 1GB of bandwidth/month |
| Power | $30/month ($300/year) | Individual, non-commercial use |
| Commercial | $50/month ($499/year) | The same data, with a commercial-use license |
Yes, the free tier is genuinely usable – 500 unique symbols a month is enough to build and test something real.
Licensing is the quiet advantage: our data is licensed and redistribution-friendly, so showing rates to your users is something we can actually support rather than something you have to squint at the terms of service about. And through our Developer Program, we commit to at least one year’s notice before any breaking change – the alert script you write today should still be running next year.
One more thing, since flat-rate means flat-rate: a Tiingo account isn’t forex-only. The same API covers 80,000+ assets – US equities, ETFs, mutual funds, and Chinese A-shares – with end-of-day history back to 1962, real-time equities via IEX, crypto across 150+ exchanges, 70M+ news articles spanning 20+ years, and 20+ years of fundamentals. Full details are on our pricing page.
The Bottom Line
A forex API turns currency data from something you look up into something you build with. Learn what the endpoints return (quotes and bars), pick a provider whose coverage, history, licensing, and pricing match what you’re building, and the rest is ordinary code.
If you’d like to try ours, grab a free token at tiingo.com and pull your first EURUSD quote – the Starter plan is $0, so the only cost is a few minutes of curiosity. And if you build something neat with our FX data, tell us. We love hearing from our users.