> For the complete documentation index, see [llms.txt](https://docs.origami.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origami.tech/function/functions/orderbook.md).

# Orderbook

## <mark style="color:purple;">`orderbook`</mark>(*symbol*: *Optional*\[*str*], *exchange*: *Optional*\[*str*|*int*]) -> \[[*<mark style="color:blue;">Orderbook</mark>*](/function/structures/orderbook.md)]

Returns orderbook in [Orderbook](/function/structures/orderbook.md) structure.

**Parameters:**

**symbol :&#x20;*****str, default 'base-counter'***

Use token symbols in the 'symbol-symbol' format. Example: <mark style="color:red;">`'ETH-USDT'`</mark>,`'`[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base.md)<mark style="color:red;">`-USDT'`</mark>,<mark style="color:red;">`’ETH-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter.md)<mark style="color:red;">`’`</mark>. If <mark style="color:red;">`symbol`</mark> is empty - uses current symbol for bot. Shortcuts [`base`](/function/shortcuts/base.md) and [`counter`](/function/shortcuts/counter.md) could be used.

**exchange : int|str, default bot's exchange**

If <mark style="color:red;">`symbol`</mark> is empty - uses current symbol for bot. (ex.: <mark style="color:red;">`'ETH-USDT'`</mark>, [<mark style="color:blue;">`base`</mark>](/function/shortcuts/base.md)<mark style="color:red;">`-USDT`</mark>,<mark style="color:red;">`’ETH-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter.md)<mark style="color:red;">`’`</mark>)

If <mark style="color:red;">`exchange`</mark> is empty - uses current exchange for bot’s account

{% hint style="warning" %} <mark style="color:red;">`symbol`</mark> must be specified for usage in <mark style="color:red;">`update_balance_formula`</mark> inside group
{% endhint %}

{% hint style="warning" %} <mark style="color:red;">`exchange`</mark> must be specified for usage in <mark style="color:red;">`update_balance_formula`</mark> inside group
{% endhint %}

<details>

<summary>Example:</summary>

<mark style="color:red;">`orderbook().bid[0].price`</mark> → 0.65…

<mark style="color:red;">`orderbook('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base.md)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter.md)<mark style="color:red;">`').bid[0].price`</mark> → 0.65…

<mark style="color:red;">`orderbook().bid[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(’`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base.md)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter.md)<mark style="color:red;">`’,'mexc').bid[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(’ETH-USDT’).bid[0].amount`</mark> → 3000

<mark style="color:red;">`orderbook('BTC-ETH', exchange='gateio').bid[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(exchange=8).ask[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(exchange='mexc').ask[0].amount`</mark> → 100.23

</details>


---

# 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.origami.tech/function/functions/orderbook.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.
