explaingit

simonlin1212/globalpercent

21PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

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.

Mindmap

mindmap
  root((globalpercent))
    What it does
      Fetches prediction market data
      Classifies into ten topics
      Merges two data sources
    Data sources
      Polymarket API
      Kalshi API
      Five public endpoints
    Topics
      Monetary policy elections
      Geopolitics AI milestones
      Other categories
    Tech
      Python httpx backend
      React chart frontend
      Background refresh logic
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a real-time prediction market probability panel to an existing investment research or trading dashboard.

USE CASE 2

Pull unified Polymarket and Kalshi data into a Python dataset grouped by topic for quantitative analysis.

USE CASE 3

Embed the package as an AI assistant skill that surfaces global event probabilities on demand inside your tool.

Tech stack

PythonhttpxReact

Getting it running

Difficulty · moderate Time to first run · 30min

Requires API access to Polymarket and Kalshi, title translation uses an LLM provider that may need an API key.

In plain English

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.

Copy-paste prompts

Prompt 1
Using the globalpercent Python backend, how do I fetch the current probability for a Federal Reserve rate decision from both Polymarket and Kalshi and display them side by side?
Prompt 2
I want to add a new topic category to globalpercent beyond the existing ten. How do I modify the classification logic?
Prompt 3
The globalpercent background Kalshi refresh takes several minutes. How does the caching mechanism work, and how do I increase the refresh interval to reduce API load?
Open on GitHub → Explain another repo

← simonlin1212 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.