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

# Get Orderbook

> Retrieve the current orderbook for a market showing all open buy and sell orders

<Tip>
  For real-time orderbook updates, use the [WebSocket API](/developers/websocket-events) instead of polling this endpoint. Subscribe to `subscribe_market_prices` with `marketSlugs`.
</Tip>

## Complementary token prices (deriving the NO book)

This endpoint returns a **single, YES-side book**. The `tokenId` in the response is the market's YES position ID, and `bids`/`asks` are quoted in YES-token terms. The two outcome tokens are complementary — a YES share and a NO share always redeem together for exactly \$1 — so their prices satisfy:

```
price(YES) + price(NO) = 1
```

The book you get back already merges **all** liquidity for the market: native NO orders are converted into their YES-side equivalent before aggregation, using the same identity:

```
NO bid  @ P   ≡   YES ask @ (1 - P)     (someone bidding for NO is offering YES)
NO ask  @ P   ≡   YES bid @ (1 - P)     (someone offering NO is bidding for YES)
```

So you never lose NO liquidity by reading the YES book — it's all there, expressed in YES prices.

### Deriving the NO orderbook

To quote or trade the **NO** token, mirror the returned YES book: flip bids ↔ asks and replace every price `p` with `1 - p` (sizes are unchanged).

| NO book                         | Derived from | Best level                     |
| ------------------------------- | ------------ | ------------------------------ |
| **NO bids** (orders to buy NO)  | YES **asks** | best NO bid = `1 - bestYesAsk` |
| **NO asks** (orders to sell NO) | YES **bids** | best NO ask = `1 - bestYesBid` |

The midpoint and spread carry over directly: `noMidpoint = 1 - yesMidpoint`, and the spread is identical.

<CodeGroup>
  ```typescript TypeScript theme={null}
  type Level = { price: number; size: number };
  type Book = { bids: Level[]; asks: Level[] };

  // Mirror the YES-side book into the NO-side book.
  function deriveNoBook(yes: Book): Book {
    const invert = (l: Level): Level => ({ price: 1 - l.price, size: l.size });
    return {
      bids: yes.asks.map(invert).sort((a, b) => b.price - a.price), // best (highest) first
      asks: yes.bids.map(invert).sort((a, b) => a.price - b.price), // best (lowest) first
    };
  }

  // To SELL NO, hit the best NO bid:  1 - bestYesAsk
  // To BUY  NO, lift the best NO ask: 1 - bestYesBid
  ```

  ```python Python theme={null}
  def derive_no_book(yes: dict) -> dict:
      """Mirror the YES-side book into the NO-side book."""
      invert = lambda l: {"price": 1 - l["price"], "size": l["size"]}
      return {
          "bids": sorted((invert(a) for a in yes["asks"]), key=lambda l: -l["price"]),  # best first
          "asks": sorted((invert(b) for b in yes["bids"]), key=lambda l: l["price"]),   # best first
      }

  # To SELL NO, hit the best NO bid:  1 - best_yes_ask
  # To BUY  NO, lift the best NO ask: 1 - best_yes_bid
  ```
</CodeGroup>

When you then place a NO order, sign it against the NO `tokenId` (`noPositionId` from [Get Market](/api-reference/markets/get-market)) at the derived price — the price inversion only affects how you *read* the book, not how the order is signed.

## Multi-outcome (NegRisk) markets

In a [NegRisk](/user-guide/negrisk-overview) multi-outcome market, **each outcome is its own market** with its own slug, its own YES/NO tokens, and its own orderbook. Fetch each outcome's book by its slug and derive that outcome's NO book with the same inversion above — there is no single cross-outcome book to invert.

What links the outcomes is a soft pricing constraint, not a shared book: across the *N* outcomes, the YES prices tend toward summing to 1 (exactly one outcome resolves YES), and all the NO contracts are linked for [share conversion](/user-guide/converting-shares). To assemble a full picture of a multi-outcome market, request the orderbook for each outcome slug and mirror each one independently.


## OpenAPI

````yaml GET /markets/{slug}/orderbook
openapi: 3.0.0
info:
  title: Limitless Exchange API
  description: >-
    Production-ready REST API for prediction market trading, portfolio
    management, and market data on Limitless Exchange (Base L2).
  version: '1.0'
  contact:
    name: API Support
    url: https://limitless.exchange
    email: help@limitless.network
servers:
  - url: https://api.limitless.exchange
    description: Production API
security: []
tags:
  - name: Authentication
    description: User authentication and session management
  - name: Markets
    description: Browse, search, and analyze prediction markets
  - name: Market Navigation
    description: Navigation tree, market pages, and property filters
  - name: Trading
    description: Create, manage, and cancel orders
  - name: Portfolio
    description: Position tracking, trade history, and performance
  - name: API Tokens
    description: Scoped API token management for partner integrations
  - name: Partner Accounts
    description: Sub-account creation and allowance recovery for partner integrations
  - name: System
    description: Public API state and availability information
paths:
  /markets/{slug}/orderbook:
    get:
      tags:
        - Trading
      summary: Get Orderbook
      description: >-
        Retrieve the current orderbook for a market showing all open buy and
        sell orders
      operationId: MarketOrderbookController_getOrderbook
      parameters:
        - name: slug
          required: true
          in: path
          description: Market slug identifier
          schema:
            example: presidential-election-2024
      responses:
        '200':
          description: Current orderbook with bids and asks
          content:
            application/json:
              schema:
                type: object
                properties:
                  adjustedMidpoint:
                    type: number
                    example: 0.75
                  asks:
                    type: array
                    items:
                      type: object
                      properties:
                        price:
                          type: number
                          example: 0.76
                        size:
                          type: number
                          example: 100
                  bids:
                    type: array
                    items:
                      type: object
                      properties:
                        price:
                          type: number
                          example: 0.74
                        size:
                          type: number
                          example: 150
                  lastTradePrice:
                    type: number
                    example: 0.75
                  maxSpread:
                    type: number
                    example: 0.05
                  minSize:
                    example: 1
                    type: number
                  tokenId:
                    type: string
                    example: >-
                      19633204485790857949828516737993423758628930235371629943999544859324645414627
        '400':
          description: Market does not support orderbook (AMM market)
        '404':
          description: Market not found

````