feat: methodology refinements (cap target/trigger split, float-factor rounding)#6
Merged
Merged
Conversation
… rounding) Two pure-computation refinements from the TradFi research. Cap target/trigger split (MarketCapMethodology): - Rename capWad to capTargetWad (the level getWeights caps to) and add capTriggerWad (default 30%, validated at or above the target; equal disables hysteresis). WeightMath.applyCap is unchanged and keeps its proven invariants. - The trigger deliberately lives at the rebalance layer, not inside applyCap: Nasdaq caps the target weight to the target and uses the higher number only as the actual-weight threshold that decides when to rebalance. The methodology exposes capTriggerWad for the Stage 3 rebalancer to consume. Float-factor rounding (SupplyOracle): - _roundFactorWad applies CRSP Effective Float Factor tiers (nearest 5% above 10%, 1% between 1 and 10%, 0.1% below 1%) to the agreed median at commit, so a float wiggle within a tier produces the same committed factor and no weight movement. A nonzero factor never rounds to zero. Rank-by-full-mcap/weight-by-float is already satisfied by the multi-index decision (membership is admin-curated; the supply oracle never touches membership). Packeting, the asymmetric buffer, and the rule-based emergency reweight belong to the reconstitution and rebalancer stages and are deferred to them. Adds cap-defaults, trigger-validation, and float-rounding tests; updates two oracle tests where the 0.92 median now snaps to the 0.90 tier. 86 tests pass.
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
Two pure-computation refinements from the TradFi research (spec Sections 5.3 and 8.2).
Cap target/trigger split (
MarketCapMethodology)capWadtocapTargetWad, the levelgetWeightscaps to, and addedcapTriggerWad(default 30%, validated at or above the target; equal is allowed, which disables hysteresis).WeightMath.applyCapis unchanged, with its proven invariants intact.applyCap. The verified Nasdaq-100 behavior caps the target weight to the target (20%/40%) and uses the higher number (24%/48%) only as the actual-weight threshold that decides when to rebalance. So the methodology exposescapTriggerWadfor the Stage 3 rebalancer to consume as the off-cycle rebalance condition. The spec's Section 5.3 wording, which had said to amendapplyCap, is corrected.Float-factor rounding (
SupplyOracle)_roundFactorWadapplies CRSP's Effective Float Factor tiers (nearest 5% above 10% float, nearest 1% between 1 and 10%, nearest 0.1% below 1%) to the agreed median at commit time.Scope reconciliation
The rank-by-full-market-cap, weight-by-float split is already satisfied by the multi-index decision: membership is admin-curated and the supply oracle never touches membership. The full-market-cap ranking only matters for an optional top-N reconstitution mode, which the reconstitution module will own. Packeting and the asymmetric buffer are reconstitution features, and the rule-based emergency reweight is a rebalancer feature, so all three are deferred to the stages that own them rather than built in the wrong place here.
Testing
Adds cap-defaults, trigger-validation, and float-rounding tests (in-tier no-op versus tier-crossing move, plus a fuzz invariant that the committed factor is always tier-aligned and nonzero), and updates two oracle tests where the 0.92 median now correctly snaps to the 0.90 tier. 86 tests pass.