name: polyclaw description: AI-powered news edge scanner and auto-trader for Polymarket. Ingests real-time news from 10+ sources, matches to Polymarket markets using category-aware fuzzy matching, estimates probability shifts, detects fee-adjusted trading edges, and auto-trades via CLOB API. version: "1.1.0" license: MIT allowed-tools: Read,Write,Bash(python:*),WebFetch
Polyclaw
Prerequisites
- Python 3.10+
- pip packages:
feedparser httpx rich pandas rapidfuzz - For LLM mode: Gemini CLI installed at
/opt/homebrew/bin/gemini
Quick Start
# Install dependencies
cd polyclaw/src
pip install -r requirements.txt
# Run a single scan
python scanner.py --scan
# Scan with Gemini LLM analysis
python scanner.py --scan --use-llm
# Pure LLM-only mode (skip rule-based matching)
python scanner.py --scan --llm-only
# View and manage open positions
python scanner.py --positions
# Run continuous monitoring
python scanner.py --monitor --interval 60
# Custom settings
python scanner.py --scan --min-edge 0.05 --bankroll 5000
What's New (v1.1)
- π€ Gemini LLM Integration β
--use-llmmerges LLM signals with rule-based analysis;--llm-onlyfor pure LLM scanning - π Position Management β Auto take-profit (+15%), stop-loss (-10%), 24h timeout with live price tracking
- π¨π³ Chinese Media Sources β BlockBeats and PANews for crypto-native Chinese market intelligence
- 8 data sources total β Reuters, AP, Bloomberg, CoinDesk, CoinGecko, Fear & Greed, BlockBeats, PANews
Architecture
News Sources (8: RSS/APIs + Chinese media)
β
βΌ
news_ingestion.py βββΊ Fetch + deduplicate + cache to news_feed.json
β
βΌ
event_parser.py βββββ market_cache.py (Polymarket Gamma API, 5-min TTL)
β Category-aware matching (crypto/politics/sports/economics/tech/geopolitics)
β Entity extraction (English + Chinese NLP)
β Negation-aware sentiment analysis
β Fuzzy matching with specificity gates
β
βΌ
probability_engine.py βββ llm_analyzer.py (optional, Gemini 2.5 Flash)
β Per-market signal aggregation
β LLM signal merging (when --use-llm)
β Directional shift logic (YES=up vs YES=down)
β Source credibility weighting
β Volume dampening for liquid markets
β
βΌ
edge_calculator.py
β Polymarket fee schedule modeling
β Fee-adjusted edge computation
β Kelly criterion position sizing
β
βΌ
position_manager.py
β Open/close paper positions
β Auto take-profit / stop-loss
β 24h timeout exit
β
βΌ
scanner.py βββΊ Rich terminal UI with color-coded tables
Module Descriptions
news_ingestion.py
Fetches news from RSS feeds (Reuters, AP, Bloomberg, CoinDesk, The Block, Google News), CoinGecko trending, Fear & Greed Index, BlockBeats, and PANews (Chinese crypto media). Deduplicates by content hash. Rolling cache of 100 items.
market_cache.py
Queries Polymarket Gamma API for top 100 active markets by volume. 5-minute cache TTL.
event_parser.py
Category-aware matching with entity extraction (English + Chinese NLP), negation-aware sentiment, market question parsing, and LLM integration via parse_with_llm().
probability_engine.py
Multi-signal aggregation with directional logic, source weighting, volume dampening, and merge_llm_estimates() for combining rule-based and LLM signals.
edge_calculator.py
Models Polymarket's taker fee schedule. Fee-adjusted edge for YES/NO sides. Kelly criterion sizing.
llm_analyzer.py
Calls Gemini 2.5 Flash via CLI for structured newsβmarket analysis. Batches up to 20 news items against all markets. Returns typed LLMSignal objects.
position_manager.py
Tracks paper trading positions with:
- Take-profit: +15% from entry β auto close
- Stop-loss: -10% from entry β auto close
- Timeout: 24h with <2% move β close (signal expired)
- Max 5 open positions, 10% per position, 30% total exposure
scanner.py
CLI orchestrator. Modes: --scan, --monitor, --positions. Flags: --use-llm, --llm-only.
Configuration
| Parameter | Default | Description |
|-----------|---------|-------------|
| --min-edge | 0.03 (3%) | Minimum edge after fees |
| --bankroll | $1,000 | Paper trading bankroll |
| --interval | 60s | Monitor scan interval |
| --use-llm | off | Add Gemini LLM analysis |
| --llm-only | off | Pure LLM mode |
| --positions | β | View/manage positions |
Prompt Engineering
Data & AI
Prompt engineering best practices and templates to maximize AI outputs.
Data Visualization
Data & AI
Generates data visualizations and charts tailored to your data.
RAG Architecture Setup
Data & AI
Setup guide for RAG (Retrieval-Augmented Generation) architectures.