← notes

Deriving a cross rate through a base you did not ask for

Dec 7, 2018

Post the Costa Rican colón to US dollar rate with 7-day, 30-day and 1-year comparisons, in Spanish.

Built on fixer.io’s free tier, which pins the base currency to EUR. So CRC/USD is never fetched, it is derived, as EUR to CRC divided by EUR to USD.

Triangulating through a base you did not want is extremely common on free FX tiers and has consequences worth knowing. Two rates, each already rounded by the provider, produce a quotient carrying the error of both. For a colón rate around 600 to the dollar that is usually irrelevant, and it is not nothing, and it is invisible in the output.

The bigger issue is that four historical dates mean four separate requests, each returning its own EUR base, with no guarantee they are internally consistent. A date where one currency has no quote produces a result that is quietly wrong rather than absent.

Weekends and holidays are the concrete version. FX rates are not published when markets are closed, so a fixed offset like “30 days ago” lands on a non-trading day roughly two times in seven. The provider hands back the last published rate, the comparison window is not actually 30 days, and nothing says so.

The fixer.io key is in the source and Twitter credentials are in the YAML.