feat(polymarket): record quote collection outcomes - #238
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughChangesPolymarket CLOB ingestion now validates malformed market data, propagates timestamp and book errors, and emits structured Polymarket quote handling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ClobWebSocket
participant ClobBookState
participant MarketUpdateChannel
participant RecordingFeed
ClobWebSocket->>ClobBookState: Validate book and price changes
ClobBookState-->>ClobWebSocket: Return quote update or error
ClobWebSocket->>MarketUpdateChannel: Emit QuoteCollectionFailure
ClobWebSocket->>MarketUpdateChannel: Emit empty Quote events
MarketUpdateChannel->>RecordingFeed: Record quote updates
RecordingFeed->>RecordingFeed: Classify outcomes and suppress matching synthetic empties
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.jsonTraceback (most recent call last): rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.jsonTraceback (most recent call last): 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79e9f930cf
ℹ️ 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".
| && bid_levels.is_empty() | ||
| && ask_levels.is_empty() | ||
| { | ||
| return None; |
There was a problem hiding this comment.
Preserve the fail-closed quote in replay tapes
When the WebSocket disconnects after publishing a valid book, spawn_clob_ws_quote_feed_until forwards a failure followed by an empty quote, but this return removes the empty quote from the tape. I checked RecordedFeed and SimulatedExecutor::observe_market_update: replay emits the failure as-is, while the executor and strategies clear cached liquidity only for an empty MarketUpdate::Quote, not for QuoteCollectionFailure. Consequently, live execution fails closed but replay retains the last executable quote and can produce fills or research results that were impossible live; preserve an equivalent empty update in replay or make the failure deterministically clear the book during replay.
Useful? React with 👍 / 👎.
Change contract: The production Polymarket CLOB WebSocket path records explicit per-token collection failures and truthful executable, one-sided, empty, and non-executable quote outcomes with source and received timestamps.
Out of scope: Uploader/manifest eligibility and shadow-gate changes are owned by the stacked validation PR; production deployment/cutover, snapshot construction, evaluator/MCTS, and research logic are unchanged.
Dependency or merge order: Base layer. Merge this PR before codex/polymarket-quote-validation-220.
Focused validation: ploy-market-data live library tests (125 passed); recorded feed tests (10 passed); existing MarketUpdate tag stability test; new-ploy-runner full-feature cargo check; final read-only spec and standards reviews found no blocker.
Rollout/rollback impact: No deployment is performed. Runtime strategies still receive the existing fail-closed empty quote on WS failure, while the raw recorder stores the failure and excludes only its exact synthetic empty pair. Revert this PR to restore the prior recording contract.
Issue: Producer/recording layer for #220.
Summary by CodeRabbit