Skip to content

feat(updater): 52-week range from the published closes in every index row - #91

Merged
daggerok merged 1 commit into
mainfrom
feat/range-52w
Oct 29, 2026
Merged

daggerok merged 1 commit into
mainfrom
feat/range-52w

Conversation

@daggerok

Copy link
Copy Markdown
Owner

What

Shared range-52w block from the workspace etf-std tools, applied with apply-block.ts, wired once in main() right before index.json is written (withRange52w(API_ROOT, ...) on the final sorted rows, after markClosedFunds). Every funds[].metrics gets seven keys, placed before returnsBasis and performanceAsOf:

  • week52Low, week52High: lowest and highest close of the 52 weeks up to the last published close
  • range52w: position of that close between them in percent (0 = at the low, 100 = at the high)
  • range52wClose, range52wAsOf: the close used and its date
  • range52wSince: first close when the fund has less than 52 weeks of history, else null
  • range52wBasis: the history column used (SPDR publishes NAV history, so NAV)

Closes, not intraday highs and lows; no new requests. Unavailable values are null, never 0.

Why

A 52-week range column sorted by position (like Fidelity) in the brand apps and the ETFs hub; the UI follows in a separate change.

Checks

  • bun test (45 pass, exit 0), and again with the config controls of scripts/update-data.config.json exported (exit 0); the full-run pipeline test checks the seven keys on every row
  • TC_MODE=esnext .claude/tools/etfs/tc/check.sh . prints nothing; the default (ide) run shows no new error lines compared with main (48 pre-existing before and after)
  • live TICKERS=ALLW,BIL bun ./scripts/update-data.ts: 187 rows, 187 with dataFile, all 187 get a range (basis NAV), 17 younger funds have range52wSince, one metrics key set across all rows, returnsBasis/performanceAsOf stay last. Live data discarded, not part of this PR

… row

The shared range-52w block (etf-std) is applied to scripts/update-data.ts and wired in main() with withRange52w(API_ROOT, ...) on the final rows right before index.json is written.
@daggerok
daggerok merged commit c9393a4 into main Oct 29, 2026
1 check passed
@daggerok
daggerok deleted the feat/range-52w branch October 29, 2026 21:51
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