Multi-venue P1+P2: VenueAdapter extraction and Kalshi+Polymarket aggregation#7
Open
xymeow wants to merge 6 commits into
Open
Multi-venue P1+P2: VenueAdapter extraction and Kalshi+Polymarket aggregation#7xymeow wants to merge 6 commits into
xymeow wants to merge 6 commits into
Conversation
The World Cup final's Kalshi market is the outright winner event (KXMENWORLDCUP-26), which lists all 48 teams as separate markets — so event_markets rejected it with "only supports exactly two mutually-exclusive team markets". Once the bracket reaches the final, the eliminated teams settle and only the two finalists stay "active", so narrow markets to the live ones before the two-market check. Verified end-to-end: resolving the KXMENWORLDCUP URL now yields Spain vs Argentina and matches ESPN event 760517. Normal two-market advance events are unaffected (len==2 skips the filter). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The watchdog timeout closed the connection and then the rejection it caused in the in-flight #handle chain closed the same connection again — a double close on one socket. Guard with a closeOnce() flag so a connection is closed at most once regardless of which path (watchdog vs handler rejection) fires first. Found while auditing our own socket usage before attributing the recurring tcpReceive UAF to the SDK. (The vendored listener is byte-identical to the stock Moddable listen.js apart from the promise-observation guards.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… (P1+P2) P1: new stackchan_venues.py holds the VenueQuote normalized model (probabilities 0-1, USD money) and the VenueAdapter contract, with KalshiVenueAdapter as the first implementation. The watcher's Kalshi fetch now goes through the adapter; snapshot parsing and all 194 existing tests are unchanged. P2: PolymarketVenueAdapter reads the Gamma API (no auth, 15s minimum poll). The probability bar renders a liquidity-weighted mid across venues when probability_bar.polymarket maps its sides onto a Gamma market, falling back to equal weights without liquidity data and to single-venue rendering when a platform is down (log-only). Venues disagreeing by 8+ points emit an informational venue_divergence alert; a Kalshi goal signal corroborated by a same-direction Polymarket jump within 90s upgrades to a dual-venue, high-confidence callout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the multi-venue roadmap PRD, the market-pairing agent skill (three-source candidate fetcher plus pairing workflow), and a first pairing_registry.json with three agent-proposed, human-unconfirmed MLB pairings (Dodgers-Phillies x2, Pirates-Yankees). The example watchlist documents the new polymarket and probability_bar.polymarket sections and points fixture discovery at KXEPLGAME for the Premier League season. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…se notes Fixes the VenueAdapter contract as docs/venue-adapter-api.zh-CN.md per the roadmap's P1 exit criteria, documents multi-venue aggregation in both configuration guides, adds the bilingual 1.7.0 release notes, and refreshes README/getting-started/development cross-references. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Xiaoyi He <xymeow@users.noreply.github.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.
Lands the first two phases of the multi-venue roadmap PRD (docs/multi-venue-roadmap-prd.zh-CN.md), retiring the World Cup-specific assumptions now that the tournament is over. No firmware changes — the device keeps receiving the same pkbar/ticker/alert commands.
P1 — VenueAdapter extraction (pure refactor)
tools/stackchan_venues.py:VenueQuotenormalized model (probabilities 0–1, USD),VenueAdaptercontract (discover/quotes/metadata),KalshiVenueAdapterfirst implementation. Contract doc:docs/venue-adapter-api.zh-CN.md.P2 — Polymarket read-only aggregation
PolymarketVenueAdapteron the Gamma API (no auth; 15s minimum poll interval, 30s default).probability_bar.polymarket, with equal-weight fallback when liquidity is unreported and silent single-venue degradation when a platform is down.venue_divergenceinformational alert at ≥8pt cross-venue gaps (10-min cooldown); Kalshi goal signals corroborated by a same-direction Polymarket jump within 90s upgrade to a dual-venue high-confidence callout.Config and tooling
market-pairingagent skill + trimmed three-source candidate fetcher.config/pairing_registry.json: three agent-proposed, human-unconfirmed MLB pairings (verified live against Kalshi/Polymarket/ESPN: names, start times, and quotes all agree).KXEPLGAMEfor the EPL season. Known P0 gap noted in the release notes: fixture pairing must learn to skip Kalshi's draw market before EPL kickoff.Also carries two small pending fixes from the previous branch (per-connection close in the device HTTP server; tournament-winner market resolution).
Testing
python3 -m unittest discover -s tools -p 'test_*.py': 225 tests pass (194 pre-existing unmodified + 31 new for adapters, aggregation, divergence, corroboration, config parsing).node --testmod behavior tests: 2/2 pass.pkbar 44/56for Dodgers @ Phillies (Jul 20), no false divergence.🤖 Generated with Claude Code