Skip to content

feat(fetcher): add stock_watchlist (Yahoo Finance, 9 shapes) - #211

Merged
unhappychoice merged 1 commit into
mainfrom
feat/stock-watchlist
May 10, 2026
Merged

unhappychoice merged 1 commit into
mainfrom
feat/stock-watchlist

Conversation

@unhappychoice

Copy link
Copy Markdown
Owner

Summary

  • Yahoo Finance v8 chart snapshot for a configurable list of tickers — mirrors crypto_watchlist (feat(fetcher): add crypto_watchlist (CoinGecko, 9 shapes) #210) one-for-one on shape coverage and Safety class.
  • Per-symbol fetches fan out via tokio::task::JoinSet and re-sort by input order; an individual 404 silently skips the row so a typo in one ticker doesn't sink the rest.
  • Host-fixed query1.finance.yahoo.com + path-segment percent-encoding for ^ / = (^GSPC, EURUSD=X); symbol allowlist locks the URL down to [A-Z0-9.^\-=].

Ticks the [ ] stock_watchlist checkbox under Finance / market in #68 (catalog index #41).

Kind Safety Shapes
cached Safe entries, text, text_block, markdown_text_block, linked_text_block, number_series, point_series, bars, badge

Options

Option Type Required Default Description
symbols list of strings (Yahoo Finance ticker symbols) no ["AAPL", "MSFT"] Yahoo Finance ticker symbols, including suffixes for non-US listings (e.g. ["AAPL", "7203.T", "^GSPC"]). Capped at 20 entries.

No vs_currency option — Yahoo returns each ticker priced in its native listing currency (AAPL / USD, 7203.T / JPY), so the row formatter picks the glyph per stock and falls through to ISO-suffix for currencies without a known glyph (CAD, AUD, …).

Compatible renderers

Shape Renderers
entries grid_table, animated_*
text text_plain, text_ascii, animated_typewriter, animated_figlet_morph, animated_*
text_block list_plain, animated_*
markdown_text_block text_markdown
linked_text_block list_links
number_series chart_sparkline, chart_histogram, animated_*
point_series chart_line, chart_scatter, animated_*
bars chart_bar, chart_pie, list_ranking, animated_*
badge status_badge, animated_*

Notes

  • Direction-neutral status mapping — large absolute moves flip Ok → Warn so the Badge / Entries status row stands out, but the sign / ▲▼ arrow lives in the label. A watchlist isn't sentiment-bearing; the user might be long or short any of the rows.
  • Sparkline baseline trick — NumberSeries carries cents above the period min, not raw cents. chart_sparkline normalises against the series max with an implicit zero floor, so a high-magnitude ticker (BRK-A around $600k) otherwise collapses into a flat band glued to the top of the slot. Same approach as crypto_watchlist.
  • Per-symbol 404 vs all-failed — typo in one ticker silently skips that row; only when every symbol fails do we surface the last error.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test (2027 passed; 26 new unit tests for stock_watchlist)
  • cargo run --bin splashboard -- catalog fetcher stock_watchlist shows the option schema and full set of compatible renderers
  • Live smoke test (cargo test -- --ignored stock_watchlist::tests::live) prints AAPL/MSFT quotes from the real Yahoo endpoint
  • Manual smoke run via cargo run --bin splashboard against a local .splashboard/dashboard.toml exercising entries / badge / number_series / bars / point_series / markdown_text_block (mixed USD + JPY + index, including ^GSPC to verify URL encoding)

🤖 Generated with Claude Code

Yahoo Finance v8 chart snapshot for a configurable list of tickers, mirroring the
shape profile of crypto_watchlist (#210). Host-fixed query1.finance.yahoo.com so
Safety::Safe despite the network call; symbol allowlist (alphanumeric plus
. ^ - =) plus per-segment percent-encoding closes the obvious injection routes.
Per-symbol fetches fan out via JoinSet and re-sort by input order; an individual
404 silently skips the row so a typo in one ticker doesn't sink the watchlist.

Refs #41 / #68.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@unhappychoice has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minute and 41 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 473b33f0-417e-4a21-845f-71ae32f818c6

📥 Commits

Reviewing files that changed from the base of the PR and between d6132dd and 69e2138.

📒 Files selected for processing (2)
  • src/fetcher/mod.rs
  • src/fetcher/stock_watchlist.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/stock-watchlist

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.40462% with 101 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.10%. Comparing base (d6132dd) to head (69e2138).

Files with missing lines Patch % Lines
src/fetcher/stock_watchlist.rs 85.38% 101 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #211      +/-   ##
==========================================
- Coverage   96.26%   96.10%   -0.17%     
==========================================
  Files         150      151       +1     
  Lines       44086    44778     +692     
==========================================
+ Hits        42441    43032     +591     
- Misses       1645     1746     +101     
Files with missing lines Coverage Δ
src/fetcher/mod.rs 99.08% <100.00%> (+<0.01%) ⬆️
src/fetcher/stock_watchlist.rs 85.38% <85.38%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@unhappychoice
unhappychoice merged commit e7a775d into main May 10, 2026
7 checks passed
@unhappychoice
unhappychoice deleted the feat/stock-watchlist branch May 10, 2026 13:27
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.

1 participant