Skip to content

feat(synth-overlay): Add Kalshi platform support with real ticker format matching(Closes: #19)#40

Closed
dev-miro26 wants to merge 2 commits intoentrius:mainfrom
dev-miro26:feat/synth-overlay-kalshi-integration
Closed

feat(synth-overlay): Add Kalshi platform support with real ticker format matching(Closes: #19)#40
dev-miro26 wants to merge 2 commits intoentrius:mainfrom
dev-miro26:feat/synth-overlay-kalshi-integration

Conversation

@dev-miro26
Copy link

Summary

Extends Synth Overlay to support Kalshi as a second prediction market platform alongside Polymarket. The extension now detects Kalshi pages, scrapes live prices (dollar + cent formats), maps real Kalshi ticker formats to Synth assets/market types, and serves edge data through the existing API server. Includes extension context invalidation guards to prevent errors on extension reload.

Related Issues

Fixes #19

Type of Change

  • Improvement to existing tool
  • Bug fix
  • Documentation

What Changed

Matcher (matcher.py)

  • Added _KALSHI_ASSET_MAP with 30+ real Kalshi series tickers (KXBTCD, KXBTC, KXBTC15M, KXETHD, etc.) mapped to assets
  • Added _kalshi_series_from_ticker() to extract series from full market tickers (e.g. KXBTCD-26MAR1317-T70499.99kxbtcd)
  • Short legacy tickers (btc, eth, btcd, ethd) require Kalshi-style date suffix to avoid collision with Polymarket slugs
  • Added detect_platform(), asset_from_kalshi_ticker(), get_kalshi_market_type() for Kalshi-specific routing
  • normalize_slug() handles multi-segment Kalshi URLs (e.g. /markets/kxsol15m/solana-15-minutes/kxsol15m-26mar121945) and tickers containing periods (e.g. -T70499.99)

Content Script (content.js)

  • Added scrapeKalshiPrices() with 4 strategies: cent format ("Yes 52¢"), dollar format ("Yes $0.52"), standalone prices with parent context walk, and order book patterns
  • slugFromPage() updated to extract last path segment for deep Kalshi URLs
  • Added scanKalshiMarketLinks() to detect crypto market links on Kalshi browse pages
  • Added isContextValid() guard + teardown() to prevent "Extension context invalidated" errors — clears polling interval, disconnects MutationObserver, and silences all chrome.runtime calls when extension context dies

Extension (manifest.json, background.js, sidepanel.js)

  • Added https://*.kalshi.com/* to host_permissions and content_scripts matches
  • background.js: SUPPORTED_ORIGINS includes kalshi.com, null guard on isSupportedUrl()
  • sidepanel.js: platform-aware UI labels ("Kalshi" vs "Poly"), Kalshi market link buttons for navigation, updated hint text with real ticker examples

Server (server.py)

  • Platform auto-detection from URL parameter via detect_platform()
  • Kalshi tickers routed through asset_from_kalshi_ticker() for asset resolution
  • Response includes "platform": "kalshi" field

README

  • Rewrote Kalshi market matching section with real ticker formats and disambiguation logic
  • Updated platform support table (Kalshi: daily, 15min, range)
  • Fixed verification URLs and curl examples
  • Documented extension context invalidation guard

Testing

  • Manually tested
  • Tests added/updated
venth-issue-19.mp4

@dev-miro26
Copy link
Author

Hi, @e35ventura
I am sorry, I know you are so busy. If you don't mind, could you please review my first PR and leave the feedback kindly?
I appreciate you.

@e35ventura
Copy link
Collaborator

It doesn't even work in your demo video? extensions shows kalshi price as 99c to 1c?

@dev-miro26
Copy link
Author

dev-miro26 commented Mar 13, 2026

It doesn't even work in your demo video? extensions shows kalshi price as 99c to 1c?

bandicam.2026-03-12.21-00-35-853.mp4

@e35ventura
Could you review this video again?
And please leave the feedback kindly.

@dev-miro26 dev-miro26 changed the title feat(synth-overlay): Add Kalshi platform support with real ticker format matching feat(synth-overlay): Add Kalshi platform support with real ticker format matching(close: #19) Mar 13, 2026
@dev-miro26 dev-miro26 changed the title feat(synth-overlay): Add Kalshi platform support with real ticker format matching(close: #19) feat(synth-overlay): Add Kalshi platform support with real ticker format matching(Closes: #19) Mar 13, 2026
MkDev11 added a commit to MkDev11/venth that referenced this pull request Mar 13, 2026
…tification slug; tests; PR docs

- README: 'Alerts: why platform is stored', Kalshi slug detection (hash, og:url, __NEXT_DATA__, Polymarket-first)
- background.js: notification click use substring(7) for kalshi| prefix
- content.js: scrapeKalshiPrices __NEXT_DATA__ fallback
- test_matcher: test_detect_platform_legacy_kalshi_ticker_no_kx_prefix
- PR_DESCRIPTION.md: why this approach, differentiators
- PR_40_VS_OURS.md: comparison with PR entrius#40
@ventura-oss
Copy link

Closing in favor of #41. PR #41 implements a much more robust Platform Registry architecture and a dynamic grammar parser for Kalshi tickers, which scales significantly better than maintaining a hardcoded list. More importantly, #41 fixes the critical Chrome extension context invalidation bugs on reload and reliably tracks Polymarket balances during SPA navigation. Great effort here, but the structural improvements in #41 make it the preferred path forward.

@e35ventura e35ventura closed this Mar 13, 2026
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: Kalshi Support

3 participants