feat(research): bind reprice pilots to market episodes - #162
proerror77 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cc00938 to
f6d641f
Compare
1670c4b to
f6fa62d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1670c4bb83
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let matrix = autofactor_matrix_from_v2(rows)?; | ||
| let scores = expr.evaluate(&matrix)?; | ||
| let labels = autofactor_labels_from_v2(rows, target); |
There was a problem hiding this comment.
Filter to the target side before evaluating stateful expressions
When expr contains Delta, RollingMean, RollingStd, or ZScore, this evaluates it over the paired Up and Down rows returned by the cohort splitter and removes the opposite side only afterward through its non-finite label. Candidate mining in mine_domain_autofactors_from_v2_with_guidance instead filters to the target side before evaluation, so fitting the same candidate uses a different series, and its frozen threshold and held-out PnL depend on interleaved values from the other token and on row ordering. Filter to the requested side before constructing the matrix while retaining the original row indices for event aggregation.
Useful? React with 👍 / 👎.
| for (market_id, (up_tokens, down_tokens)) in event_tokens { | ||
| if up_tokens.len() != 1 || down_tokens.len() != 1 { |
There was a problem hiding this comment.
Reject a token shared by both market sides
When an episode assigns the same non-empty pm_token_id to both Up and Down rows, both sets have length one and this identity check accepts it. That permits one outcome token to masquerade as both sides despite the documented fail-closed requirement for one Up token and one Down token, corrupting side-bound pilot data; reject episodes where the two singleton token sets overlap.
Useful? React with 👍 / 👎.
| .filter_map(|(idx, (score, label))| { | ||
| (score.is_finite() && label.is_finite()).then_some((idx, score, label)) |
There was a problem hiding this comment.
Account for unfillable full-depth exits in pilot metrics
For these full-depth targets, set_future_exit_labels leaves label_future_exit_full_depth_pnl_10s/30s as None when the observed future book cannot fill the exit, while setting the corresponding fillable label to Some(0.0). This filter drops those decisions before both threshold fitting and held-out selection, so a pilot that selects many positions that cannot be exited can report PnL solely from its few fillable winners and appear profitable. Preserve observed-but-unfillable rows when calculating selection coverage and expose or gate their full-depth exit fill rate instead of silently omitting them.
Useful? React with 👍 / 👎.
Change contract
Provide a fail-closed library contract for BTC 5m reprice pilots: exact Polymarket market identity carried as
event_id, one stable Up and Down token per episode, whole-episode train/test cohorts, and a train-only frozen selection evaluated on held-out rows.Out of scope
CLI execution, MCTS artifact publication, 30-second targets, settlement baselines, Live/Paper, and other horizons.
Dependency or merge order
Layer 3 of 4; base is #161 (which is based on #160). Merge after #161 and before #163. The checked-in BTC and SOL template policy identities rotate because this library is governed policy source.
Focused validation
git diff --check; targeted counterexample test rejects an episode without exactly one Up and one Down token, excludes crossing/missing-end episodes, and proves a threshold is frozen from train rows before held-out evaluation.rustfmt --checkwas run on owned files. Local Rust compilation was intentionally not run; Linux CI is the build authority.Rollout/rollback impact
No runtime command changes yet. This adds a reusable research-only fail-closed contract; revert removes the contract and restores the prior policy identity.