Repository navigation
feat(updater): shared n-port reader, calendar dates, windowed history, ticker and new-fund checks - #87
Merged
Conversation
…, ticker and new-fund checks Shared nport-reader, holdings-guard previousWeights, windowed-chart, calendar-dates and fund-selection blocks; WT-2: N-PORT tickers only for U.S. equities in USD (debt and derivative rows keep '-'); young-fund rule by calendar anniversary from the earliest known start
This was referenced Oct 26, 2026
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 changed
The shared updater blocks of
.claude/tools/etfs/etf-std(byte-identical, applied withapply-block.ts, the current nport-reader template with the EDGAR state-suffix fix), wired like Schwab #75readNportHoldingswith one SEC state per run (resetSecState()), the series id from SEC'scompany_tickers_mf.json(parseSecFundTickers) and tickers fromnportTickerswith SEC's company names (parseSecCompanyNames). The sheet keeps the WisdomTree headers (nportCellandnportIdentifier).txtsubmission through the series Atom feed, took only the first feed entry, built the archive folder from the accession prefix (the filer agent), accepted a filing whose series id was missing, replaced the published sheet on>=its date, wrote0for a missing weight or value, published CUSIP000000000as the identifier and gave every row a name-matched tickerprimary_doc.xml), only the fund's own series, strictly newer than the published N-PORT sheet, missing numbers empty, the position's own identifier (ISIN or other id instead of000000000), a ticker only for a U.S. equity in USD and never on two securitiesFANUF)nportNameKey, EDGAR suffixes like/DE/dropped); the old normalizer and company map are goneholdingsWeightCount(publishedHeaders, publishedRows)as the 5th argument at both guard calls, so even the relaxed WSPC cannot replace numeric published weights with an all-blank sheet;HOLDINGS_GUARD_RELAXis exported for the testHISTORY_RANGEwindow is merged with the published history and older distributions (the published[Ex-Date, ..., Total Distribution]rows are mapped to[date, amount]); a window that does not join keeps the published history (the old copy shrank the history to the window)toIsoDateiscalendarIso(raw) ?? raw(the old copy went throughDate.parse, aUTCsuffix kept month names on the right day, but a timestamp with an offset such as2026-10-24T22:00:00-07:00became the 25th)withoutYoungReturnswith{ yr1, cagr3y, cagr5y, cagr10y, siAnn }on the official month-end and quarter-end tables (main, NAV and index rows) and on the final returns. The old copy nulled only since inception, below 365 days. Now the calendar anniversary, inclusive, every horizon; the age counts from the earliest known start (catalog inception, Yahoo first trade, first history day) so GCC (joined WisdomTree in 2020, trades since 2008) keeps its official 10-year return. The "derived since inception only from a series that starts at inception" part of fix(metrics): since-inception never annualized below one year or from a history window #86 stays (annualizedSince)assertKnownTickersafter the catalog load (live catalog plus published funds; the old check also accepted stale catalog-only rows), previous rows enter the catalog only withdataFile, the index map drops stale catalog-only rows (withoutStalePlaceholders). The pre-runNEW FUNDSline (every live ticker missing from the index, also failed reads) is replaced bynewFundsLines(newFundsReport(previous, final))after the index is written, in the log and as### NEW FUNDSin the step summary.DROPPED FUNDSstays (now only funds with published data)TICKERSandHISTORY_RANGErowsValues that change on the next runs
0(102 rows), own identifiers instead of000000000(17,576 rows), no ticker on 6,365 non-equity rows and on non-USD equities, weights at most 8 decimals,Shares Heldwithout trailing zeros,Coupon/Maturityon every row of a debt sheetLHXfor L3Harris from the new name keyHow it was checked
bun test: 57 pass / 400 expects on main -> 65 pass / 428 expects, exit 0; the same with the config controls exported, exit 0bun build --target=bun scripts/update-data.ts --outfile=/dev/null,bun build --target=bun src/main.tsx --outfile=/dev/null,git diff --checkcheck-readme.ts,check-scripts.ts,apply-block.ts --check holdings-guard,nport-reader,windowed-chart,fund-selection: ok, all five blocks identicaltc/check.sh: 64 -> 52 error lines (all pre-existing[ide]kinds, no new kind)REQUEST_SLEEP=0,VERBOSE=true), thengit checkout -- api/ && git clean -fd api/:TICKERS="DGRW USFR": both unchanged, both logN-PORT ... is not newer than the published holdingsapi/wisdomtree/funds/{DXJ,SHAG}removed: DXJ rebuilt from accession 0000940400-26-036274 (2026-06-30, 439 rows, weight sum 104.56, 0000000000), SHAG from 0000940400-26-028881 (2026-05-31, 1,190 rows, weight sum 99.52); rows with a ticker on non-equity or debt rows 687 -> 0, all equity tickers of DXJ (Tokyo listings) dropped; USFR in the same runnot newerfunds/DGRWremoved: 198 rows, weight sum 99.97, 197 U.S. tickers (171 on the published first page before), 0 on non-equity rowsHISTORY_RANGE=1y TICKERS="DGRW USFR": zero diff, history rows 3,377 and 3,200 keptTICKERS="GCC WQTM DGRW": GCC and DGRW unchanged, WQTM 1-year and since inception nulled