Skip to content

Add Synth Overlay — Polymarket Edge Extension#5

Open
bitloi wants to merge 6 commits intoentrius:mainfrom
bitloi:feature/synth-overlay-polymarket-extension
Open

Add Synth Overlay — Polymarket Edge Extension#5
bitloi wants to merge 6 commits intoentrius:mainfrom
bitloi:feature/synth-overlay-polymarket-extension

Conversation

@bitloi
Copy link

@bitloi bitloi commented Feb 26, 2026

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 SynthClient to call get_polymarket_daily(), get_polymarket_hourly(), get_polymarket_range(), and get_prediction_percentiles(asset, horizon) for edge computation, confidence, and explanations. All Synth access goes through synth_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:

  • What the tool does — Inline badge, detail card, slide-out panel; contextual overlay only for Synth-supported slugs (daily/hourly up–down, range).
  • Architecture — Extension (content script) → local API (GET /api/edge?slug=...) → SynthClient + edge/analyzer logic → overlay injection.
  • Synth API integration — All four Polymarket-related endpoints and percentiles for confidence and explanations.
  • Usage — Install deps, start server, load unpacked extension, open supported Polymarket URL; plus verification steps and test command.

Related Issues

Fixes #3 — Synth Overlay: Polymarket Edge Extension

Testing

  • Tests pass in mock mode (python -m pytest tools/synth-overlay/tests/ -v)
  • Manually tested with mock data (daily, hourly, and range slugs)
  • Tests added in tools/synth-overlay/tests/ (63 tests: edge, matcher, analyzer, server)

Checklist

  • 1-page technical document at tools/synth-overlay/README.md
  • Tool lives in its own subfolder under tools/
  • Tool uses synth_client.SynthClient for all Synth API access
  • Code follows project style guidelines
  • Self-review completed

- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Synth Overlay: Polymarket Edge Extension

1 participant