feat: add Polymarket and Kalshi prediction market extractors #66

Closed
Claude wants to merge 1 commits from feat/prediction-markets into main
Collaborator

Summary

  • Add Polymarket site extractor using the public Gamma REST API (no browser/Playwright needed)

    • Search() - text search via /public-search endpoint
    • GetEvent() / GetMarket() - lookup by slug or numeric ID
    • GetEventFromURL() - parse polymarket.com/event/... URLs
    • Handles Polymarket's inconsistent JSON encoding (fields can be arrays or stringified arrays)
  • Add Kalshi site extractor using the public trade API (no auth needed for reads)

    • Search() - fetches open events and filters client-side (Kalshi has no text search API)
    • GetMarket() / GetEvent() - lookup by ticker
    • GetMarketFromURL() / GetEventFromURL() - parse kalshi.com/markets/... URLs
    • Prices converted from cents (0-100) to probabilities (0-1)
  • Both include CLI tools (sites/*/cmd/*/main.go) with search, event, and market subcommands

  • Both include comprehensive test suites using net/http/httptest (27 tests total, all passing)

Design Notes

These extractors use direct HTTP (net/http + encoding/json) rather than the Browser interface since both platforms have free, public REST APIs. This is faster, more reliable, and doesn't require Playwright.

Test plan

  • go build ./... compiles cleanly
  • go test ./sites/polymarket/... - 14 tests pass
  • go test ./sites/kalshi/... - 13 tests pass
  • Manual: go run ./sites/polymarket/cmd/polymarket search "olympic hockey"
  • Manual: go run ./sites/kalshi/cmd/kalshi search "olympic hockey"

🤖 Generated with Claude Code

## Summary - Add **Polymarket** site extractor using the public Gamma REST API (no browser/Playwright needed) - `Search()` - text search via `/public-search` endpoint - `GetEvent()` / `GetMarket()` - lookup by slug or numeric ID - `GetEventFromURL()` - parse `polymarket.com/event/...` URLs - Handles Polymarket's inconsistent JSON encoding (fields can be arrays or stringified arrays) - Add **Kalshi** site extractor using the public trade API (no auth needed for reads) - `Search()` - fetches open events and filters client-side (Kalshi has no text search API) - `GetMarket()` / `GetEvent()` - lookup by ticker - `GetMarketFromURL()` / `GetEventFromURL()` - parse `kalshi.com/markets/...` URLs - Prices converted from cents (0-100) to probabilities (0-1) - Both include CLI tools (`sites/*/cmd/*/main.go`) with `search`, `event`, and `market` subcommands - Both include comprehensive test suites using `net/http/httptest` (27 tests total, all passing) ## Design Notes These extractors use direct HTTP (`net/http` + `encoding/json`) rather than the Browser interface since both platforms have free, public REST APIs. This is faster, more reliable, and doesn't require Playwright. ## Test plan - [x] `go build ./...` compiles cleanly - [x] `go test ./sites/polymarket/...` - 14 tests pass - [x] `go test ./sites/kalshi/...` - 13 tests pass - [ ] Manual: `go run ./sites/polymarket/cmd/polymarket search "olympic hockey"` - [ ] Manual: `go run ./sites/kalshi/cmd/kalshi search "olympic hockey"` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 1 commit 2026-02-21 00:52:56 +00:00
feat: add Polymarket and Kalshi prediction market extractors
All checks were successful
CI / vet (pull_request) Successful in 2m15s
CI / build (pull_request) Successful in 2m17s
CI / test (pull_request) Successful in 2m27s
29e53bb7c2
Add site extractors for two prediction market platforms using their
public REST APIs (no browser/Playwright dependency needed).

Polymarket: search via Gamma API, get events/markets by slug/ID/URL.
Handles inconsistent JSON encoding (stringified arrays).

Kalshi: get markets/events by ticker/URL, search via client-side
filtering of open events (no text search API available).

Both include CLI tools and comprehensive test suites using httptest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude closed this pull request 2026-02-21 00:55:23 +00:00
All checks were successful
CI / vet (pull_request) Successful in 2m15s
CI / build (pull_request) Successful in 2m17s
CI / test (pull_request) Successful in 2m27s

Pull request closed

Sign in to join this conversation.