About the Project: PolySignal — Polymarket Analytics Platform

Inspiration

Prediction markets like Polymarket sit at a rare intersection of finance, psychology, and collective intelligence. When people put real money behind a belief, markets often become one of the most accurate forecasting engines in the world.

But most traders still make decisions with gut instinct and a single probability number. There is no intelligence layer translating market noise into actionable insight.

That gap inspired PolySignal.

What if the signal hidden in the noise could be surfaced, quantified, and delivered in real time?


In short, PolySignal helps users move from “guessing” to “informed conviction.”

What it does

PolySignal is the analytics layer for prediction markets that transforms noisy probabilities into real-time, actionable signals that help traders bet smarter with confidence through a combination of machine learning, live data feeds, and a proprietary scoring system.

Key capabilities:

  • Unified Risk Score (URS) — Markets are continuously ranked using a multi-factor composite score covering liquidity, volume, volatility, sentiment momentum, expected value, and orderbook imbalance
  • AI Trading Signals — ML-powered buy, sell, or hold recommendations generated per market
  • Sentiment Analysis — NLP-based scoring of market narratives and event descriptions
  • Price Predictions — Statistical forecasts with confidence intervals
  • Anomaly Detection — Flags unusual market behavior and suspicious price movements in real time
  • Live Order Book & Trades Ticker — WebSocket-powered real-time market depth visualization
  • Liquidity Heatmap — YES/NO orderbook depth with toggle, liquidity walls, and slippage estimates
  • Score History Charts — Track how a market's risk profile evolves over time
  • Smart Lifecycle Management — Active events auto-sync from Polymarket every 5 minutes; resolved events are automatically archived after 7 days and purged after 3 months
  • One-URL Extraction — Paste any Polymarket event or market URL to instantly analyze it

How we built it

PolySignal is a full-stack, cloud-native application built for performance and reliability.

Frontend

React 18 + Vite + Tailwind CSS, with WebSocket connections for live event updates, TanStack React Query for data caching, and Recharts for all chart visualizations.

Backend

FastAPI (Python) with full async support, serving both REST API and WebSocket endpoints. The backend runs on a DigitalOcean Droplet behind a managed Load Balancer — a deliberate architectural choice to support WebSocket upgrades, which DigitalOcean App Platform's ingress layer does not permit.

ML Pipeline

scikit-learn models handle price prediction, anomaly detection, and sentiment analysis. The price prediction model uses lagged features:

$$\hat{P}t = f\left(X{t-1},\, X_{t-2},\, \dots,\, X_{t-n}\right)$$

where $X_{t-i}$ represents historical price, volume, and liquidity features at lag $i$.

Unified Risk Score

The core scoring engine weights seven market factors into a single 0–100 score:

$$ \text{URS} = 0.30 \cdot \text{EV} + 0.20 \cdot \text{Kelly} + 0.15 \cdot \text{Liquidity} + 0.10 \cdot \text{Volatility} + 0.10 \cdot \text{Imbalance} + 0.10 \cdot \text{Sentiment} + 0.05 \cdot \text{Spread} $$

Component Weight Description
Expected Value (EV) 30% Edge in the trade
Kelly Fraction 20% Optimal bet size based on edge and odds
Liquidity 15% Market depth, log-scaled up to \$100k
Volatility 10% Price stability — optimal around 2% swing
Orderbook Imbalance 10% Buy vs sell pressure asymmetry
Sentiment Momentum 10% Price trend strength and direction
Spread 5% Bid-ask gap transaction cost

Score bands:

$$ \text{Category} = \begin{cases} \text{Strong Buy} & \text{if } \text{URS} \geq 80 \ \text{Moderate Opportunity} & \text{if } 60 \leq \text{URS} < 80 \ \text{Neutral / Watchlist} & \text{if } 40 \leq \text{URS} < 60 \ \text{Weak / Avoid} & \text{if } \text{URS} < 40 \end{cases} $$

Data Layer

Live data is pulled from the Polymarket Gamma and CLOB APIs. A PostgreSQL materialized view (latest_market_stats) pre-computes the most recent snapshot per market:

CREATE MATERIALIZED VIEW latest_market_stats AS
    SELECT DISTINCT ON (market_id) *
    FROM polymarket_market_stats
    ORDER BY market_id, snapshot_ts DESC;

This reduced Events API response time from 16 seconds to under 800ms — a 15–20x improvement.

Deployment Architecture

Users
  │
  ▼
DigitalOcean App Platform
  https://polysignal-zp2r4.ondigitalocean.app
  └── React + Nginx (frontend)
  └── FastAPI (secondary API, no background jobs)
          │
          │ WebSocket + API calls
          ▼
DigitalOcean Load Balancer (138.197.231.111)
  └── Health checks, traffic routing
          │
          ▼
DigitalOcean Droplet (2vCPU/2GB, nyc1)
  └── Nginx (reverse proxy + WebSocket forwarding)
      └── FastAPI + Uvicorn (1 worker)
          └── Background jobs: auto-sync, backfill, lifecycle
                  │
                  ▼
DigitalOcean Managed PostgreSQL (nyc1)
  └── 346,000+ market snapshots

CI/CD: Every push to main triggers two GitHub Actions workflows — one deploys the frontend via App Platform, the other SSH-deploys the backend to the Droplet.

ML Training: Models trained on DigitalOcean GPU Droplets (H100/A100) via Gradient™ AI.


Challenges we ran into

WebSocket Support on App Platform

DigitalOcean App Platform's ingress layer permanently blocks WebSocket upgrade requests. We discovered this after building the full real-time dashboard. The solution was to move the primary backend to a Droplet with Nginx configured to properly forward WebSocket connections:

location /ws/ {
    proxy_pass http://127.0.0.1:8000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
}

Database Connection Exhaustion

Running two backend instances against a single managed PostgreSQL cluster on the smallest plan quickly hit the connection limit. We resolved this by:

  • Disabling background jobs on the App Platform instance
  • Reducing pool sizes to 3 connections per instance: $3 \times 2 = 6$ total, well within the plan limit
  • Making startup non-blocking so the app starts cleanly even when connections are temporarily unavailable

Events API Latency

The original query used DISTINCT ON CTEs that scanned all historical snapshots on every request, taking 11–16 seconds. The materialized view approach reduced this to sub-second responses.

Cold Start Scoring

New markets lack the historical data needed for full ML scoring. We built a multi-tier fallback:

$$ \text{FallbackScore} = 0.60 \cdot \frac{\log_{10}(\max(\text{Liquidity}, 1))}{\log_{10}(10^6)} \cdot 100 + 0.40 \cdot \frac{\log_{10}(\max(\text{Volume}, 1))}{\log_{10}(10^7)} \cdot 100 $$

This ensures no market ever displays N/A — there is always a meaningful score.


Accomplishments that we're proud of

  • A fully deployed, production-grade analytics platform running live on DigitalOcean
  • 15–20x performance improvement on the core data API through database query optimization
  • End-to-end WebSocket infrastructure delivering live event updates to the dashboard in real time
  • A Unified Risk Score that meaningfully differentiates markets across seven weighted factors
  • A complete ML pipeline from raw Polymarket data to actionable trading signals in under 600ms
  • Smart lifecycle management that keeps the dashboard clean — resolved markets archive automatically
  • A clean, responsive UI that makes complex market structure approachable without oversimplifying it

What we learned

  • Prediction markets are a goldmine of structured, real-money-weighted human beliefs — building on top of them is both technically challenging and genuinely interesting
  • Infrastructure constraints shape architecture in real ways. The WebSocket limitation on App Platform forced a hybrid deployment that ultimately gave us more control and better performance
  • Database query design matters enormously at scale. A single materialized view eliminated our biggest performance bottleneck
  • Presenting uncertainty well is a UX problem as much as a technical one — confidence intervals, fallback states, and friendly error messages matter as much as the underlying data
  • Async Python (FastAPI + asyncio) is extremely well-suited to I/O-bound, real-time applications at this scale

What's next for PolySignal — Polymarket Analytics Platform

  • Portfolio tracking — Let users follow markets and real positions with P&L visualization
  • Push alerts — Notify users when a market's score crosses a threshold or an anomaly is detected
  • LLM-powered sentiment — Fine-tuned language models for richer narrative analysis and event-driven forecasting
  • Mobile companion app — Lightweight app for on-the-go market monitoring and alerts
  • Social layer — Allow traders to annotate markets, share signals, and follow top performers or even place bets live.
  • Backtesting engine — Test trading strategies against historical Polymarket data

Built with ❤️ on DigitalOcean — App Platform · Droplets · Managed PostgreSQL · Load Balancer · Gradient™ AI

Built With

  • aiofiles
  • alpine-linux
  • asyncio
  • asyncpg
  • autoprefixer
  • axios
  • bash
  • clobapi
  • clsx
  • date-fns
  • digitalocean-app-platform
  • digitalocean-droplets
  • digitalocean-gradient-ai
  • digitalocean-load-balancer
  • digitalocean-managed-postgresql
  • docker
  • eslint
  • fastapi
  • github
  • github-actions
  • javascript
  • lucide-react
  • nginx
  • numpy
  • pandas
  • polymarket
  • polymarket-gamma-api
  • postcss
  • postgresql
  • pydantic
  • python
  • python-dotenv
  • python-multipart
  • react
  • react-router
  • recharts
  • requests
  • sql
  • tailwind-css
  • tanstack-react-query
  • uvicorn
  • vite
  • websockets
Share this project:

Updates

posted an update

What We Improved in PolySignal

We significantly upgraded PolySignal's performance, infrastructure, and user experience across multiple fronts.

Performance: The Events API went from 11–16 seconds to under 1 second using a PostgreSQL materialized view that pre-computes the latest snapshot per market. We also added composite database indexes and reduced connection pool sizes to stay within the managed PostgreSQL connection limit.

Infrastructure: We moved the backend from DigitalOcean App Platform (which blocks WebSocket upgrades) to a dedicated Droplet with Nginx as a reverse proxy. A DigitalOcean Load Balancer sits in front for health checks and traffic routing. This unlocked true WebSocket support for live dashboard updates.

CI/CD: We set up a dual GitHub Actions pipeline — one workflow auto-deploys the frontend via App Platform, another SSH-deploys the backend to the Droplet on every push to main.

UX: Resolved markets are hidden by default with a toggle. Newly extracted events are pinned to the top of the dashboard with a glow animation. Labels now say "Last synced" instead of "Updated." The Liquidity Heatmap was rebuilt with YES/NO book toggle and judge-friendly empty states.

AI: All AI endpoints (trading signal, sentiment, prediction) are now fully operational at under 1 second response time.

Log in or sign up for Devpost to join the conversation.

posted an update

Improvements

Automatic event syncing

  • Active extracted events now refresh automatically in the background.
  • Dashboard data stays much closer to live Polymarket conditions.

Smarter lifecycle handling

  • Event status logic has been improved so mixed-status events no longer get marked resolved too early.
  • Resolved events now remain on the dashboard for 7 days, then move to Archived, and are later deleted on a longer retention schedule.

Better “Best Score” reliability

  • Fixed issues where some events showed N/A unexpectedly.
  • New extractions now compute and persist scores much more reliably.

Improved extraction flow

  • After extracting a market/event, the dashboard now automatically jumps to and highlights the newly extracted event.
  • Users no longer need to scroll through the dashboard to find the new event.

Friendlier loading states

  • Instead of harsh error states, users now see calmer and more helpful messaging such as “Calculating…” while analytics are being prepared.

Liquidity Heatmap upgrade

  • Reworked the heatmap to support the real YES/NO orderbook structure.
  • Added a YES / NO toggle.
  • Added clearer empty states and judge-friendly explanations when live depth is unavailable.

Branding updates

  • Header branding has been refreshed to use the Polymarket logo alongside PolySignal for a cleaner identity.

Why this matters

These updates make PolySignal better at what it’s designed to do:

  • Surface live market intelligence faster
  • Make extracted events easier to find immediately
  • Explain market structure more clearly
  • Keep event state and scoring more accurate over time

Log in or sign up for Devpost to join the conversation.

posted an update

Dashboard Updates

Since some markets can resolve while others still active, I added alerts on the dashboard to ensure a user know markets that are about to close. If that event markets all resolve, the event stays on the portal for 30 days before being archived, then after 90 days, it gets cleaned up from the database. That way, we can keep the dashboard clean and manage the db very well. I'll monitor how users use the app and can adjust anytime to meet the requirements of users.

Log in or sign up for Devpost to join the conversation.