Inspiration

Every retail investor faces the same problem: they hold a portfolio of stocks but have no easy way to hedge against the specific risks that threaten their positions. Traditional hedging requires options knowledge, margin accounts, and significant capital. Meanwhile, prediction markets like Polymarket have emerged as incredibly efficient price discovery mechanisms for real-world events (such as elections, regulations, geopolitical conflicts, earnings outcomes) but there's no bridge connecting these two worlds. What if you could upload your stock portfolio and instantly see which prediction markets are relevant to your holdings, how mispriced they are, and exactly how to allocate capital across them to reduce risk?

The interface is modeled after Robinhood; the idea is that if you're already comfortable trading stocks there, prediction markets should feel just as familiar. Lower the barrier to entry for a new asset class.

What it does

PolyHedge takes a user's stock portfolio and automatically:

  1. Identifies relevant prediction markets by searching Polymarket's API using keywords extracted from Yahoo Finance company profiles (company name, industry, sector, and business description analysis).
  2. Runs analysis via K2Think to classify each market's relationship to the portfolio (hedge, amplifier, regime signal, etc.), estimate fair probabilities, and compute edge.
  3. Generates three strategies:
    • Hedge: prioritizes markets that offset portfolio risk
    • Amplify:finds markets that reinforce existing bets
    • Explore: surfaces non-obvious connections
  4. Computes an Index, which is a diversified "prediction market ETF" tailored to the user's holdings, using quarter-Kelly criterion sizing with 15% per-position caps.
  5. Provides a Polymarket-style trading interface where users can select markets, configure Yes/No positions, see estimated payouts, and open trades directly on Polymarket.

How we built it

Frontend: React + TypeScript + Tailwind CSS, designed to match Robinhood's aesthetic. Zustand for state management with localStorage persistence so analysis results survive page reloads.

Backend: Node.js/Express server handling:

  • Portfolio import via CSV upload, manual entry, or Gmail OAuth (scanning Robinhood confirmation emails)
  • Yahoo Finance integration for live quotes, charts, and company profile data
  • Polymarket Gamma API integration with a multi-layer relevance scoring system
  • K2Think AI pipeline for portfolio analysis

Challenges we ran into

Keyword matching for niche stocks was the hardest problem. Company names often reveal nothing about the industry: "Intuitive Machines" sounds like an AI company but it's a lunar lander manufacturer. Our initial approach of extracting words from company names produced terrible results. We solved this by fetching Yahoo Finance's longBusinessSummary and pattern-matching against industry-specific templates to extract meaningful search terms.

The Gamma API doesn't support text search, so we fetch 200 high-volume markets and score locally. This means we can miss lower-volume but highly relevant markets. We mitigated this by searching multiple keywords per holding in parallel.

K2Think would sometimes estimate a "fair value" of 18% for a market trading at 0% with 2 days until expiry (e.g., "Will Bitcoin reach $150k by March 31?"). We added prompt guardrails requiring the AI to respect market prices, especially for near-expiry markets, and cap edge estimates at 15%.

Accomplishments that we're proud of

Getting the keyword pipeline to work properly took a while. We had to pull Yahoo Finance descriptions and match against industry patterns just to get the right Polymarket results showing up.

What we learned

  • Prediction markets are way more efficient than we expected. We kept getting excited when the AI would spit out huge edge estimates, then we'd look at the market and realize that Bitcoin is not hitting $150k in two days. We spent a surprising amount of time making the AI less confident.

  • Most of our backend work was filtering out garbage. First version matched a biotech company to alien life markets and a space company to Premier League football. We learned that for search/matching problems, the hard part was to not show the wrong results.

What's next for PolyHedge

  • We want to connect directly to the Polymarket API for order execution so you can trade without leaving the app. We couldn't implement this because Polymarket's API is restricted in our region, but the integration points are already built, so if you're in a supported region, the functionality is ready.

  • Longer term, supporting more prediction market platforms beyond Polymarket (like Kalshi) would give users more markets to work with, especially for US-regulated events.

Built With

Share this project:

Updates