# Get Order Book

## Orderbook

<mark style="color:blue;">`GET`</mark> `https://api.sfox.com/v1/markets/orderbook/:pair`

Get the blended L2 orderbook data of our connected exchanges, including the top bids and asks and the location of those bids and asks

#### Path Parameters

| Name | Type   | Description                                                                                                  |
| ---- | ------ | ------------------------------------------------------------------------------------------------------------ |
| pair | string | <p>The pair or product to trade in the format: (i.e. "btcusd", "ethbtc", "usdteth")<br>Default: "btcusd"</p> |

{% tabs %}
{% tab title="200 " %}

```
{
  "bids": [
    [
      9458.12,
      1e-08,
      "gemini"
    ],
    [
      9456,
      1,
      "itbit"
    ],
    [
      9453,
      0.73553115,
      "itbit"
    ],
    // truncated
  "asks": [
    [
      9455.55,
      2.03782954,
      "market1"
    ],
    [
      9455.56,
      0.9908,
      "market1"
    ],
    [
      9455.59,
      0.60321264,
      "market1"
    ],
    // truncated
  "market_making": {
    "bids": [
      [
        9447.34,
        2,
        "bitstamp"
      ],
      [
        9452.01,
        0.60321264,
        "market1"
      ],
      [
        9452.31,
        0.47488688,
        "bittrex"
      ],
      [
        9456,
        1,
        "itbit"
      ],
      [
        9458.12,
        1e-08,
        "gemini"
      ]
    ],
    "asks": [
      [
        9458.13,
        2.07196048,
        "gemini"
      ],
      [
        9457.75,
        0.14748797,
        "itbit"
      ],
      [
        9456,
        0.1686167,
        "bittrex"
      ],
      [
        9455.68,
        0.742406,
        "bitstamp"
      ],
      [
        9455.55,
        2.03782954,
        "market1"
      ]
    ]
  },
  "timestamps": {
    "gemini": [
      1572903458537,
      1572903458538
    ],
    "bitstamp": [
      1572903458199,
      1572903458199
    ],
    "itbit": [
      1572903458414,
      1572903458416
    ],
    "bittrex": [
      1572903458517,
      1572903458517
    ],
    "market1": [
      1572903458071,
      1572903458071
    ]
  },
  "lastupdated": 1572903458756,
  "pair": "btcusd",
  "currency": "usd",
  "lastpublished": 1572903458798\}
```

{% endtab %}
{% endtabs %}

### Response Body

<table><thead><tr><th width="216">Key</th><th width="800">Description</th></tr></thead><tbody><tr><td><code>pair</code></td><td>The trading pair</td></tr><tr><td><code>currency</code></td><td>The quote currency</td></tr><tr><td><code>asks</code></td><td>List of asks, size, and exchange</td></tr><tr><td><code>bids</code></td><td>List of the bids, size, and exchange</td></tr><tr><td><code>market_making</code></td><td>List of the best bid and ask on each exchange</td></tr><tr><td><code>timestamp</code></td><td>A list of exchanges and the latest timestamps of the orderbook</td></tr><tr><td><code>lastupdated</code></td><td>Last update of the blended orderbook</td></tr><tr><td><code>lastpublished</code></td><td>Last time an orderbook update was published</td></tr></tbody></table>

### Example Request

{% tabs %}
{% tab title="Shell" %}

```bash
curl 'https://api.sfox.com/v1/markets/orderbook/btcusd'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/markets/orderbook/btcusd',
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/markets/orderbook/btcusd",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.sfox.com/rest-api/market-data/get-order-book.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
