Repository navigation
feat: historical support for the five remaining sources (#1802) - #1804
Conversation
Ports the remaining #1802 table rows onto the window primitive: - ecb: fetch_series over the SDMX data API with startPeriod/endPeriod (the full EU-reference series back to 1999-01-04, not just the 90-day XML feed); cross-rates over a window are a PER-DATE join of the two legs, so the latest-path leg-mismatch bail has no historical counterpart - unjoined days (frozen HRK/RUB series) simply yield no point. parse_series is fixture-tested; observations with missing dates or null rates are skipped, never today-labeled. - alphavantage: TIME_SERIES_DAILY for stock tickers (compact/full outputsize chosen by window age); forex and crypto ticker forms refuse hermetically before any network I/O with a pointer at ratesapi/coinbase. parse_daily_series is fixture-tested including the rate-limit Note shape. - quandl: start_date/end_date dataset slice; fetch_rows generalizes the row parser to all rows (skip-not-fallback on malformed rows) and the latest path picks the greatest-dated row. - tsp: the single-payload history endpoint is sliced to the window; per-fund missing days are skipped (funds launch at different times). - eastmoneyfund: the f10/lsjz NAV-history endpoint with startDate/endDate and the required Referer header; parse_history is fixture-tested including empty-DWJZ days and the ErrCode bail. Latest-only is now just coincap, coinmarketcap, and oanda (paid-tier or product-gap questions per the issue). Capability wiring tests and the docs --date row updated accordingly.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
📊 Benchmark Results
vs main branch (2026-07-18)
What do these numbers mean?
|
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
There was a problem hiding this comment.
Pull request overview
Ports the remaining historical-capable price sources from issue #1802 onto the fetch_window primitive introduced in #1803, so rledger price --date ... can return correctly dated on-or-before quotes (rather than refusing or mislabeling latest quotes) for these providers.
Changes:
- Implement historical coverage declarations and
fetch_windowforecb,alphavantage,quandl,tsp, andeastmoneyfund. - Add hermetic (no-network) parser fixtures for ECB/AlphaVantage/EastMoneyFund (and URL-form tests for ECB/Quandl/EastMoneyFund).
- Update docs and capability wiring tests to reflect the new historical-capable vs latest-only source set.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/commands/price.md | Updates CLI docs to list which sources now support historical --date and which remain latest-only. |
| crates/rustledger/src/cmd/price/sources/mod.rs | Updates capability wiring tests for latest-only vs historical-capable built-ins and asserts historical coverage declarations. |
| crates/rustledger/src/cmd/price/sources/ecb.rs | Adds SDMX window fetching (startPeriod/endPeriod), series parsing, and per-date cross-rate joins for historical quotes. |
| crates/rustledger/src/cmd/price/sources/alphavantage.rs | Adds TIME_SERIES_DAILY window fetching + parsing for stock tickers, with hermetic refusal for forex/crypto historical requests. |
| crates/rustledger/src/cmd/price/sources/quandl.rs | Adds windowed dataset slicing via start_date/end_date and parses all returned rows into dated points. |
| crates/rustledger/src/cmd/price/sources/tsp.rs | Refactors latest fetching via a shared history fetch and adds window slicing over the single-payload history endpoint. |
| crates/rustledger/src/cmd/price/sources/eastmoneyfund.rs | Adds windowed NAV history fetch (lsjz) with required Referer header plus hermetic parsing of LSJZList rows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- dispatch: reject_url_metacharacters guards ticker and currency once before any routing - values flow into provider URLs unescaped in every source, and a crafted ticker like 000001^endDate=2019-01-01 from shared-ledger metadata could rewrite the window parameters - ecb: an SDMX 404 (empty selection) is the contract empty vec, not a transport error (a frozen HRK window read as a network failure); parse_series takes an undated-observation fallback so the LATEST path today-labels like main while historical rows still skip - alphavantage: drop the still-open US/Eastern session bar from window results (a UTC+8 local-yesterday can be the live US session, whose partial bar must not become a settled close); dated forex refusal is pinned through the dispatch, not just fetch_window; canonical feed_date for the series keys - quandl: fetch_rows takes the same latest-vs-historical date-fallback split; the latest empty message names the actual causes - eastmoneyfund: DWJZ parses via the canonical price_decimal_from_json (string AND number shapes); ErrCode tolerates string typing; windows wider than one 49-entry page refuse explicitly instead of silently truncating - tsp/quandl/eastmoneyfund/ecb: inline date slice-and-parse copies replaced by the canonical feed_date helper
|
Round-1 deep review (25 agents, adversarial verification): 10 findings (9 confirmed, 1 plausible hardened), all addressed in e82f9f7.
628 tests green, clippy/doc clean. |
What
Ports the five remaining #1802 table rows onto the window primitive from #1803. After this, only coincap, coinmarketcap, and oanda remain latest-only (paid-tier / product-gap questions per the issue).
startPeriod/endPeriod— the full EU-reference series, not just the 90-day XML feed the issue anticipatedSince(1999-01-04)TIME_SERIES_DAILY(stock tickers; compact/full outputsize by window age). Forex/crypto ticker forms refuse hermetically before any network I/O, pointing at ratesapi/coinbaseFullstart_date/end_datedataset slice; the row parser generalizes to all rowsFullFullf10/lsjzNAV history withstartDate/endDate(and the Referer header the API requires)FullDesign notes, applying the #1801/#1803 review lessons up front:
parse_series,parse_daily_series,parse_history, plus URL-form pins for all five) — the parse/fetch split from feat: window-primitive price source architecture (#1802) #1803 makes this nearly free.How to test
cargo test -p rustledger price(626 tests, all hermetic). Live smoke:rledger price EUR -c USD -s ecb --date 2024-06-14,rledger price AAPL -s alphavantage --date 2024-06-14(needs API key),rledger price 000001 -s eastmoneyfund --date 2024-06-14.Part of #1802. Follow-ups still tracked there: typed
SourceError, window write-through into the price cache, mock-HTTP fixture harness.🤖 Generated with Claude Code
https://claude.ai/code/session_013gJH7uBBF9Xw9et9QFRcsU