> For the complete documentation index, see [llms.txt](https://developer.barchart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.barchart.com/getting-started/subscription-types/market-depth-order-book.md).

# Market Depth (Order Book)

Subscribe to `DEPTH_PRICE` to receive the current order book and its changes. Openfeed first sends a `marketSnapshot` containing the current `DepthPriceLevel` state.

Openfeed then streams `marketUpdate` messages for added, modified, and deleted price levels. Use these updates to keep a local order book synchronized.

The following messages show December Corn order book updates.

### Market depth message examples

#### Modify a price level

```protobuf
marketUpdate {
  marketId: 1596974561793814014
  transactionTime: 1634158256994980207
  marketSequence: 3197968
  depthPriceLevel {
    levels {
      modifyPriceLevel {
        level: 9
        side: BID
        price: 509250000000
        quantity: 34
        orderCount: 5
      }
    }
  }
}

marketUpdate {
  marketId: 1596974561793814014
  transactionTime: 1634158672038681591
  marketSequence: 3197969
  depthPriceLevel {
    levels {
      modifyPriceLevel {
        level: 4
        side: OFFER
        price: 512000000000
        quantity: 53
        orderCount: 15
      }
    }
  }
}
```

#### Add price levels

```protobuf
marketUpdate {
  marketId: 1596974561793814014
  transactionTime: 1634221610752143733
  marketSequence: 3705745
  depthPriceLevel {
    levels {
      addPriceLevel {
        level: 10
        side: BID
        price: 514000000000
        quantity: 120
        orderCount: 31
      }
    }
    levels {
      addPriceLevel {
        level: 1
        side: OFFER
        price: 516500000000
        quantity: 3
        orderCount: 1
      }
    }
  }
}
```

#### Delete a price level

```protobuf
marketUpdate {
  marketId: 1596974561793814014
  transactionTime: 1634221666379685925
  marketSequence: 3710810
  depthPriceLevel {
    levels {
      deletePriceLevel {
        level: 1
        side: BID
      }
    }
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.barchart.com/getting-started/subscription-types/market-depth-order-book.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
