gitmyhub

globalpercent

Python ★ 42 updated 14d ago

全球宏观预期概率面板 (AI Skill) — Polymarket+Kalshi 双源 · 5端点 · 10模块 · 零鉴权 | Global-macro-probability panel skill for AI coding assistants (prediction-market data pipeline)

Pulls real-money prediction market probabilities from Polymarket and Kalshi, classifies them by topic, and provides an instant-loading global-events panel you can drop into an investment research app.

PythonhttpxReactsetup: moderatecomplexity 3/5

This repository is a build guide and reference code package for adding a global market-probability panel to an investment research system. It connects to two prediction-market platforms, Polymarket and Kalshi, both of which publish probability numbers for real-world events like Federal Reserve decisions, elections, and geopolitical developments. The probabilities come from people betting real money, so they reflect genuine market opinion rather than surveys or models. Reading those numbers is free and requires no account.

The system collects raw market data from five public API endpoints and classifies every market into one of ten topic groups, such as monetary policy, elections, geopolitics, or AI milestones. It merges the two sources into a common data structure so outputs look consistent regardless of where a data point originated. The result is a snapshot panel that loads instantly from a local file, while a background refresh process quietly updates the data without making the user wait.

Several practical problems are handled inside the package. Kalshi's full market catalog can take several minutes to download, so the system fetches it in the background and returns the previous snapshot while a new one builds. If an API call returns zero results, nothing gets written to disk, which protects against an outage accidentally clearing stored data. Title translation is done in small batches with retry logic to work around rate limits from language-model providers.

The project is framed as a skill for AI coding assistants like Claude Code: you load the included files into your assistant's context and ask it to integrate the panel into your own app. The code folder contains a Python backend that uses only the httpx library for HTTP requests, plus a React frontend with chart components. Three swap points are documented, covering the data storage path, translation client, and chart library, so you can substitute your own choices without rewriting the core logic.

Where it fits