Forex price chart with candlesticks illustrating a real-time FX price API

Blog ·

Forex Price API: A Practical Guide to Real-Time and Historical FX Data

A forex price API gives your application programmatic access to currency exchange rates: the latest bid and ask for pairs such as EUR/USD, GBP/USD and USD/JPY, plus historical forex data as candles (OHLC) or individual ticks. Whether you are building a trading dashboard, a fintech app, a risk report or a trading bot, the API is the bridge between the interbank market and your code.

What data does a forex API provide?

  • Latest quotes: bid, ask and the time of the last update, with a status that tells you whether the price is live or the market is closed.
  • Historical OHLC candles: open, high, low, close and tick volume per period, from one minute (M1) up to monthly (MN1).
  • Tick data: every recorded price change, for precise backtests and spread analysis.
  • Instrument metadata: digits, contract details and trading hours for each symbol.

Getting a live EUR/USD quote

With MarketAPI a single request returns the freshest price for one or many symbols:

curl -H "Authorization: Bearer $API_KEY" "https://api.marketapi.app/v1/prices/latest?symbols=EURUSD,GBPUSD&require_live=true"

require_live=true returns only prices that are currently live, so your app never mistakes a weekend closing price for a fresh quote.

Historical forex data in any timeframe

curl -H "Authorization: Bearer $API_KEY" "https://api.marketapi.app/v1/bars?symbol=EURUSD&timeframe=H1&from=2026-09-01T00:00:00Z&to=2026-09-08T00:00:00Z"

All 21 standard timeframes are available (M1, M2, M3, M4, M5, M6, M10, M12, M15, M20, M30, H1, H2, H3, H4, H6, H8, H12, D1, W1, MN1). Daily candles follow the broker's trading day, which closes at 17:00 New York time, so your candles match what traders see in their platforms. See our guide to historical OHLC data for details.

Polling or streaming?

For dashboards that refresh every few seconds, polling the latest-price endpoint is simple and cheap. For trading bots and live charts, a WebSocket stream pushes each new price the moment it changes, without repeated requests.

How to keep forex API costs predictable

  • Request only the symbols you display; batch them into one call.
  • Cache historical candles: history does not change, so download it once.
  • Use a monthly plan if your volume is steady, or pay as you go if it varies.

FAQ

Is there a free forex API?

Yes: our free tier returns delayed prices for selected symbols without an API key, ideal for prototypes.

Which currency pairs are covered?

All majors, minors and many exotic pairs. The complete list is in the ticker CSV.

Common mistakes with forex data

  • Using the mid price for everything: spreads widen at rollover (around 21:00-22:00 UTC) and around news; keep bid and ask when costs matter.
  • Ignoring the weekend: Friday's close is not a live price on Saturday. Check the status before you calculate.
  • Mixing time zones: compare candles in UTC and know which trading-day convention your source uses.
  • Requesting symbol by symbol: batch symbols into one request to save time and credits.

Typical projects

Currency converters and payment apps use live rates; treasury and risk teams use daily history for valuations; quantitative developers backtest on minute candles and validate on ticks; trading educators chart pairs for their students. All of them use the same three endpoints: latest prices, bars and ticks.

How accurate are the prices?

They are the broker's live bid and ask, timestamped at the source. They are indicative market data, ideal for analysis and display; orders are always filled at your own broker's prices.

Ready to try it? Create a free account and make your first request in a minute.

Try the market price API

1000 free credits after sign-up.

Get a free API key

More articles