MCPcopy Index your code
hub / github.com/AmazingAng/PolyWorld

github.com/AmazingAng/PolyWorld @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
748 symbols 1,751 edges 166 files 33 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PolyWorld

Real-time Polymarket prediction market visualization dashboard with an interactive world map.

License

Features

  • Interactive World Map — Browse 500+ prediction markets plotted on a MapLibre GL globe with clustering, category filters, and regional views
  • 14 Live Panels — Markets, Detail, Region, News, Tweets, Live Streams, Watchlist, Leaderboard, Smart Trades, Whale Trades, Order Book, Trader, Sentiment, Price Chart
  • AI-Powered Insights — Market summaries, news relevance matching, and sentiment analysis via Claude API
  • Smart Money Tracking — Whale trade monitoring, leaderboard rankings, and wallet-level trade history
  • Real-Time Data — Auto-refreshing market data (45s), smart money (30s), order book (10s), and news feeds
  • Drag & Resize Layout — Fully customizable panel grid with drag reordering, column/row span controls, and split bottom/right layout
  • Watchlist & Alerts — Star markets, set price/volume alerts with browser notifications

Tech Stack

  • Framework: Next.js 16 (App Router), React 19
  • State: Zustand 5
  • Map: MapLibre GL JS
  • Charts: lightweight-charts (TradingView)
  • Database: SQLite (better-sqlite3)
  • AI: Claude API (@anthropic-ai/sdk)
  • Styling: Tailwind CSS 4 + CSS custom properties

Getting Started

Prerequisites

  • Node.js 18+
  • npm

Setup

# Clone
git clone https://github.com/AmazingAng/PolyWorld.git
cd PolyWorld

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env
# Edit .env with your API keys

# Start dev server
npm run dev

Open http://localhost:3000.

Environment Variables

Variable Required Description
AI_BASE_URL Yes Anthropic API base URL
AI_API_KEY Yes Anthropic API key (for summaries, news matching, sentiment)
AI_FALLBACK_BASE_URL No Fallback API base URL
AI_FALLBACK_API_KEY No Fallback API key (used if primary fails)

The app works without AI keys — summaries and sentiment will be disabled, but all market data, charts, and trading features remain functional.

Project Structure

src/
├── app/          # Next.js App Router, API routes
├── components/   # 14 panel components + Header, WorldMap, etc.
├── hooks/        # Custom hooks (preferences, watchlist, alerts, drag, resize)
├── lib/          # Data processing, AI clients, news/tweet sources
├── stores/       # Zustand: marketStore, smartMoneyStore, uiStore
└── types/        # TypeScript definitions

Scripts

npm run dev      # Development server
npm run build    # Production build
npm run start    # Production server
npm run lint     # ESLint

Acknowledgements

Inspired by WorldMonitor.

License

MIT

Extension points exported contracts — how you extend this code

ChartData (Interface)
Cached data from fetch — survives mode/indicator changes
src/components/ChartPanel.tsx
TrimmedMarket (Interface)
Fields kept by trimMarket for the frontend
src/lib/sync.ts
CacheEntry (Interface)
* Scrapes YouTube /@channel/live to extract current live video ID + HLS manifest. * Caches results for 5 minutes. * GE
src/app/api/youtube-live/route.ts
RateBucket (Interface)
(no doc)
src/middleware.ts
PolymarketEvent (Interface)
(no doc)
src/types/index.ts
MarketState (Interface)
(no doc)
src/stores/marketStore.ts
I18nContextValue (Interface)
(no doc)
src/i18n/index.tsx
SpanResizeOptions (Interface)
(no doc)
src/hooks/useSpanResize.ts

Core symbols most depended-on inside this repo

get
called by 129
src/lib/apiCache.ts
set
called by 78
src/lib/apiCache.ts
useI18n
called by 58
src/i18n/index.tsx
formatVolume
called by 33
src/lib/format.ts
getDb
called by 26
src/lib/db.ts
rowSpanFor
called by 23
src/app/page.tsx
add
called by 21
src/components/WorldMap.tsx
detectSubEmoji
called by 17
src/lib/categories.ts

Shape

Function 562
Interface 164
Method 14
Class 8

Languages

TypeScript100%

Modules by API surface

src/hooks/usePanelDrag.ts31 symbols
src/components/WorldMap.tsx28 symbols
src/lib/smartMoney.ts23 symbols
src/components/WalletButton.tsx17 symbols
src/components/TradeModal.tsx17 symbols
src/types/index.ts16 symbols
src/components/ChartPanel.tsx16 symbols
src/components/OrderForm.tsx14 symbols
src/lib/tradeAuth.ts13 symbols
src/lib/sync.ts12 symbols
src/lib/signalEngine.ts12 symbols
src/lib/resolutionSync.ts12 symbols

For agents

$ claude mcp add PolyWorld \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact