How to settle fancy bets from a result API
Settling fancy markets by hand is slow and error-prone. With the Fancy Odds result feed every finished session arrives as a number (the runs, wickets or total it settled at), so your platform can settle each bet the moment a market ends. This guide covers the result entries, the arithmetic and the cases that catch people out.
Updated 2026-11-17
Three ways results reach you
- Pushed on your live stream as a
resultmessage, seconds after the market settles. - Listed in order by
GET /v1/results?since=, so a server that was down catches up without gaps. - Looked up one at a time:
GET /v1/markets/{id}/resultor every market of a match withGET /v1/events/{id}/results.
What a fancy result looks like
Line and range markets settle to a number in result; markets with a winner carry winner instead; a void carries neither.
{
"seq": 17494, "action": "SETTLED", "sport": "cricket",
"market": { "id": "mk_juc56fmwfmqx7gag", "name": "10 over run PAK", "type": "fancy" },
"result": 64,
"settledAt": "2026-11-09T05:12:40Z"
}The four actions
| Action | Meaning | What your platform does |
|---|---|---|
| SETTLED | The market's first result | Settle its bets |
| CORRECTED | The earlier result was wrong | Undo the earlier settlement, settle to the new one |
| VOIDED | Cancelled, or corrected to void | Refund stakes |
| UNSETTLED | The result was withdrawn | Undo and hold; a new result will follow |
A market can have several entries over time. The one with the highest seq is current.
Settling a line or range bet
// bet: { side: 'yes' | 'no', line, rate, stake, width? } (width only for Khado)
function settle(bet, result) {
if (bet.width) { // Khado: Yes only
const hit = result >= bet.line && result <= bet.line + bet.width - 1
return hit ? bet.stake * bet.rate / 100 : -bet.stake
}
const yesWins = result >= bet.line
if (bet.side === 'yes') return yesWins ? bet.stake * bet.rate / 100 : -bet.stake
return yesWins ? -bet.stake * bet.rate / 100 : bet.stake
}Making it safe to run twice
Store, per market, the seq you last applied. Apply an entry only if its seq is higher, and record the amount you paid each bet, so a correction can reverse exactly that amount. Then replaying the same results, after a restart or a reconnect, changes nothing.
async function onResult(r) {
const last = await db.lastSeq(r.market.id)
if (last !== null && r.seq <= last) return // already applied
await db.tx(async (tx) => {
await tx.reverseSettlement(r.market.id) // no-op the first time
if (r.action === 'SETTLED' || r.action === 'CORRECTED') {
for (const bet of await tx.bets(r.market.id))
await tx.pay(bet, r.result ?? null, r.winner ?? null)
} else if (r.action === 'VOIDED') {
await tx.refundAll(r.market.id)
} // UNSETTLED: hold
await tx.saveSeq(r.market.id, r.seq)
})
}Catching up after downtime
Keep the next value from each /v1/results call and pass it as since next time; while more is true, call again at once. Results are kept for 7 days and guaranteed for at least 48 hours, so collect them well within that window.
Common questions
How fast do fancy results arrive?
On the live stream, seconds after the market is settled. Results are never delayed, even on plans that receive delayed prices.
What if a result is wrong?
A CORRECTED entry follows with the right number. Undo the earlier settlement and settle again; the highest seq is always current.
Can I settle a single market on demand?
Yes: GET /v1/markets/{id}/result returns its current result, or PENDING if there is none yet.