← Back to Projects

Case Study

Polymarket Sentiment Agent

Prediction-market agent where the LLM only labels headline sentiment and Python computes the Bayesian edge versus market price. Paper trading, live demo.

Executive Summary

An autonomous agent that watches Polymarket markets and crypto news, uses an LLM purely as an NLP parser, then computes a deterministic Bayesian posterior in Python. Edge equals posterior minus market-implied prior. Live demo at poly-agent.fly.dev.

Problem & Constraints

Most AI trading demos ask the model for price predictions, but LLMs are uncalibrated. This agent splits NLP parsing from the quantitative decision, running in paper-trading mode with an x402 paywall on premium rationale endpoints.

Architecture

News RSS ingestion → LLM sentiment labeling → Bayesian posterior update → edge = posterior - market price → paper trader → FastAPI backend + React frontend.

Methodology

  • Ingested real-time news via free RSS and Polymarket public APIs
  • LLM labels headline sentiment; Python computes calibrated Bayesian updates
  • Compared computed edge against market-implied probabilities
  • Deployed on Fly.io with Docker; Vite frontend with API proxy

Results & Metrics

MetricResult
Live demopoly-agent.fly.dev
ModePaper trading
NLPLLM parser only
MathBayesian posterior

Tech Stack

Python, FastAPI, React, Vite, Docker, Fly.io, Polymarket API

Future Work

Backtesting framework, multi-market expansion, reinforcement learning for position sizing.

Links