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

# Orderbook

> Understanding orderbooks and price data in prediction markets

## What is an Orderbook?

The **Orderbook** (order book) shows current buy and sell orders for a market. Each market has separate orderbooks for **YES** and **NO** outcomes, allowing you to visualize market depth and liquidity available at different price levels.

### Primary Source of Price Data

In addition to providing the complete order book, the orderbook endpoint is **the best and most reliable source for obtaining market option price data**. It offers:

* **Updated market prices**: `market_price_yes` and `market_price_no` represent the most recent market prices;
* **Last traded price**: `last_price` in each orderbook shows the last price at which a transaction was executed;
* **Implied probability**: The `chance` field indicates the percentage probability implied by the market;
* **Spread**: The difference between the best buy (*bid*) and sell (*ask*) price;
* **Market depth**: Complete visualization of pending orders at different price levels;

This data is essential for making informed trading decisions and understanding current market sentiment.

## Orderbook Structure

Each orderbook contains:

* **Bids** (buy orders): Orders from buyers willing to buy at a specific price, ordered from highest to lowest price;
* **Asks** (sell orders): Orders from sellers willing to sell at a specific price, ordered from lowest to highest price;
* **Spread**: Difference between the best sell price (ask) and the best buy price (bid);
* **Last Price**: Last price at which a transaction was executed.

### Market Price Data

In addition to individual orderbooks for YES and NO, the response includes aggregated price data:

* **`market_price_yes`**: Current market price for the YES option (in ticks);
* **`market_price_no`**: Current market price for the NO option (in ticks);
* **`chance`**: Percentage probability implied by the market (based on market prices);
* **`volume`**: Total volume traded in the market (in ticks);
* **`liquidity`**: Total liquidity available in the market (in ticks).

## Get Orderbook

Retrieves the orderbook snapshot for all markets in an event. This is the **recommended source** for obtaining updated and accurate price data for market options.

```json theme={null}
{
  "95f88394-4f4d-4489-99dc-8cef9f7682ee": {
    "yes_orderbook": {
      "outcome": "YES",
      "bids": [
        {
          "price_ticks": 39,
          "quantity": 93,
          "order_count": 1
        },
        {
          "price_ticks": 37,
          "quantity": 109,
          "order_count": 1
        },
        {
          "price_ticks": 28,
          "quantity": 18,
          "order_count": 1
        },
        {
          "price_ticks": 26,
          "quantity": 31,
          "order_count": 1
        },
        {
          "price_ticks": 24,
          "quantity": 31,
          "order_count": 1
        },
        {
          "price_ticks": 22,
          "quantity": 154,
          "order_count": 1
        },
        {
          "price_ticks": 20,
          "quantity": 23,
          "order_count": 1
        }
      ],
      "asks": [
        {
          "price_ticks": 57,
          "quantity": 58,
          "order_count": 1
        },
        {
          "price_ticks": 55,
          "quantity": 10,
          "order_count": 1
        },
        {
          "price_ticks": 53,
          "quantity": 95,
          "order_count": 1
        },
        {
          "price_ticks": 51,
          "quantity": 52,
          "order_count": 1
        },
        {
          "price_ticks": 49,
          "quantity": 112,
          "order_count": 1
        },
        {
          "price_ticks": 40,
          "quantity": 47,
          "order_count": 1
        }
      ],
      "spread": 1,
      "last_price": 40
    },
    "no_orderbook": {
      "outcome": "NO",
      "bids": [
        {
          "price_ticks": 60,
          "quantity": 47,
          "order_count": 1
        },
        {
          "price_ticks": 51,
          "quantity": 112,
          "order_count": 1
        },
        {
          "price_ticks": 49,
          "quantity": 52,
          "order_count": 1
        },
        {
          "price_ticks": 47,
          "quantity": 95,
          "order_count": 1
        },
        {
          "price_ticks": 45,
          "quantity": 10,
          "order_count": 1
        },
        {
          "price_ticks": 43,
          "quantity": 58,
          "order_count": 1
        }
      ],
      "asks": [
        {
          "price_ticks": 80,
          "quantity": 23,
          "order_count": 1
        },
        {
          "price_ticks": 78,
          "quantity": 154,
          "order_count": 1
        },
        {
          "price_ticks": 76,
          "quantity": 31,
          "order_count": 1
        },
        {
          "price_ticks": 74,
          "quantity": 31,
          "order_count": 1
        },
        {
          "price_ticks": 72,
          "quantity": 18,
          "order_count": 1
        },
        {
          "price_ticks": 63,
          "quantity": 109,
          "order_count": 1
        },
        {
          "price_ticks": 61,
          "quantity": 93,
          "order_count": 1
        }
      ],
      "spread": 1,
      "last_price": 60
    },
    "market_price_yes": 40,
    "market_price_no": 61,
    "chance": 39,
    "volume": 29500,
    "liquidity": 32051
  }
}
```

## API Endpoints

### Get Event Orderbook

Retrieves the orderbook snapshot for all markets in a specific event. Returns an object where each key is a market ID and the value contains complete orderbooks for YES and NO, plus aggregated price data.

Use this endpoint when you want to get orderbooks for all markets in an event.

[Detailed documentation + playground](/playground/data/get-event-orderbook-snapshot)

### Get Market Orderbook

Retrieves the orderbook snapshot for a specific market. Returns complete orderbooks for YES and NO, plus aggregated market price data.

Use this endpoint when you need to get the orderbook for a specific market and already have the market ID.

[Detailed documentation + playground](/playground/data/get-market-orderbook-snapshot)

## Use Cases

* **Get Market Prices**: Use `market_price_yes` and `market_price_no` to get the most updated prices for market options;
* **Price Discovery**: Analyze the complete order book to understand price distribution and identify opportunities;
* **Liquidity Analysis**: Check market depth (quantity available at each price level) before executing large orders;
* **Spread Monitoring**: Track the spread between bids and asks to assess transaction costs;
* **Market Making**: Provide liquidity by placing limit orders on both sides of the orderbook;
* **Arbitrage**: Find price differences between YES and NO outcomes that don't sum to 100 ticks;
* **Sentiment Analysis**: Use the `chance` field and order distribution to understand the probability implied by the market;
* **Order Execution**: Use orderbook data to determine the best price and strategy when executing an order.
