# 获取订单簿 (Order book)

要使用此功能，您必须拥有 API 密钥。请阅读[**这里**](/chinese/developer/get-api-key.md)以了解如何获取我们的 API 密钥。

## 通过 API 密钥获取订单簿

<mark style="color:blue;">`GET`</mark> `https://api.tronsave.io/v0/order-book`

速率限制 (Rate limit): 每1秒15个请求。

#### Query Parameters

<table><thead><tr><th width="215">Name</th><th width="121">Type</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>String</td><td>能源接收地址</td></tr><tr><td>min_delegate_amount</td><td>number</td><td>从一个提供者委托的最低能源量。</td></tr><tr><td>duration_sec</td><td>number</td><td>订单持续时间（秒）</td></tr></tbody></table>

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

```javascript
{
    price: number, // 太阳（sun）中的价格
    available_energy_amount: number, // 在此价格下的可用资源数量
}[]
```

{% endtab %}
{% endtabs %}

**例子&#x20;*****(Example)***

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

```javascript
{
  "apikey": <YOUR_API_KEY>
}
```

{% endtab %}

{% tab title="Success Response" %}

```javascript
[
    {
        "price": -1,
        "available_energy_amount": 177451
    },
    {
        "price": 30,
        "available_energy_amount": 331088
    },
    {
        "price": 35,
        "available_energy_amount": 2841948
    },
]
```

{% endtab %}
{% endtabs %}

*Example Code*

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

```javascript
const GetOrderBook = async (api_key, receiver_address) => {
    const url = `https://api.tronsave.io/v0/order-book?address=${receiver_address}&min_delegate_amount=100000&duration_sec=86400`
    const data = await fetch(url, {
        headers: {
            'apikey': api_key
        }
    })
    const response = await data.json()
    /**
     * Example response 
     * @link https://docs.tronsave.io/buy-energy-on-telegram/using-api-key-to/get-order-book
      [
        {
            "price": -1,
            "available_energy_amount": 177451
        },
        {
            "price": 30,
            "available_energy_amount": 331088
        },
        {
            "price": 35,
            "available_energy_amount": 2841948
        },
    ]
     */
    return response
}
```

{% endtab %}

{% tab title="cURL" %}

```powershell
curl 'https://api.tronsave.io/v0/order-book?address={{receiver_address}}&min_delegate_amount=100000&duration_sec=86400' \
--header 'apikey: {{apikey}}'
```

{% 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.tronsave.io/chinese/developer/rest-api-v0/buy-on-rest-api/use-api-key/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.
