Skip to main content

AI agent that analyzes trends and suggests new Polymarket prediction markets in real time.

Project description

Polymarket AI Market Suggestor

Python LangChain OpenAI Typer License: Apache-2.0

AI-native workflow that transforms real-time trends, news, and existing Polymarket markets into actionable, publish-ready market suggestions. Built for research teams, traders, DAO governance desks, and community curators who want to discover “what market should Polymarket list next?” using a mix of LLM reasoning, sentiment signals, and overlap checks.

SEO keywords: Polymarket AI, AI agent Polymarket, Polymarket AI market prediction, AI market prediction, Polymarket prediction market bot, Polymarket real-time trading bot, Polymarket AI trading bot, Polymarket market analyzer, Polymarket AI market suggestor.

Why PolySuggest AI?

  • Trend-aware ideation – Combines live NewsAPI + Twitter sentiment to surface emerging narratives.
  • Crypto momentum feed – Adds CoinGecko trending tokens as signals for on-chain market discovery.
  • Overlap protection – Uses Polymarket Gamma API to ensure suggestions are novel and not already live.
  • LLM-powered reasoning – GPT-4o (or fallback heuristic) produces clear resolution rules, YES/NO framing, and references.
  • Explainable output – Each idea includes rationale, confidence scoring, and tagged metadata for filtering.
  • Local knowledge base – SQLite bundle store captures every run for history, analytics, and dashboards.
  • Ready for production – Typer CLI, structured logging, Markdown/JSON reporting, tests, Docker-friendly dependency set.

ℹ️ The AI core and workflow are inspired by leading open-source prediction market agents such as Prediction-Market-AggregationAgent-system while focusing on generative market ideation instead of trading.

Architecture Overview

TrendScanner (NewsAPI, Twitter API)
        │
        ▼
Sentiment & Keyword signals ────────┐
                                    │
PolymarketClient (Gamma API)        │
        │                           │
        ▼                           │
Existing market snapshots ──────────┘
        │
        ▼
SuggestionEngine (LangChain + GPT-4o)
        │
        ▼
SuggestionBundle (Pydantic)
        │
        ├─ Storage (SQLite) — durable bundle history + analytics
        ├─ CLI (Typer + Rich) — interactive reports
        └─ Reporting utils — JSON / Markdown / history summaries
  • trend_scanner.py — pulls hot news and tweets with VADER sentiment.
  • trend_scanner.py (crypto) — optional CoinGecko trending feed for DeFi narratives.
  • polymarket_client.py — fetches trending/current markets via Gamma API.
  • ai.py — formats context + prompts GPT-4o (falls back if no API key).
  • orchestrator.py — runs the end-to-end pipeline and deduplicates output.
  • storage.py — SQLite-backed bundle persistence.
  • analytics.py — portfolio-wide stats on past runs.
  • reporting.py — exports Markdown dashboards and history summaries.
  • cli.py — Typer command group: suggest and summarize.

Quick Start

git clone https://github.com/your-org/polymarket-ai-market-suggestor.git
cd polymarket-ai-market-suggestor
python -m venv .venv && source .venv/bin/activate  # or use uv/pdm
pip install -r requirements.txt
cp ENV.sample .env
# populate .env with OpenAI / NewsAPI / Twitter keys

Generate Suggestions

polysuggest suggest "AI safety regulation" --keywords "AI,regulation,legislation" --count 4 \
  --markdown reports/ai-safety.md --output reports/ai-safety.json

Sample console output:

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Title                                         ┃ Confidence ┃ Resolution Source          ┃ Tags          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ Will the EU enact the AI Act before Q4 2025?  │ 0.72       │ Official EU Parliament DB  │ ai-policy,... │
│ ...                                           │ ...        │ ...                        │ ...           │
└───────────────────────────────────────────────┴────────────┴────────────────────────────┴───────────────┘

Outputs:

  • reports/ai-safety.json – structured SuggestionBundle.
  • reports/ai-safety.md – Markdown one-pager for sharing.
  • SQLite bundle store (default data/bundles.db) captures a full copy for analytics.

Summarize History

polysuggest summarize reports/

Displays a Rich table of prior suggestion runs (topic, timestamp, top pick, confidence).

To use the built-in storage instead:

polysuggest summarize

Inspect & Analyze

polysuggest show 3        # Detailed view for run #3
polysuggest insights      # Aggregated stats (top tags, avg confidence, sentiment)

Configuration

Environment variables (copy ENV.sample):

Variable Description Example
OPENAI_API_KEY GPT-4o API key for suggestion engine sk-...
OPENAI_MODEL Override model gpt-4o-mini
POLYMARKET_API_BASE Gamma API endpoint https://gamma-api.polymarket.com
NEWS_API_KEY NewsAPI key (optional) news-...
TWITTER_BEARER_TOKEN Twitter v2 bearer token (optional) AAAAAAAA...
DEFAULT_TREND_KEYWORDS Fallback keywords polymarket, ai, elections
CHROMA_PERSIST_PATH Future use for RAG vector store .chroma
POLYSUGGEST_DATA_DIR Directory for SQLite bundle storage data

No LLM key? The system falls back to a deterministic heuristic generator so pipelines remain testable offline.

Roadmap

  • Integrate Tavily/NewsCatcher for better global news coverage.
  • Plug in CrewAI/agent voting for multi-model consensus.
  • Streamlit dashboard for live market ideation boards.
  • Optional Polymarket CLOB integration to auto-submit community market suggestions.
  • RAG knowledge base seeded with past Polymarket markets and governance posts.

Development & Testing

pip install -r requirements.txt
pytest

To run the CLI inside the repo without installing:

python -m polysuggest.cli suggest "US election turnout"

Logging is powered by Loguru; set LOGURU_LEVEL=DEBUG for verbose traces.

Dockerfile coming soon (project is fully dependency-pinned via requirements.txt / pyproject.toml).

Need help or collaboration?

Let’s build the next generation of AI-native Polymarket tooling together.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polymarket_ai_market_suggestor-0.1.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polymarket_ai_market_suggestor-0.1.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file polymarket_ai_market_suggestor-0.1.0.tar.gz.

File metadata

File hashes

Hashes for polymarket_ai_market_suggestor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7a77d48551918b22269238cc1a6106d140c32b9b13f12114907b4f41bb3bed91
MD5 0a3952d976397c6b61d512ab0f60f766
BLAKE2b-256 8f142652b15bc5df9690d4469cc57e9ecbf568deab96821e54962a8169ee2ffa

See more details on using hashes here.

File details

Details for the file polymarket_ai_market_suggestor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for polymarket_ai_market_suggestor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54796f640ae4f86f8038dffa02aa6f916f575eb500c99396749af15644b3bbfd
MD5 07e03edf4ad2f048a7442bc8202bbd4e
BLAKE2b-256 d78feb29444e14c7a7bbfa2051d4f909061c321f90eef89c2168d316b4646fb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page