You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chrome extension that uses Chrome's **native Side Panel** to show Synth market context on Polymarket and convert that edge into a **concrete position size**. The panel is data-first: Synth Up/Down prices, edge, confidence, signal explanation, invalidation conditions, and a **Kelly-based position sizing calculator**.
3
+
Chrome extension that uses Chrome's **native Side Panel** to show Synth market context on **Polymarket** and **Kalshi** and convert that edge into a **concrete position size**. The panel is data-first: Synth Up/Down prices, edge, confidence, signal explanation, invalidation conditions, and a **Kelly-based position sizing calculator**.
4
4
5
5
## What it does
6
6
@@ -10,16 +10,25 @@ Chrome extension that uses Chrome's **native Side Panel** to show Synth market c
10
10
-**Synth-sourced prices only**: Displays prices from the Synth API to avoid sync issues with DOM-scraped market data.
11
11
-**Manual + auto refresh**: Refresh button in panel plus automatic 15s refresh. "Data as of" timestamp shows when the Synth data was generated.
12
12
-**Clear confidence colors**: red (<40%), amber (40–70%), green (≥70%).
13
-
-**Contextual only**: Enabled on Polymarket pages; panel shows guidance when page/slug is unsupported.
13
+
-**Multi-platform**: Works on both Polymarket and Kalshi. Platform is auto-detected from URL; the UI dynamically shows "Poly" or "Kalshi" labels.
14
+
-**Contextual only**: Enabled on supported platform pages; panel shows guidance when page/slug is unsupported.
15
+
16
+
## Architecture
17
+
18
+
The codebase uses a **platform registry pattern** — each platform (Polymarket, Kalshi) is a self-contained module with its own URL patterns, asset maps, slug normalisation, and market-type detection. Adding a third platform means adding one entry to the registry; no if/else scattering across the codebase.
19
+
20
+
-**`matcher.py`** — Platform registry (Python, server-side). Polymarket checked first to prevent slug collisions with Kalshi legacy tickers.
21
+
-**`extension/platforms.js`** — Platform registry (JS, extension-side). Single source of truth for origins, domain hints, URL templates.
22
+
-**`extension/content.js`** — Strategy pattern: platform detected once at init, scrapers dispatched per platform.
14
23
15
24
## How it works
16
25
17
-
1.**Content script** (on `polymarket.com`) reads the market slug from the page URL and scrapes **live prices** and **balance** from the DOM.
18
-
2.**Side panel page** requests context from the content script and fetches Synth edge data from local API (`GET /api/edge?slug=...`).
19
-
3.**Panel rendering** displays Synth forecast data (prices, edge, signal, confidence, analysis, invalidation) and updates every 15s or on manual refresh.
20
-
4.**Position Sizing card** combines Synth probabilities, Polymarket-implied odds, forecast confidence, and user balance into a Kelly-based recommendation.
21
-
5.**Background service worker** enables/disables side panel per-tab based on URL and runs the alert polling engine.
22
-
6.**Edge alerts** poll watched markets every 60s via `chrome.alarms`. When edge exceeds the user's threshold, a browser notification fires with asset, edge size, signal direction, and confidence. Clicking the notification focuses or opens the relevant Polymarket page. Notifications are suppressed when the user is already viewing the market and have a 5-minute cooldown per market to avoid spam.
26
+
1.**Content script** (on `polymarket.com` and `kalshi.com`) detects platform from hostname, reads the market slug using platform-specific extraction, and scrapes **live prices** and **balance** from the DOM.
27
+
2.**Side panel page** requests context from the content script and fetches Synth edge data from local API (`GET /api/edge?slug=...&platform=...`).
28
+
3.**Panel rendering** displays Synth forecast data (prices, edge, signal, confidence, analysis, invalidation) with dynamic platform labels and updates every 30s or on manual refresh.
29
+
4.**Position Sizing card** combines Synth probabilities, market-implied odds, forecast confidence, and user balance into a Kelly-based recommendation.
30
+
5.**Background service worker** enables/disables side panel per-tab based on URL (any supported platform) and runs the alert polling engine.
31
+
6.**Edge alerts** poll watched markets every 60s via `chrome.alarms`. Each watchlist entry stores its platform. When edge exceeds the user's threshold, a browser notification fires with asset, edge size, signal direction, and confidence. Clicking the notification focuses or opens the relevant market page on the correct platform. Notifications are suppressed when the user is already viewing the market and have a 5-minute cooldown per market to avoid spam.
23
32
24
33
## Synth API usage
25
34
@@ -37,7 +46,7 @@ The **Position Sizing** card in the side panel answers “how much should I bet?
37
46
### Balance detection
38
47
39
48
- The content script (`content.js`) runs on `polymarket.com` and:
40
-
- Scrapes **wallet / account balance** from compact DOM text such as `Balance 123.45 USDC` or `$123.45`.
49
+
- Scrapes **wallet / account balance** from compact DOM text such as `Balance 123.45 USDC` or `$123.45` (works on both Polymarket and Kalshi).
41
50
- Exposes this numeric balance as `balance` in the context returned to the side panel.
42
51
- In the side panel (`sidepanel.html` / `sidepanel.js`):
43
52
- The **Balance** field is pre-filled with the scraped value when available.
2. Start server (from repo root): `python tools/synth-overlay/server.py` (or from `tools/synth-overlay`: `python server.py`). Listens on `127.0.0.1:8765`.
125
+
2. Start server (from repo root): `python tools/synth-overlay/server.py` (or from `tools/synth-overlay`: `python server.py`). Listens on `127.0.0.1:8765`. Set `SERVER_HOST` env var to change bind address.
0 commit comments