Files
Andrey Bocharnikov d74755f5fa feat: let the proxy choose the source behind convert_currency
The old rule made a currency named in both vs_currencies and convert_currency
a 400, on the grounds that one key cannot be both Passthrough and Estimate.
The cost landed on the client: to phrase a legal request status-go had to
carry a hardcoded proxyPassthroughCurrencies = {usd, eur, btc, eth} mirroring
coingecko_prices.currencies from our config.yaml. Editing our config would
have broken the client silently, and the client was deciding something it had
no information about.

convert_currency=X now means "give me values in X". The proxy picks the
source: when it already holds the provider's own values for X it serves those,
because provider data beats anything derived from a ratio; otherwise it
converts as before. The duplicate is deduped and served once. An unsupported
currency is still a 400, and convert_currency alone is now a complete request
since it names a currency just as vs_currencies does.

The URL no longer tells you which of the two you got, and that signal is worth
keeping - X-Estimated-Currencies carries it back instead, listing the computed
currencies and absent when everything served was provider data. It survives
nginx: cached with the body on a HIT and returned on a 304, verified against
the local stack.

Checking the "only simple/price is affected" assumption in code turned up a
latent bug rather than confirming it. The leaderboard caches
coingecko_leaderboard.currency, not usd, and converted by reading the cache
under the base currency - configure it to anything but usd and every converted
response was empty. It now reads its own currency and crosses the Ratios,
which are all expressed against the base. coins/markets has the analogous
shape via market_params_normalize.vs_currency. Both now serve their cached
currency directly instead of computing a copy of data they already hold.

ADR 0001 gets an amendment recording what superseded the original rule and
why, rather than a quiet edit; the invariant it protects - Passthrough is
never mutated - is untouched.
2026-08-26 16:50:18 +04:00
..
2025-04-07 19:17:33 +04:00
2025-04-07 19:17:33 +04:00
2025-04-07 19:17:33 +04:00