> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xinsider.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Markdown of an API reference page leaves out the OpenAPI schema.
> Every object an endpoint returns or a webhook carries, with each field's type, presence and meaning, is on https://docs.0xinsider.com/api-reference/objects.md.
> The full OpenAPI 3.1 spec names each operation's and each webhook's exact parameters, request body and response schema: https://docs.0xinsider.com/api-reference/openapi.json.

# Price a sportsbook bet against Polymarket

> Check whether a price a sportsbook offers beats the Polymarket fair price for the same side, with the edge, the expected value and a Kelly stake.

By the end you have a script that takes a price you were offered, such as `+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](https://0xinsider.com/tools/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](https://docs.0xinsider.com/authentication.md) and Node.js 22 or later. The script uses the [TypeScript client](https://docs.0xinsider.com/integrations/typescript-client.md) and runs with `tsx`:

```bash theme={null}
npm install @0xinsider/sdk
export OXINSIDER_API_KEY=...
```

## 1. Read the fair price

[Get fair price](https://docs.0xinsider.com/api-reference/endpoint/get-fair-price.md) 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.

```bash theme={null}
curl -sS \
  -H "Authorization: Bearer $OXINSIDER_API_KEY" \
  'https://api.0xinsider.com/api/v1/fair-price?event_slug=nfl-was-nyg-2026-11-13&market_type=moneyline&outcome_label=Commanders'
```

Read `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.

```typescript price-a-bet.ts theme={null}
import { OxinsiderApiClient } from "@0xinsider/sdk";

const apiKey = process.env["OXINSIDER_API_KEY"];
if (!apiKey) throw new Error("Set OXINSIDER_API_KEY");
const client = new OxinsiderApiClient({ apiKey });

// The bet you were offered. Change these four.
const EVENT_SLUG = "nfl-was-nyg-2026-11-13";
const SIDE = "Commanders";
const AMERICAN = 130;
const BANKROLL_USD = 1000;
const KELLY_FRACTION = 0.25;

function decimalFromAmerican(american: number): number {
  return american > 0 ? 1 + american / 100 : 1 + 100 / Math.abs(american);
}

const { data } = await client.getFairPrice({
  event_slug: EVENT_SLUG,
  market_type: "moneyline",
  outcome_label: SIDE,
});

// Refuse when the Polymarket price is not fit to price against.
if (data.status !== "ok" || data.fair.prob === null) {
  console.log(`No answer: ${data.status} ${data.failed_checks.join(", ")}`.trim());
  process.exit(0);
}
if (data.game.started) {
  console.log("No answer: the game has started, so the price may be in play.");
  process.exit(0);
}

const fair = data.fair.prob;
const decimal = decimalFromAmerican(AMERICAN);
const breakEven = 1 / decimal;
const ev = fair * decimal - 1;
const kelly = Math.max(0, ev / (decimal - 1));

console.log(`${SIDE} at ${AMERICAN > 0 ? "+" : ""}${AMERICAN}`);
console.log(`Break-even ${(breakEven * 100).toFixed(2)}%, fair ${(fair * 100).toFixed(2)}%`);
console.log(`Edge ${((fair - breakEven) * 100).toFixed(2)} points, EV $${(ev * 100).toFixed(2)} per $100`);
console.log(ev > 0 ? `Stake $${(kelly * KELLY_FRACTION * BANKROLL_USD).toFixed(2)} at ${KELLY_FRACTION} Kelly` : "No bet");

// Buying the same side on Polymarket costs the ask plus the taker fee.
const allIn = data.fee.taker_all_in_ask;
if (allIn !== null) {
  const polymarketEv = fair / allIn - 1;
  console.log(`Polymarket at ${(allIn * 100).toFixed(2)} cents all in: EV $${(polymarketEv * 100).toFixed(2)} per $100`);
  if (polymarketEv > ev) console.log("Buying on Polymarket pays more.");
}
```

```bash theme={null}
npx tsx price-a-bet.ts
```

A price better than `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:

```bash theme={null}
curl -sS \
  -H "Authorization: Bearer $OXINSIDER_API_KEY" \
  'https://api.0xinsider.com/api/v1/fair-price?event_slug=nfl-was-nyg-2026-11-13&market_type=moneyline&outcome_label=Giants&max_spread_c=1&min_book_usd_within_2c=2000'
```

A spread or a total names its `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](https://docs.0xinsider.com/api-reference/endpoint/list-games.md) lists the covered games.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.