Repository navigation
Add constrained historical fills with retained holdings and a cash ledger - #88
Merged
Merged
Conversation
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.
Summary
A portfolio can request zero weight for a halted asset while still holding it. Complete-fill accounting treats that request as a sale and can fund replacement purchases with proceeds that never existed. Add opt-in constrained historical rebalancing that retains blocked holdings and marks their subsequent returns.
Requests use the existing complete-fill post-fee NAV solve as a reference. Directional permissions and optional per-asset currency caps restrict fills; permitted sales fund pro-rata purchases and their one-way fees. Record requested, executed and unfilled trades, separate permission/cap/cash causes, and actual weights and cash. Requests expire each row and are recomputed from actual holdings.
mlquant backtest --accounting constrainedreuses saved artifacts and applies observed-price/volume and supplied directional price-band gates without forward labels. Reports retain the policy and OOS mask hashes. Existing modes keep their defaults and released constraints retain bit-identical ledger arrays. This is a close-mark research policy with same-row sale proceeds; queue, settlement, impact and live execution are outside its scope.Type of change
Reproducibility
Validation
Synthetic audit and raw ledgers. Both gain and loss outcomes from locked exits are retained. This is engineering evidence; no market performance snapshot was revalidated.