layer docs

How matching works

A wrong match is worse than no match: a bot that trusts it could bet both sides of what it thinks is one market and lose on both. So Layer only serves a match after several independent checks.

1. Pull every open market

Every 6 hours Layer pulls all open markets from Kalshi and Polymarket — about 13,000 Kalshi events and 43,000 Polymarket events. Sports events are split by market type (winner, spread, total, side markets), and each side of a two-team Polymarket market becomes its own contract. NFL, NBA and NHL teams get their full names on both venues, since Kalshi names them by city ("Philadelphia") and Polymarket by nickname ("Eagles").

2. Find candidates

For each upcoming Kalshi event, Layer looks for Polymarket events in a compatible category, within a date window (±1 day for games, ±7 days otherwise), with similar titles. It keeps the best 5. Once a Kalshi series has approved matches in a Polymarket series, Layer looks in that series directly, keeping only events of the same market type between the same two teams or players.

3. Rule them out with hard checks

Code rejects a candidate — no AI involved — if:

  • the dates are missing or too far apart,
  • the market types differ (a game's winner vs its total points),
  • one side is a ladder of thresholds and the other a set of ranges,
  • the number of outcomes or the kind of line differs,
  • no outcome on one side has the exact same line as an outcome on the other. "At least 60" and "above 60" are different lines: they pay differently if the result is exactly 60.

A single yes/no question on each side counts as one possible pairing, whatever the two venues label it ("Yes", "Before 2027", or the whole question). The graders decide whether it's the same question.

4. Grade with two AI models

What survives first gets a quick, cheap check from Jev: pairs it's confident are about different events (under 50% "same event") are dropped before the more expensive grader reads them. Grading runs as fast as it can, with a monthly spending limit.

The rest go to two independent graders, each reading both venues' full rules:

  • Claude writes a verdict (same bet, same bet with differences, different), a confidence, the exact rule differences, and a one-sentence explanation.
  • Jev, a separate classifier, answers the same questions with its own probabilities. It's asked about each outcome pairing Claude confirmed on its own (each spread or total line, each Fed bucket), so a 25-line market is judged line by line, not all at once.

5. Go live only when it's safe

A match goes live when Claude is at least 90% sure, or Claude and Jev both say "same bet" at 80% or more. Only the outcome pairings the graders confirmed are served; under the two-grader rule, that means only the lines both passed. Confident mismatches are removed; everything else waits.

After a match is live

If either venue edits the rules of a matched market, the match is pulled from the API (rules_changed_pending_review) until it's checked again. Closed markets disappear on the next pull.

Checking matches against real results

Every match is checked again once both markets resolve. Both venues publish the result, so Layer compares them:

  • Agreed — both paid out the same way. The match was right.
  • Disagreed — one paid Yes, the other No. The match was wrong. Layer pulls that event pair from the API (needs_review), records a plain-English explanation from both venues' rules, and opens a GitHub issue with both sides' details so the cause gets fixed.
  • Edge case — one venue voided the market (for example, refunded a postponed game) while the other resolved it. That's the kind of difference the caveats field warns about, so it's counted separately.

The share of settled matches that agreed is how Layer measures its own accuracy.

Measuring what Layer misses

Accuracy says whether live matches are right; coverage says how many should-be matches are live. Layer tracks a fixed list of core series both venues list — NFL, college football, NBA, WNBA, NHL, MLB, the top European soccer leagues, Champions League, MLS, ATP and WTA tennis, UFC, Fed decisions, CPI and jobs reports — and, for every upcoming event in them (next 14 days for sports, 60 for the rest), records the furthest it got: live, waiting to be graded, rejected by the graders, screened out, vetoed, no Polymarket look-alike found, or not searched yet. Not every event in those series is on Polymarket, so the share that's live is a floor.