Skip to content

fix(price): read bean-price's source specs, with ^ inversion and each source's ticker form - #2883

Merged
robcohen merged 8 commits into
mainfrom
fix/price-source-spec
Nov 6, 2026
Merged

robcohen merged 8 commits into
mainfrom
fix/price-source-spec

Conversation

@robcohen

@robcohen robcohen commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Two commits.

1. fix(price): treat a timeout past 100 years as no limit

This is a follow-up from round 2 of the #2876 review. [price] timeout = 9223372036854775807 (the largest TOML integer), or anything near u64::MAX seconds, panicked inside ureq with "overflow when adding duration to instant". #2876 introduced this, because before it the timeout was ignored. http_get now gives ureq no limit for a timeout over MAX_REQUEST_TIMEOUT (100 years), the same as for zero.

  • test_http_get_huge_timeout_means_no_limit makes requests against a local server with the cap itself and with i64::MAX seconds.
  • The test helper now tells a panic in http_get apart from a hang.
  • The timeout error is now one message, without ureq's redundant : timeout: global.

2. fix(price): read bean-price's source specs (#2866)

A price: spec written for bean-price failed in rledger price. EUR:ratesapi/USD-EUR got HTTP 404 for USD-EUR-EUR, and ^ was sent to the provider as part of the ticker. The behavior below follows bean-price 2.1.0's source code (price.py and each sources/*.py), read from the compat container.

Grammar and ^. The grammar is CURRENCY:module/[^]TICKER. rledger's parser already split it this way and kept the ^ on the ticker.

  • Scope. ^ is read as an inversion only in a commodity's price: metadata, the one place bean-price's grammar applies. PriceSourceRegistry::fetch_price_for_spec serves those mappings. fetch_price, used for [price.mapping], --mapping and --source, keeps every ticker verbatim, as on main, so Yahoo's ^GSPC works there. A price: spec such as USD:yahoo/^GSPC now means the inverse of GSPC, as in bean-price; the CHANGELOG and docs carry a migration line.

  • Inversion. For a price: spec, rledger strips the ^, fetches, and writes 1 / price labeled with the declared quote currency, as bean-price's fetch_price does. This works on any source, including custom command sources.

  • When an inverse is refused. The inverse of a price of B in Q is a price of Q in B, so it is written only when both hold:

    • the quote's currency is the commodity;
    • when the source reports the base of what it fetches for the ticker (PriceSource::pair_base), that base is the declared currency. Each source derives the base from the same code it builds the request with: bean_price_pair for ratesapi, ecb and coinmarketcap, spot_pair for coinbase, format_instrument and instrument_sides for oanda, and route for alphavantage. Yahoo, which sends its ticker as it is, uses its own pair conventions (EURCHF=X, JPY=X as USD-based, crypto BTC-USD).

    Otherwise the inverse is refused, with or without -b. A failed fetch that tried an inversion ends with one note naming the ^ as bean-price's inversion.

  • Digits. The inverse is exact integer division, rounded once, half to even, to 28 significant digits, as bean-price's ONE / price is under Python's default context. An exact quotient takes its shortest form (1 / 8 is 0.125).

    • The limit is rust_decimal's 28 decimal places: an inverse near 10^-k keeps k - 1 fewer significant digits. This is the documented "not fixable locally" case.
    • The tests pin values computed by bean-price's own Python.
  • No inverse. A zero quote, or one at or above 2 * 10^28 whose inverse rounds to zero, fails that attempt, and the fallback chain goes on.

Per-source tickers. A new PriceSource::bean_price_pair hook runs at the top of the canonical dispatch. It reads a ticker that names its own quote currency into the (ticker, currency) pair that is fetched, so every source keeps fetching a plain pair.

Source beanprice form now read Matches
ratesapi, ecb BASE-SYMBOL ^(\w+)-(\w+)$
coinmarketcap SYMBOL-BASE same pattern
alphavantage price:SYMBOL:BASE, fx:CCY:BASE ^(price|fx):([^:]+):(\w+)$, read into rledger's SYMBOL / CCY/BASE
quandl DB:DS[:COLUMN] [A-Z0-9]+:[A-Z0-9]+(:[^:; ]+)?$. Takes Adj. Close, else Close, or the named column with _ as a space. rledger's DB/DS keeps its old column heuristic
coincap an upper-case symbol (Python isupper) looked up in the asset list, first match by market cap. The built-in table stays as a fast path
tsp LInco was the one beanprice TSP_FUND_NAMES entry rledger missed
coinbase, oanda, yahoo, eastmoneyfund already read beanprice's forms no change to the fetch; coinbase, oanda and yahoo report their pair base for the inversion check

Inversion base (pair_base). Which sources report the base a ^ inverse must be declared in:

Source Base reported Read by
ratesapi, ecb, coinmarketcap EUR for EUR-GBP or a bare EUR bean_price_pair
coinbase BTC for BTC-USD or BTC spot_pair
oanda the part before the last _: EUR_CHF, NAS100_USD, a bare EUR format_instrument, instrument_sides
alphavantage USD for fx:USD:CHF/USD/CHF; IBM for price:IBM:USD/IBM; BTC for CRYPTO:BTC route
coincap the ticker, upper-case (every quote is in USD) the ticker
yahoo EURCHF=X is EUR, JPY=X is USD, crypto BTC-USD is BTC Yahoo's pair conventions
yahoo non-pair tickers (AAPL, BRK-B), quandl, tsp, eastmoneyfund, command sources none: only the quote is checked

bean-price's module name ecbrates is now registered as an alias of ecb.

All of rledger's own ticker forms keep working. The new forms are additions.

Decisions to check:

  • ecbrates alias. This adds a name to --list-sources. Without it, a bean-price ledger's ecbrates/... spec still fails as an unknown source.
  • A ticker whose currency differs from the declared one. For example GBP:ratesapi/USD-EUR. bean-price labels the EUR rate as GBP. rledger fetches EUR, and -b refuses the mismatch through the existing [Bug]: rledger price labels yahoo pence quotes GBP/GBp instead of the declared GBX #2731 label check instead of relabeling.
  • Dry-run display. rledger's -n keeps showing the ticker as written (ratesapi(^EUR-GBP)), where bean-price shows 1/EUR-GBP. The compat harness maps between the two.

Not covered: bean-price's iex module (rledger has no IEX source) and --swap-inverted.

How to test

  • Unit tests:
    • cargo test -p rustledger --all-features --lib price
    • Per-source cases are taken from beanprice's own *_test.py (quandl_test.py test_parse_ticker, the alphavantage price:/fx: cases, and TSP_FUND_NAMES).
    • Registry tests use a fake source that records the pair it was asked for, covering inversion, pair tickers, and a zero inverse falling through the chain.
  • The bean-price compat harness, cargo test -p rustledger --all-features --test bean_price_compat, gains source_specs. It is a fixture with every source's spec form and ^. bean-price -n and rledger price -n must plan identical (symbol, currency, source, ticker) attempts.
  • No test makes a network call.

Verified locally:

  • cargo fmt --check, cargo clippy --all-features --all-targets -- -D warnings and RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps pass.
  • cargo test -p rustledger --all-features --no-fail-fast passes.
  • The pre-push bean-price compat hook passes.

Closes #2866

Review round 1

Commit 509ecc7740b. This round narrows where ^ inverts, compared with commit 2 above.

  1. Regression, ^ scope. ^ now inverts only in price: metadata, the one place bean-price's grammar applies.
    • PriceSourceRegistry::fetch_price keeps every ticker verbatim again, as on main. A [price.mapping] ticker, --mapping SPX:^GSPC and --source send ^GSPC as written.
    • The new fetch_price_for_spec reads the spec grammar. price_cmd uses it for a mapping read from price: metadata.
    • tests/price_caret_scope.rs checks each path end to end against a config-defined command source that answers by $RLEDGER_TICKER. The config mapping, --mapping and --source each write the ^GSPC price, and metadata USD:stub/^USDCHF writes price CHF 1.25 USD.
    • docs/commands/price.md documents the scope.
  2. Mismatch check. An inverse is written only when it is a price of the pair it is labeled with:
  3. Rounding. invert_price computes 10^(s+k) / m in exact BigInt arithmetic and rounds once, half to even, on the exact remainder. An exact quotient is written in its shortest form.
    • I checked it against 20,000 random samples at or above 0.1 generated with the image's beancount Python. All 20,000 match. That sweep ran once and is not committed.
    • The reviewer's examples are pinned against Python: 1/0.00000198, 1/0.006550, 1/0.051, and 1/4.538 with its trailing zero. So are 1E+28 and 1E+2, written out.
    • Below 0.1 the rust_decimal limit stands. The doc now states it as k - 1 fewer digits near 10^-k.
  4. ecbrates. A "Stricter than Python" comment names the cause: getcontext().prec = max(5, ...) leaks into ONE / price. A test pins the 28-digit inverse on ecbrates (Python writes 0.0890115), and the CHANGELOG notes the deviation. The "as bean-price" claim is corrected.
  5. Nits.
    • An inverse that rounds to zero at 28 decimal places (a price at or above 2 * 10^28) is refused like a zero price.
    • A zero quote falling through the chain, where bean-price aborts with DivisionByZero, is documented in code, docs and a test.
    • The coincap lookup comment now says beanprice scans /assets/ (top 100) where rledger uses ?search=. A provider-returned ID must be lower-case letters, digits and - before it goes into the URL path, with a test.
    • ^^X and a bare ^ are refused before any fetch.

Re-verified:

  • cargo fmt --check, cargo clippy --all-features --all-targets -- -D warnings and RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps pass.
  • cargo test -p rustledger --all-features price, --test bean_price_compat and --test price_caret_scope pass.
  • The pre-push bean-price compat hook passes.

Review round 2

Commit 74886778c41.

  1. Base check on every pair ticker. The check used to run only when bean_price_pair rewrote the pair, so it missed oanda, coinbase and yahoo. A new PriceSource::pair_base(ticker) hook names the base of a ticker that names both sides of its pair. fetch_inverse checks it before any fetch.

    Source Pair tickers Base
    ratesapi, ecb EUR-GBP EUR
    coinmarketcap BTC-CHF BTC
    coinbase BTC-USD BTC
    oanda EUR_CHF EUR
    yahoo EURCHF=X, and BTC-USD with a three-letter quote EUR, BTC
    alphavantage fx:EUR:CHF, price:IBM:USD, EUR/CHF EUR, IBM, EUR
    • A share class such as yahoo's BRK-B names no pair.
    • Tests cover both reported scenarios (USD:oanda/^EUR_CHF and EUR:coinbase/^BTC-USD, refused) and the valid case for each (EUR:oanda/^EUR_CHF on CHF writes 1.25 EUR, BTC:coinbase/^BTC-USD on USD writes 0.00002 BTC), plus yahoo EURCHF=X.
    • A per-source test_pair_base covers all seven sources.
    • The rustdoc, docs/commands/price.md and section 2 above state the rule exactly.
  2. price: "USD:yahoo/^GSPC" changes meaning. It now reads as bean-price reads it, as an inversion, and I kept it that way.

    • The CHANGELOG and docs have a migration line: move index tickers to [price.mapping] or --mapping.
    • Every failed inversion, whether not found or refused, now ends with: "note: in a price: spec, ^X is bean-price's inversion (fetch X, write its inverse); a ticker that itself starts with ^, such as Yahoo's ^GSPC, is kept literal in [price.mapping] or --mapping SYMBOL:^TICKER". It is asserted in the unit tests and in price_caret_scope.
  3. Nits.

    • N1: ^^X moved out of the CHANGELOG's "Stricter than Python" list.
    • N2: "at or above 2 * 10^28" in the rustdoc, docs and this body.
    • N3: section 2 rewritten for the price:-only scope and the k - 1 digits limit.
    • N4: docs, CHANGELOG and rustdoc say refusals apply with or without -b.

Re-verified:

  • cargo fmt --check, cargo clippy --all-features --all-targets -- -D warnings and RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps pass.
  • cargo test -p rustledger --all-features price passes (lib 225), as do --test bean_price_compat (8/8) and --test price_caret_scope (5/5).
  • The pre-push hooks pass.

Review round 3

Commits f845cbbe6f3 (fixes) and 44f92923f93 (merge of origin/main, a CHANGELOG-only conflict with #2874, both entries kept).

A correction to round 2: the section 2 rewrite claimed there did not actually land. It is rewritten above in this round.

  1. oanda. pair_base now comes from the same format_instrument the fetch builds the instrument with. The base is read by a new instrument_sides, which also labels the response's quote, so the two cannot disagree. CFDs are checked: NAS100_USD is based in NAS100, so USD price: "EUR:oanda/^NAS100_USD" is refused. test_pair_base covers SPX500_USD, NAS100_USD, DE30_EUR and JP225_USD.
  2. yahoo. XXX=X (JPY=X, EUR=X) is USD-based, so JPY price: "EUR:yahoo/^JPY=X" is refused and USD:yahoo/^JPY=X writes the JPY price in USD. Tickers are uppercased before matching (eurchf=x, btc-usd). The test that pinned None is fixed. Yahoo sends its ticker as it is, so these remain Yahoo's own conventions; there is no request parsing to share.
  3. Fail-safe, by construction.
    • Every source that builds a pair from its ticker now derives pair_base from that same code:
      • ratesapi, ecb and coinmarketcap from bean_price_pair;
      • coinbase from a new spot_pair its URL uses;
      • oanda as above;
      • alphavantage from a new route that its fetch dispatches on.
    • Bare tickers quoted in the requested currency report their base too. A nonsense inversion of one (EUR:ratesapi/^GBP) is refused.
    • The sources left at None parse no pair from the ticker: coincap (always USD), quandl, tsp, eastmoneyfund and command sources. So are yahoo tickers outside its pair conventions (AAPL, share class BRK-B). For those, the quote check still applies.
  4. Nits.
    • The inversion note is attached once per failed fetch in fetch_attempts, as a trailing (note: ...), distinct from the ; attempt joiner. The ^^X refusal carries it too.
    • Mismatch messages print the base and quote uppercased.
    • Registry tests with the real AlphaVantageSource's ticker reading cover price:IBM:USD both ways (IBM: writes 0.004 IBM, EUR: is refused). They also cover the note appearing exactly once.
    • Docs and CHANGELOG state the per-source base rule.

Re-verified after the merge:

  • cargo fmt --check, cargo clippy --all-features --all-targets -- -D warnings and RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps pass.
  • cargo test -p rustledger --all-features price passes (lib 227), as do --test bean_price_compat (8/8) and --test price_caret_scope (5/5).

Review round 4

Commit 77a2b53eb26, then 590d0cff51f, which merges origin/main (#2884, a test baseline only, no conflict).

  • coincap quotes every asset in USD, so its pair_base is the ticker, upper-case. USD price: "EUR:coincap/^BTC" is now refused, with a test_pair_base case and a registry-level refusal test.
    • A coincap inversion can never be written: BTC:coincap/^BTC asks for BTC in BTC, which is the dispatch's identity pair.
  • The pair_base trait doc now says what None means: the source cannot read a base, so only the quote is checked. The coinmarketcap doc example now uses BTC-CHF/BTC.
  • Section 2 above gains the "Inversion base" table.
  • docs/commands/price.md lists coincap. It also says an inverted equity ticker is refused when its exchange-qualified base (alphavantage VOD.LON) differs from the declared currency.
  • Re-verified:
    • fmt, clippy -D warnings and rustdoc -Dwarnings pass.
    • cargo test -p rustledger --all-features price passes (lib 229).
    • bean_price_compat (8/8) and price_caret_scope (5/5) pass.

🤖 Generated with Claude Code

robcohen and others added 2 commits November 6, 2026 13:16
`[price] timeout = 9223372036854775807` (the largest TOML integer), or
anything near `u64::MAX` seconds, panicked inside ureq with "overflow
when adding duration to instant": ureq adds the timeout to an
`Instant`. #2876 introduced this, since the timeout used to be ignored.
`http_get` now gives ureq no limit for a timeout over
`MAX_REQUEST_TIMEOUT` (100 years), as it does for zero.

The timeout error is now one message: ureq's trailing
`: timeout: global` only repeated it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ch source's ticker form

A `price:` spec written for bean-price failed in `rledger price`:
`EUR:ratesapi/USD-EUR` asked Frankfurter for `USD-EUR` in EUR (HTTP
404), and a `^` was sent to the provider as part of the ticker.

Matching bean-price 2.1.0's `price.py` and source modules:

- `^TICKER` inverts on every source. The registry strips the `^`,
  fetches, and writes `1 / price` labeled with the declared quote
  currency, as bean-price does. The digits follow bean-price's
  `ONE / price` (28 significant digits, half-even; an exact quotient in
  its shortest form), within `rust_decimal`'s 28 decimal places.
- A ticker that names its own quote currency is read into the fetched
  pair by a new `PriceSource::bean_price_pair` hook, before the
  dispatch: `ratesapi` and `ecb` read `BASE-SYMBOL`, `coinmarketcap`
  reads `SYMBOL-BASE`, and `alphavantage` reads `price:SYMBOL:BASE` and
  `fx:CCY:BASE`.
- `quandl` reads `DB:DS[:COLUMN]` with beanprice's column choice
  (`Adj. Close`, else `Close`, or the named column with `_` as a space).
- `coincap` looks up an upper-case symbol its table lacks in the asset
  list, taking the first match by market cap, as beanprice does.
- `tsp` accepts beanprice's `LInco`.
- `ecbrates`, beanprice's name for the ECB source, resolves to `ecb`.

rledger's own ticker forms keep working. The bean-price compat harness
gains a fixture covering every source's spec form and `^`, and maps
bean-price's `1/TICKER` dry-run display to `^TICKER`.

Closes #2866

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen requested a review from a team as a code owner November 6, 2026 19:40
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Shape rustledger beancount Speedup RSS (rledger / beancount)
simple 39.9ms ± 1.7ms 578.9ms ± 6.6ms 14.5x 42.9 MB / 50.8 MB
investment 62.1ms ± 0.8ms 2174.2ms ± 22.5ms 35.0x 58.9 MB / 59.0 MB
fifo 60.6ms ± 1.0ms 11883.2ms ± 197.9ms 196.1x 54.8 MB / 58.7 MB

vs base, measured in this run

Shape base this PR Change RSS base → PR
simple 40.7ms ± 2.9ms 39.9ms ± 1.7ms -2.0% ✅ within noise 42.8 MB → 42.9 MB (+0.3%)
investment 62.8ms ± 1.8ms 62.1ms ± 0.8ms -1.0% ✅ within noise 59.0 MB → 58.9 MB (-0.1%)
fifo 60.4ms ± 1.2ms 60.6ms ± 1.0ms +0.4% ✅ within noise 54.9 MB → 54.8 MB (-0.1%)

A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: simple 1.5ms, investment 0.9ms, fifo 0.7ms), and is at least 5%.
10,000 transactions per shape · 20 runs, 3 warmup · hyperfine

What do these numbers mean?
  • simple — Two-posting transfers, one currency. The historical workload — keep as the floor, not as the benchmark.
  • investment — Cost specs, per-unit prices and lot reductions. Exercises booking and inventory, which simple leaves at 0.3%.
  • fifo — Bare {} reductions against a FIFO account — how FIFO sells are normally written. The other four shapes reach the ordered-selection path twice in 2k transactions between them, so it was effectively unprofiled until it turned out to be quadratic (plan_ordered scans every lot per reduction: FIFO ledgers are quadratic (8.8s at 20k transactions) #2083).
  • vs base: the PR and the base-branch commit it is built on, built and measured in the same job
  • RSS: peak resident set size, a single sample — reported without a verdict because there is no spread to test it against
  • A shape with no beancount column is one bean-check reports errors on; it is timed for rledger only

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100% (raw 93%, 179 masked)
Full AST Match 100%
Total Files 826
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
    The headline is the EFFECTIVE rate, after pairs where beanquery
    itself is wrong are masked. raw is the same run with nothing
    masked. A widening gap means the registry grew, not that rledger
    changed.
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

robcohen and others added 6 commits November 6, 2026 14:32
Review round 1 of #2883:

- `^` inverts only in `price:` metadata, the one place bean-price's
  grammar applies. `PriceSourceRegistry::fetch_price` keeps every
  ticker verbatim again, so a `[price.mapping]` ticker, `--mapping` and
  `--source` send Yahoo's `^GSPC` as written, as on main; the new
  `fetch_price_for_spec` reads the spec grammar and is used for
  mappings read from `price:` metadata.
- An inverse must be a price of the pair it is labeled with: the quote
  must be in the commodity and, for a ticker the source reads as a
  pair, the pair must be based in the declared currency. Otherwise it is
  refused, as the #2731 label check refuses the same mismatch without
  `^`.
- The inverse is computed in exact integer arithmetic and rounded once,
  half to even, to 28 significant digits: it matched Python's
  `ONE / D(x)` on 20,000 random samples at or above 0.1. Below 0.1 the
  documented `rust_decimal` limit stands (k - 1 fewer digits near
  10^-k).
- Stricter than Python: bean-price's `ecbrates` leaks its leg
  precision into `ONE / price` (about six digits); rledger keeps 28.
- `^^X` and a bare `^` are refused; an inverse that rounds to zero is
  refused like a zero price; a zero quote falls through the chain,
  where bean-price aborts.
- `coincap`: the lookup comment no longer claims beanprice's exact
  scan, and a provider-returned asset ID is validated before it goes
  into the URL path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 2 of #2883:

- The base check of a `^` inversion ran only when `bean_price_pair`
  rewrote the pair, so oanda (`EUR_CHF`), coinbase (`BTC-USD`) and
  yahoo (`EURCHF=X`, `BTC-USD`), which read their own pair, were never
  checked: `USD:oanda/^EUR_CHF` on CHF wrote EUR per CHF labeled USD.
  A new `PriceSource::pair_base` hook names the base of a ticker that
  names its own pair; ratesapi, ecb, coinmarketcap, alphavantage,
  coinbase, oanda and yahoo implement it, and `fetch_inverse` checks it
  before any fetch. Yahoo share classes (`BRK-B`) name no pair.
- A failed inversion now says the `^` was read as bean-price's
  inversion, and that a literal `^` ticker belongs in
  `[price.mapping]` or `--mapping`. The CHANGELOG and docs carry the
  migration line for `price: "USD:yahoo/^GSPC"`.
- Docs: the inverse rule stated exactly, refusals apply without `-b`
  too, `^^X` is no longer listed as stricter than Python, and "at or
  above 2 * 10^28".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 3 of #2883:

- `pair_base` is now derived from the code each source builds its
  request with, not a separate pattern: ratesapi, ecb and coinmarketcap
  from `bean_price_pair`; coinbase from the new `spot_pair` its URL is
  built from; oanda from `format_instrument` and the new
  `instrument_sides` that also labels the response, so CFDs such as
  `NAS100_USD` are checked; alphavantage from the new `route` its fetch
  dispatches on. Bare tickers quoted in the requested currency report
  their base too, so a nonsense inversion of one is refused.
- yahoo, which sends its ticker as it is, keeps its pair conventions,
  now case-insensitive, and reads `XXX=X` (`JPY=X`) as USD-based.
- The inversion note is attached once per failed fetch, after the
  attempts, as ` (note: ...)`, and the `^^X` refusal carries it too.
  Mismatch messages print the base and quote upper-case.
- Tests: oanda CFDs, Yahoo `JPY=X` both ways, lower-case tickers,
  alphavantage `price:IBM:USD` both ways, and the note once per fetch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 4 of #2883: coincap quotes every asset in USD, but had no
`pair_base`, so `USD price: "EUR:coincap/^BTC"` wrote BTC per USD
labeled EUR. Its `pair_base` is now the ticker, upper-case, and the
inversion is refused unless declared in that asset.

The `pair_base` trait doc now says what the default `None` means (the
source cannot read a base), the coinmarketcap doc example uses
`BTC-CHF`, and docs/commands/price.md lists coincap and says an
inverted equity ticker is refused when its exchange-qualified base
(`VOD.LON`) differs from the declared currency.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robcohen
robcohen merged commit bc57b6e into main Nov 6, 2026
49 of 50 checks passed
@robcohen
robcohen deleted the fix/price-source-spec branch November 6, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compat(price): bean-price ticker specs (BASE-SYMBOL, ^ inversion) are not understood

1 participant