feat(orchestrate): source per-trade R from the book, behind --edge-decay - #16
Merged
Merged
Conversation
EdgeDecayTrigger landed in #15 with nothing to feed it. This adds the substrate half: a third method on the book protocol and the CLI plumbing to reach it. .trade_r_since(since, params) -> per-TRADE R since the incumbent went live Sourced over the same ledger-defined window as the periodic series, for the same reason that window comes off the ledger rather than the book: a series measured over the wrong span is a silently wrong answer rather than an error. The flag is OPT-IN and off by default, which is the important part. EdgeDecayTrigger fails open, so switching it on for a book with no frozen baseline makes every cycle fire and re-optimize, taxing the honest N for no information. A baseline is only written on a promotion, so the sequence is: teach the book trade_r_since and a Reoptimization.baseline, let one promotion happen, then turn the flag on. With --edge-decay set and no trade_r_since on the book, this refuses with a clear message rather than passing an empty series. An empty series would let the trigger fail open and produce a cycle that looks monitored and is not, which is the failure this whole module is shaped to avoid. The two R series stay separate all the way down: periodic onto the envelope's grid, per-trade not aggregated at all. 392 tests pass (+4). ruff clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
#15 landed
EdgeDecayTriggerwith nothing to feed it. This adds the substrate half.The protocol gains a third method
Sourced over the same ledger-defined window as the periodic series, for the same reason that window comes off the ledger rather than the book: a series measured over the wrong span is a silently wrong answer rather than an error.
The two series stay separate all the way down. Periodic is resampled onto the grid the drift envelope was built on; per-trade is not aggregated at all.
--edge-decayis opt-in and off by defaultThis is the part that matters for the live job.
EdgeDecayTriggerfails open, so switching it on for a book that has no frozen baseline yet makes every cycle fire and re-optimize — which taxes the honest N for no information, since every re-optimization is variants added to theSearchSpaceLog.A baseline is only written on a promotion, so the correct sequence is:
trade_r_sinceand aReoptimization.baselineEnabling it any earlier is strictly worse than leaving it off.
It refuses rather than monitoring nothing
With
--edge-decayset and notrade_r_sinceon the book, the CLI exits with a clear message. Passing an empty series instead would let the trigger fail open and produce a cycle that looks monitored and is not — the exact failure this module is shaped to avoid.Verification
ruff check crucible_stack testscleancrucible0.5.0 now, noPYTHONPATHneededThe npf side (
trade_r_sinceon the trend book, plus a frozen baseline fromreoptimize) is a companion change in the private repo.npf/scripts/orchestrate_trend.shis deliberately not changed: the flag stays off until a baseline exists on the ledger.🤖 Generated with Claude Code