# Tutorial: Order book

### What is an Order book?

An orderbook is a collection of Buy and Sell orders that were originally placed using a Maker execution type.

### Condition

If Algodex supports an asset then a unique orderbook exists for that asset.

### Walkthrough

1. A user is interested in the price of a particular asset so they fetch the Algodex orderbook related to that asset.
2. The Algodex order book contains the most recent unfulfilled Buy and Sell order's related to that asset.
3. An order remains in the order book until someone places an order using a Taker execution type.

#### Fetch Order book \[<mark style="color:red;">JavaScript</mark>]

When using `api.placeOrder()` if an orderbook is not provided we fetch the orderbook based off the asset id specified in the order object. However, it is possible to fetch the orderbook ahead of time, as shown in the example below.

```
order = {
  'asset': {
    'id': 15322902,
    'decimals': 6,
  },
  'address': 'WYWRYK42XADLY3O62N52BOLT27DMPRA3WNBT2OBRT65N6OEZQWD4OSH6PI',
  'price': 3.22,
  'amount': 1,
  'execution': 'taker',
  'type': 'buy',
}


const res = await api.http.dexd.fetchAssetOrders(order.asset.id)
const orderbook = api.http.dexd.mapToAllEscrowOrders({
  buy: res.buyASAOrdersInEscrow,
  sell: res.sellASAOrdersInEscrow,
 })

await api.placeOrder(order, {orderbook})
```


---

# 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.algodex.com/developer-tools/algodex-sdk-v2/tutorial-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.
