Predictarium Start learning

API

This is the maths behind the practice markets, opened up as an API you can call from your own models, spreadsheets or trading tools wherever you trade. Send it the prices and your own probability and you'll get back the same numbers we check before we trade (keys go to the waitlist first, and you'll pay per call once billing's on).

Keys

Every call needs your key in the x-api-key header, and the answers all come back as JSON from predictarium.win/api/v1. We've switched on cross-origin calls too, so you can use it straight from a browser as well as from your own server.

curl "https://predictarium.win/api/v1/fair-odds?yes=63&no=39" -H "x-api-key: YOUR_KEY"

Most of our own trading tools started life as a spreadsheet with these four calculations in it, and we got tired of rewriting them for every venue, which is really why this API exists. If there's a calculation you keep doing by hand, tell us when you join the waitlist and we'll think about adding it.

Fair odds

The fair-odds endpoint takes the Yes and No prices in cents and tells you the overround you're paying, along with what the market really thinks of each side once that margin's been taken out.

GET /api/v1/fair-odds?yes=63&no=39
{ "yes_price": 63, "no_price": 39, "overround": 2, "fair_yes": 0.617647, "fair_no": 0.382353 }

Expected value

The expected-value endpoint works out how many contracts your stake buys and your break-even probability with the fee included, and then what the trade's worth on average at your own probability.

GET /api/v1/expected-value?price=40&prob=50&stake=100
{ "contracts": 250, "payout_if_right": 250, "break_even_prob": 0.4, "edge": 0.1, "expected_value": 25 }

Kelly sizing

The kelly endpoint gives you the Kelly fraction for a binary contract, which is your probability minus the price, divided by one minus the price. You can pass a fraction as well, since most traders (us included) only ever bet part of it.

GET /api/v1/kelly?price=40&prob=50&fraction=0.5
{ "kelly_fraction": 0.166667, "scaled_fraction": 0.083333, "fraction_used": 0.5 }

Series odds

The series endpoint turns a chance of winning one map into the chance of winning a best of one, three, five or seven. It assumes the maps are independent of each other, which isn't quite true, but it's close enough to be useful.

GET /api/v1/series?map=60&best_of=3
{ "best_of": 3, "map_win": 0.6, "series_win": 0.648 }

Esports data

The esports feed doesn't need a key for now. It gives you current Dota 2 team ratings, the league matches being played between rated teams with the model's probability, and recent results next to what the model said beforehand, all refreshed from OpenDota's public data every five minutes.

Errors

If something goes wrong you'll get a short message back with the status code. A 401 means the key is missing or switched off, a 400 means a parameter is missing or out of range (the message tells you which one), and a 404 means there's no endpoint by that name.

Getting a key

Join the waitlist below and tell us roughly what you'd use it for. We're sending keys out in small batches at first, because we'd like to see how people actually use it (and fix whatever confuses them) before billing starts, and once it does you'll only pay for the calls you make.