Repository navigation
feat(updater): 52-week range from the published closes in every index row - #91
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Shared
range-52wblock from the workspace etf-std tools, applied withapply-block.ts, wired once inmain()right beforeindex.jsonis written (withRange52w(API_ROOT, ...)on the final sorted rows, aftermarkClosedFunds). Everyfunds[].metricsgets seven keys, placed beforereturnsBasisandperformanceAsOf:week52Low,week52High: lowest and highest close of the 52 weeks up to the last published closerange52w: position of that close between them in percent (0 = at the low, 100 = at the high)range52wClose,range52wAsOf: the close used and its daterange52wSince: first close when the fund has less than 52 weeks of history, else nullrange52wBasis: the history column used (SPDR publishes NAV history, soNAV)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 ofscripts/update-data.config.jsonexported (exit 0); the full-run pipeline test checks the seven keys on every rowTC_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)TICKERS=ALLW,BIL bun ./scripts/update-data.ts: 187 rows, 187 withdataFile, all 187 get a range (basisNAV), 17 younger funds haverange52wSince, one metrics key set across all rows,returnsBasis/performanceAsOfstay last. Live data discarded, not part of this PR