获取订单簿 (Order book)

要使用此功能,您必须拥有 API 密钥。请阅读这里以了解如何获取我们的 API 密钥。

通过 API 密钥获取订单簿

GET https://api.tronsave.io/v2/order-book

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

Query Params

Name
Type
Description

address

String

能源接收地址

minDelegateAmount

number

从一个提供者委托的最低能源量。

durationSec

number

订单持续时间(秒)

resourceType

string

“ENERGY”或“BANDWIDTH”,默认: “ENERGY”

{
    "error": false,
    "message": "Success",
    "data": [
        {
            "price": number, // 价格(单位:SUN)
            "availableResourceAmount": number, // 此价格下可用的资源数量
        },
        {}
    ]
}

例子 (Example)

Query Params

Key
Val

address

TFwUFWr3QV376677Z8VWXxGUAMFSrq11111

minDelegateAmount

1000

durationSec

86400

resourceType

BANDWIDTH

Example Code

const GetOrderBook = async (apiKey, receiverAddress) => {
    const url = `${TRONSAVE_API_URL}/v2/order-book?address=${receiverAddress}`
    const data = await fetch(url, {
        headers: {
            'apikey': apiKey
        }
    })
    const response = await data.json()
    /**
     * Example response 
    {
        error: false,
        message: 'Success',
        data: [
            { price: 54, availableResourceAmount: 2403704 },
            { price: 60, availableResourceAmount: 3438832 },
            { price: 61, availableResourceAmount: 4100301 },
            { price: 90, availableResourceAmount: 7082046 },
            { price: 91, availableResourceAmount: 7911978 }
        ]
    }
     */
    return response
}

Last updated