Inspiration
Conventional wisdom when investing in the stock market is to buy ETFs and wait a few decades; you can't beat the market, after all. Prediction markets flip that: you can trade on specific events, but that also concentrates risk. Will Bitcoin moon? Who will be the next president of Portugal? Who will be F1 World Champion? (🙏 Max Verstappen 🙏)
If you trust your gut, it's a no-brainer. But what if you're not entirely sure? In the traditional finance world, you can buy an Energy sector ETF to get exposure to the industry without putting all your eggs in a single basket. We wanted to apply that philosophy to Polymarket's prediction markets. Bullish on Gavin Newsom? Polyfund will take your high-level sentiment and distribute your investment across related markets (e.g: announcing candidacy, Dem nominee, presidential election winner).
What it does
Polyfund turns a free‑text thesis into a correlation‑aware prediction market basket. It discovers relevant markets, selects a single “anchor” market as the numerical proxy for the thesis, pulls recent price history, computes correlations, and outputs BUY YES/BUY NO signals with correlation‑weighted allocations. The UI lets users search a thesis, inspect the selected anchor, view correlated opportunities, and visualize historical P&L, rolling correlations, and anchor price history.
How we built it
- FastAPI backend with a recommendation endpoint.
- Market discovery from a Supabase‑backed markets table using keyword generation plus fuzzy relevance ranking.
- AI‑assisted anchor selection (Gemini) with confidence gating and proxy‑thesis retries.
- Price history from the Polymarket CLOB prices-history endpoint with retry logic and overlap filtering.
- Pearson correlations on aligned time series and correlation‑weighted portfolio construction. ### Frontend (Vite + React):
- Landing experience with thesis search and loading states.
- Trending markets panel using Gamma events data (top‑liquid markets with probability/volume).
- Anchor display with AI confidence and reasoning.
- Charts for portfolio P&L, rolling correlations, and anchor price (Recharts).
- Scenario simulator slider to model anchor price moves and estimate portfolio impact.
- Correlated opportunities grid with action badges and weight display. ## Challenges we ran into
- Data sparsity & overlap: Many markets don’t have enough overlapping history for reliable correlations, so we had to enforce minimum‑point filters.
- Thesis ambiguity: Broad theses often map to multiple markets; confidence gating and proxy‑thesis retries were needed to avoid bad anchors.
- API variance: Polymarket data fields vary across endpoints, requiring defensive parsing and fallbacks.
- UI/UX trust: We needed explainability (confidence + reasoning) to make AI selections feel credible. ## Accomplishments that we're proud of
- End‑to‑end thesis -> anchor -> signals -> weighted basket working in both API and UI.
- A polished frontend with charts, scenario simulator, and actionable portfolio cards.
- Explainable recommendations with AI reasoning, confidence, and search metadata.
- Robust fallbacks for missing AI keys and unreliable data. ## What we learned
- We had to learn fast that a thesis isn’t a market. Picking the right anchor is the make-or-break.
- It’s tempting to pull every related market, but a smaller, cleaner set gave better baskets.
- Building the CLI first saved us. Once the pipeline worked end‑to‑end, the UI became a translation exercise.
- Showing the “why” (confidence + reasoning) mattered as much as the numbers. ## What's next for Polyfund
- Let users build multi‑thesis baskets and hedge one thesis against another.
- Add a simple portfolio tracker so users can save, re‑run, and compare baskets over time.
- Tighten execution flows: export orders and one‑click trade tickets.
Log in or sign up for Devpost to join the conversation.