Similar Markets API — Semantic Market Search

The /similar-markets endpoint embeds arbitrary text and finds the closest resolved prediction markets using a pgvector HNSW index. Returns historically similar markets with their outcomes.

Endpoint

GET /api/feeds/similar-markets?q=Will+Bitcoin+hit+100k&limit=10

Parameters

ParamTypeRequiredDescription
qqueryYesText to search (market question, scenario, event)
limitqueryNoMax results (default: 10, max: 50)

Pricing

$0.005 per request (upfront payment).

Example response (truncated)

{
  "query": "Will Bitcoin hit 100k",
  "markets": [
    {
      "market_key": "btc-100k-2024",
      "question": "Will Bitcoin reach $100,000 by end of 2024?",
      "similarity": 0.89,
      "outcome": "no",
      "resolved_at": "2024-12-31T23:59:59Z",
      "category": "crypto"
    },
    {
      "market_key": "btc-ath-2021",
      "question": "Will Bitcoin surpass its all-time high in 2021?",
      "similarity": 0.82,
      "outcome": "yes",
      "resolved_at": "2021-11-10T00:00:00Z",
      "category": "crypto"
    }
  ]
}

Use cases

Historical Analogs

"Will Bitcoin hit $100k?" — find the 5 closest resolved markets with 0.89+ similarity. See what happened: 4 resolved "no", 1 resolved "yes". The base rate is 80% no. Use that as your prior.

Backtest Your Thesis

Query "Bitcoin ETF approval rally" and get 12 similar past events. 8 played out as expected, 4 didn't. Know the odds before you commit capital. $0.005 per search.

Ground Agent Forecasts

Before your AI agent votes "yes" on a market, search for similar resolved markets. If 70% of analogs resolved "no", the agent should lower its confidence. Embeddings capture semantic similarity, not just keywords.

"What Happened Last Time?"

A black swan event just hit. Search for similar past events and see the outcome distribution: median drawdown was -8%, but p05 was -22%. Size your hedge for the tail, not the median.

Frequently asked questions

How do I find historically similar crypto prediction markets?
Call GET /api/feeds/similar-markets?q=Will+Bitcoin+hit+100k. The endpoint embeds your query text and finds the closest resolved prediction markets via a pgvector HNSW index, returning similarity scores and outcomes.
What is semantic similar market search?
Instead of keyword matching, the API uses text embeddings to find markets with similar meaning. "Will BTC reach $100k" matches "Will Bitcoin surpass its all-time high" even though they share no keywords. This captures semantic similarity for better analog discovery.
How much does the similar markets API cost?
$0.005 per request (upfront payment). Pay with USDC on Solana or Base via x402. Use /outcome-stats at $0.01 for aggregated YES/NO distributions across similar markets.
Can I use similar markets for backtesting crypto predictions?
Yes. Query a scenario like "Bitcoin ETF approval rally" and get 12 similar past events with outcomes. If 8 played out as expected, you know the base rate before committing capital. Each search is $0.005.

Related endpoints