Skip to content

feat(site): index lines and show/hide toggles on the track chart - #68

Merged
HaoweiChan merged 1 commit into
mainfrom
claude/track-index-toggles
Oct 20, 2026
Merged

HaoweiChan merged 1 commit into
mainfrom
claude/track-index-toggles

Conversation

@HaoweiChan

@HaoweiChan HaoweiChan commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Why

The track page's cumulative-return chart compared the book against SPY only. Wanted 費半 and 那指 beside it, and a way to hide curves so one volatile line does not flatten the rest.

Task (verbatim): none — untracked work

What changed

  • track.track() takes indexes (default none) and adds one cumulative line per index present in the close panel, plus an indexes list in track.json; kuroshio book --provider passes ^SOX and ^IXIC for us* markets and fetches them with the book's names.
  • The chart legend is now a row of buttons: each hides or shows its polyline, and the Y axis, zero line and range text rescale to the lines still visible (small inline script, no dependency).
  • A track.json written before this change has no indexes and still renders the original four lines.
    Not changed: the book, sleeve and benchmark maths; the TW market (no index lines).

Verification

Gate: ruff 0 errors · pytest 510/510 · 9a37b85
Red-first: test_index_lines_are_tracked_and_each_legend_entry_is_a_toggle written with the feature, not watched red separately
Live: not run — the real provider fetch of ^SOX/^IXIC was not exercised; the toggle was driven in a browser on a synthetic series (hide, rescale, range text)
Not verified: that yfinance returns clean ^SOX / ^IXIC closes on the cron box; until track.json is regenerated the live page shows no new lines

Problems found

none

Follow-ups

none

Reviewer notes

Start here: _track_chart and TRACK_JS in kuroshio/site/render.py
Reproduce: pytest tests/test_track.py -q

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@HaoweiChan
HaoweiChan merged commit 99cbf8e into main Oct 20, 2026
5 of 7 checks passed
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