+130 on the Commanders, reads the Polymarket fair price for the same side, and prints the edge, the expected value per $100 and a stake. It refuses to answer when the Polymarket book is too wide, too thin, too old, or the game has started.
The free EV calculator does the same math in a browser. This recipe is for checking many prices from code.
You need a Pro or Max API key and Node.js 22 or later. The script uses the TypeScript client and runs with tsx:
1. Read the fair price
Get fair price names the side by its game, market type and label.fair.prob is the side’s Polymarket midpoint, normalised so both sides add up to 1.
status before fair.prob. Only ok means the midpoint is fit to price against. failed_checks lists every check the book failed, and game.started is true once the kickoff has passed, when the price may be in play.
2. Turn the price into an edge and a stake
The math has four steps. A price in American odds becomes decimal odds. The decimal odds give the break-even probability,1 / decimal. The edge is the fair probability less the break-even. The expected value per $1 staked is fair x decimal - 1, and the Kelly stake is that expected value over decimal - 1, as a share of your bankroll.
price-a-bet.ts
fair.american_odds is positive expected value at the fair probability. fair.american_odds is the break-even price, so the script’s answer and that field agree.
3. Choose your own limits
The default checks are a 3-cent spread, $500 resting within 2 cents of the midpoint on each side, and a book observed within 60 seconds.thresholds in the response repeats the ones the answer was checked against. Tighten them before a bigger stake:
line too: market_type=spread&outcome_label=Commanders&line=3.5.
What it does not do
- Read a sportsbook’s prices. Bring the price you were offered.
- Place a bet or an order. The API provides analytics, and a positive expected value is not a promise of a result.
- Price a market outside a covered game. List games lists the covered games.