DEV Community

Jonas Hämmerle
Jonas Hämmerle

Posted on

ECB reference rates vs live FX feeds: what 'updated once a day' actually costs you

Most currency-conversion needs in a typical web app — pricing pages, invoicing, displaying a rough converted total — don't need a tick-by-tick FX feed, but it's worth being explicit about what you're trading away when you use ECB reference rates (published once per business day) instead.

What ECB rates are good for: pricing display, invoicing, order totals shown to a customer, anything where "the rate as of this morning" is an acceptable, disclosed approximation. They're free, stable, and don't require an account.

What they're not good for: FX execution, arbitrage, anything where being a few hours stale has real financial consequences. If you're actually trading currency, not just displaying a converted number, you need a feed that updates far more often than once a day — and probably isn't free.

The practical pattern that works for the first category:

async function getRate(base, target) {
  const res = await fetch(`https://currency-api.p.rapidapi.com/v1/convert?from=${base}&to=${target}`, {
    headers: { "X-RapidAPI-Key": key, "X-RapidAPI-Host": "currency-api.p.rapidapi.com" },
  });
  return res.json(); // { rate, result, date } — "date" tells you exactly how fresh this is
}
Enter fullscreen mode Exit fullscreen mode

The date field matters more than people give it credit for — surfacing "rate as of {date}" next to a converted price, rather than presenting it as live, sets the right expectation and avoids a support ticket when someone notices the number doesn't match what their bank showed them an hour later.

Currency API is built on exactly this tradeoff: ECB reference rates via Frankfurter, free and keyless, explicit about being once-a-day data rather than pretending to be a live feed.

Top comments (1)

Collapse
 
sam_tech_e3c30d03221da839 profile image
Sam Tech

Hello, We are currently in need of a pro full stark developer
If you want to know more, kindly drop a comment.