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

# Slippage

> How odds slippage works when filling orders on SX Bet.

## Overview

When you fill an order on SX Bet, you set a `desiredOdds` and an `oddsSlippage`. Together, these control the worst **weighted average odds** you're willing to accept.

* `oddsSlippage = 0` — only fill at `desiredOdds` or better
* `oddsSlippage = 3` — accept up to 3% worse than `desiredOdds` on a weighted average basis

The `oddsSlippage` field is an integer from 0 to 100 representing a percentage.

## Why slippage exists

Between the moment you submit a fill and the moment the exchange matches it (after the [betting delay](/developers/filling-orders#how-filling-works)), the orderbook can change:

* The order you targeted may get **cancelled** by the maker
* Another taker may **fill** the order before you
* The maker may **update** their odds by cancelling and reposting
* For in-play markets, odds shift constantly as the game progresses

Without slippage, any of these changes would cause your fill to fail entirely. With a small slippage tolerance, your bet can still go through at slightly worse odds rather than failing outright.

## How slippage is calculated

Slippage applies to the **weighted average odds** across all orders your fill matches — not to each individual order.

The exchange checks:

```
weighted_average_odds >= desiredOdds * (1 - oddsSlippage / 100)
```

This means individual orders in your fill can have odds worse than your `desiredOdds`, as long as the overall weighted average stays within your slippage tolerance.

### Example 1: Filling across multiple price levels

You submit a fill for **\$10,000** at `desiredOdds` of **2.10** with **5% slippage**.

The orderbook has taker liquidity at these levels:

| Taker odds | Available liquidity |
| ---------- | ------------------- |
| 2.10       | \$2,000             |
| 2.09       | \$3,000             |
| 2.07       | \$15,000            |

The exchange fills your \$10,000 across all three levels:

| Taker odds | Amount filled | Contribution to average |
| ---------- | ------------- | ----------------------- |
| 2.10       | \$2,000       | $2,000 × 2.10 = $4,200  |
| 2.09       | \$3,000       | $3,000 × 2.09 = $6,270  |
| 2.07       | \$5,000       | $5,000 × 2.07 = $10,350 |

**Weighted average odds** = ($4,200 + $6,270 + $10,350) / $10,000 = **2.082**

Your minimum acceptable odds = `2.10 * (1 - 0.05) = 1.995`. Since 2.082 > 1.995, the fill succeeds — even though some of the liquidity was at 2.07.

### Example 2: Slippage protects you from filling at bad odds

Slippage is based on your **weighted average** across all matched orders. If the orderbook is mostly stale or far off your target price, the weighted average will fall below your threshold and the fill will fail — protecting you from getting a bad price.

You submit a fill for **\$50** at `desiredOdds` of **2.30** with **3% slippage**.

The orderbook has:

| Taker odds | Available liquidity |
| ---------- | ------------------- |
| 2.30       | \$10                |
| 2.00       | \$40                |

Your minimum acceptable odds = `2.30 * (1 - 0.03) = 2.231`.

The exchange would need to fill across both levels:

| Taker odds | Amount filled | Contribution to average |
| ---------- | ------------- | ----------------------- |
| 2.30       | \$10          | $10 × 2.30 = $23.00     |
| 2.00       | \$40          | $40 × 2.00 = $80.00     |

**Weighted average odds** = ($23.00 + $80.00) / \$50 = **2.06**

Since 2.06 \< 2.231, the fill **fails**. The 2.00 liquidity drags the weighted average well below your threshold, so you receive an `ODDS_STALE` error rather than being filled at a price far from what you intended.

## Choosing a slippage value

| Scenario              | Recommended slippage | Reasoning                                                                 |
| --------------------- | -------------------- | ------------------------------------------------------------------------- |
| Pre-game markets      | `0`                  | Odds are stable; you want exactly what you see                            |
| Pre-game, large fills | `1`–`2`              | Slight tolerance for orders getting taken between submission and matching |
| In-play markets       | `3`–`5`              | Odds shift constantly; some tolerance prevents repeated failures          |
| Fast-moving in-play   | `5`–`10`             | Prioritize execution over price precision                                 |

<Warning>Higher slippage means you may get filled at worse odds. Only increase slippage when execution speed matters more than getting the exact price.</Warning>

## Error: `ODDS_STALE`

If the exchange can't find any orders within your slippage tolerance, it returns an `ODDS_STALE` error. This means:

* The orders that existed when you checked have been filled or cancelled
* The remaining liquidity is at odds worse than your `desiredOdds` plus slippage allows

## Related

<CardGroup cols={2}>
  <Card title="Filling Orders →" icon="hand-pointer" href="/developers/filling-orders">
    Full guide to filling orders as a taker.
  </Card>

  <Card title="POST /orders/fill/v2 →" icon="paper-plane" href="/api-reference/post-fill-order">
    Full API reference for the fill endpoint.
  </Card>

  <Card title="Odds Formats →" icon="calculator" href="/developers/odds-formats">
    Converting between implied, American, and decimal odds.
  </Card>

  <Card title="Navigating the Orderbook →" icon="book-open" href="/developers/navigating-the-orderbook">
    Reading orderbook depth and finding the best prices.
  </Card>
</CardGroup>
