Skip to content

feat(metrics): swing metrics from the shared block - #102

Merged
daggerok merged 1 commit into
mainfrom
feat/swing-block
Nov 12, 2026
Merged

daggerok merged 1 commit into
mainfrom
feat/swing-block

Conversation

@daggerok

Copy link
Copy Markdown
Owner

What

  • Shared swing block (etf-std/swing.block.ts, applied with apply-block.ts) in scripts/update-data.ts, history mode: wired once as withSwing(<feed root>, await withRange52w(...)) right before index.json is written. Every metrics gets pctFrom52wHigh, athPrice, athDate, athBasis, pctFromAth, volatility1y, sigmaFromMean60d, high60d, low60d after the range-52w keys, before returnsBasis and performanceAsOf
  • Source: the Close column of the published history pages (no new requests), so kept funds get the same values again and reruns stay zero-diff
  • Pipeline test: swing key order (slice(-11, -2)) and a real value check (athPrice a number, athBasis daily closes since <date>); tests that list the index-added keys now include the swing keys
  • README ### Metrics and caveats: the swing list

Why

Screener plan 1.6, item S5: the ETF feeds publish the same swing metrics as the Stocks feed

Checks

  • swing-gates.sh <repo> baseline before the edit, swing-gates.sh <repo> check after: bun test (66 pass, 0 fail, 438 expect() calls), bun test with the config controls exported, bun build of the updater and of src/main.tsx, git diff --check, check-readme, check-scripts, check-log-tags, apply-block.ts --check swing,range-52w,calendar-dates, tc with no new errors: all ok
  • Real run TICKERS=DXJ ./scripts/update-data.ts (exit 0), DXJ in api index.json: {"pctFrom52wHigh":-3.29,"athPrice":61.2933,"athDate":"2026-10-06","athBasis":"daily closes since 2006-06-16","pctFromAth":-3.29,"volatility1y":19.11,"sigmaFromMean60d":-0.23,"high60d":61.2933,"low60d":56.4}; data discarded (git checkout -- api/ && git clean -fd api/), nothing committed

@daggerok
daggerok merged commit 776da9b into main Nov 12, 2026
1 check passed
@daggerok
daggerok deleted the feat/swing-block branch November 12, 2026 16:54
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