Repository navigation
fix(price): point ratesapi at Frankfurter, as beanprice does - #2864
Merged
Merged
Conversation
api.exchangerate.host now answers every request without an API key with `missing_access_key`, so `rledger price --source ratesapi` failed for every pair while the source still said it needs no key. It now asks Frankfurter (api.frankfurter.dev/v1), the open-source keyless API serving the same ECB reference rates, which is what beanprice's ratesapi source uses. Response parsing is split out and covered by network-free tests (latest, historical, a weekend request, error bodies, a non-JSON body); an HTTP error names the pair and says it may be unsupported. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
… ratesapi
ureq 3 turns a 4xx/5xx into a bare StatusCode error, so Frankfurter's
`{"message": ...}` (404 not found, 422 bad currency pair / invalid date)
never reached the user. The request now reads the body on any status and
one `handle_response` step reports `HTTP 404 for USD-XXX: not found`;
tests feed it canned 404/422/502 bodies. The configured timeout is now
applied per request (`config().timeout_global`); the note in sources/mod.rs
that ureq 3 has no per-request timeout is corrected (the other sources do
not apply theirs yet). Docs and CHANGELOG no longer claim full bean-price
parity: rledger's ratesapi ticker is the base currency, not bean-price's
`BASE-SYMBOL` form, and `^` inversion is not supported. Also fixes a stale
exchangerate.host comment.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fallback hint said the pair may be unsupported for any status; a 5xx or gateway page now says the service may be unavailable. Rewraps the struct doc and drops the 422 example, which a same-currency pair never reaches (the identity arm answers it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
enabled auto-merge (squash)
November 5, 2026 08:30
…kfurter # Conflicts: # CHANGELOG.md
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
rledger price --source ratesapinow fetches from Frankfurter (https://api.frankfurter.dev/v1), the open-source keyless API that serves the ECB reference rates, and the provider bean-price'sratesapisource uses. This is not full bean-price parity: rledger'sratesapiticker is the base currency (EURwith-c USD), not bean-price'sratesapi/EUR-USDform, and^inversion is not supported (to be tracked separately). The source name, ticker format, historical coverage (from 1999-01-04), feed-date handling and weekend clamp are unchanged.Why
The source called
api.exchangerate.host, which now answers every request without an API key with HTTP 401missing_access_key. Every pair failed, while the source still said it needs no key.Also
fetch_rateintoparse_response, so it is tested without the network.StatusCodeerror), so a user seesHTTP 404 for USD-XXX: not foundorHTTP 422 for EUR-EUR: bad currency pair. A body with no message falls back to "the currency pair may be unsupported".ratesapirequests (RequestBuilder::config().timeout_global). The note insources/mod.rssaying ureq 3 has no per-request timeout is corrected. The other sources still ignore their timeout: there is no shared request helper, so that is a per-source change for a follow-up.message, or a keyed service'serror.info.docs/commands/price.md) and the CHANGELOG are updated.No other provider and no fallback chain are added.
How to test
cargo test -p rustledger --lib ratesapi: 10 tests, including canned Frankfurter bodies for latest, historical and a weekend request, error bodies (not found,missing_access_key), a non-JSON body, a missing pair, and HTTP 404/422/502 responses through the samehandle_responsestep the live request uses.Live, checked against the ECB (
data-api.ecb.europa.eu, EXR D.USD.EUR):rledger price -s ratesapi EURrledger price -s ratesapi -d 2026-10-30 EURrledger price -s ratesapi -d 2026-11-01 EUR(a Sunday)rledger price -s ratesapi XXXcargo test -p rustledger --all-features(47 result lines, 0 failed), clippy-D warnings, rustdoc-Dwarningsandcargo fmt --checkpass locally.🤖 Generated with Claude Code