Add Synth Overlay — Polymarket Edge Extension#5
Open
bitloi wants to merge 6 commits intoentrius:mainfrom
Open
Conversation
- edge.py: compute YES-edge from Synth vs market prob, classify signal (underpriced/fair/overpriced) and strength (strong/moderate/none) - matcher.py: normalize slug from Polymarket URL, infer market type (daily/hourly/range), is_supported() - server.py: Flask API on 127.0.0.1:8765 — GET /api/health, GET /api/edge?slug=... using SynthClient (mock or live) - extension/: MV3 content script on polymarket.com, injects badge + detail card, fetches edge from local server - tests: 26 tests for edge, matcher, server (mock mode) - README: technical doc and run instructions
- analyzer.py: EdgeAnalyzer class with dual-horizon analysis, percentile-based confidence scoring (0-1), signal explanations, and invalidation conditions - server.py: wired through EdgeAnalyzer; API returns confidence_score, explanation, invalidation alongside edge/signal/strength - content.js: slide-out panel with full analysis (why signal exists, what invalidates it, confidence bar); fixed MutationObserver infinite loop; SPA navigation handled via URL polling + slug tracking - content.css: slide-out panel, confidence bar, hover states - tests: 56 total (19 new analyzer tests covering aligned/conflicting/fair signals, confidence scoring, explanations, invalidation, bias detection)
- content.js: capture requestedSlug before fetch, discard response if page slug changed during network round-trip (prevents stale overlay on fast SPA navigation) - analyzer.py: add analyze_range() with range-specific explanation, invalidation, and percentile-based confidence for range markets - server.py: wire analyze_range for range endpoint; range API now returns confidence_score, explanation, invalidation like up/down - matcher.py: remove dead code (redundant conditions, unused constant); broaden hourly detection from hardcoded "6pm" to regex matching any time pattern (e.g. 10am, 3pm) - tests: 63 total — 7 new range analysis tests, broader hourly matcher tests, range server response now asserts analysis fields
- _build_range_explanation: fix "X of X" bug — now correctly shows mispriced count vs total bracket count (e.g. "8 of 11") - Remove unused BracketEdge dataclass - Remove unused 'field' import from dataclasses
…E verification - Position overlay badge fixed top-right (always visible on Polymarket) - Format API timestamps as 'Feb 25, 11:45 PM UTC' in detail card and panel - Add 'Verify the overlay (before recording)' section to README
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.
Tool Name
Synth Overlay — Polymarket Edge Extension
Summary
Chrome extension that adds a live “fair value” layer on Polymarket market pages using Synth forecasts. It shows whether the current YES price is underpriced, overpriced, or fair, and exposes edge strength (Strong / Moderate / No Edge) with dual-horizon signals (1h and 24h), confidence scoring, and optional “No trade” guidance when uncertainty is high or signals conflict.
How it uses the Synth API: The local Flask server uses
SynthClientto callget_polymarket_daily(),get_polymarket_hourly(),get_polymarket_range(), andget_prediction_percentiles(asset, horizon)for edge computation, confidence, and explanations. All Synth access goes throughsynth_client.SynthClient; mock data is used when no API key is set.Demo
Technical Document
The 1-page technical document is in
tools/synth-overlay/README.md. It covers:GET /api/edge?slug=...) →SynthClient+ edge/analyzer logic → overlay injection.Related Issues
Fixes #3 — Synth Overlay: Polymarket Edge Extension
Testing
python -m pytest tools/synth-overlay/tests/ -v)tools/synth-overlay/tests/(63 tests: edge, matcher, analyzer, server)Checklist
tools/synth-overlay/README.mdtools/synth_client.SynthClientfor all Synth API access