> For the complete documentation index, see [llms.txt](https://docs.prophetmarket.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prophetmarket.ai/get-started/api/prices-and-order-book.md).

# Prices and Order Book

Prophet uses a Central Limit Order Book (CLOB). Prices are determined by resting limit orders, not an automated market maker formula.

## Order Book

The `orderBook` query returns the current resting bids and asks for a market.

```graphql
query Book($marketId: String!) {
  orderBook(marketId: $marketId) {
    bids { priceBps amountCents orderCount }
    asks { priceBps amountCents orderCount }
    spreadBps
    midpointBps
  }
}
```

* **`bids` / `asks`:** Arrays of price levels, aggregated by `priceBps`.
* **`amountCents`:** The total liquidity available at that price level.
* **`orderCount`:** The number of resting orders at that level.

{% hint style="warning" %}
**Prices do not sum to 10000**

Because of the spread, the `yesPriceBps` and `noPriceBps` (or best bids/asks) will not sum to exactly 10000. Do not calculate one side by subtracting the other from 10000.
{% endhint %}

## Trades

The `trades` connection lists historical executions.

```graphql
query Trades($marketId: String!) {
  trades(marketId: $marketId, first: 10) {
    edges {
      node {
        id
        priceBps
        amountCents
        side
        createdAt
        isMaker
      }
    }
  }
}
```

The `isMaker` flag indicates whether the trade provided liquidity (true) or took liquidity (false).

## Price History

The `priceHistory` query returns a time series of price movements.

```graphql
query History($marketId: String!, $since: Time!) {
  priceHistory(marketId: $marketId, since: $since) {
    timestamp
    priceBps
  }
}
```

The `since` argument is required and must be an ISO 8601 UTC timestamp.

## Real-time Updates

For live applications, do not poll these endpoints. Use the `orderBookUpdated` and `tradeExecuted` WebSocket [subscriptions](broken://pages/720f2647cf95b16a4a54f7485457e3f26764248a) instead.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.prophetmarket.ai/get-started/api/prices-and-order-book.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
