Get Order Book

To use this feature, you must have the API key. Read here to view how to get our API key

Get the order book by API key

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

Rate limit: 15 requests per 1 second

Query Parameters

Name
Type
Description

address

String

energy reciver address

minDelegateAmount

Number

The minimum amount of energy delegated from one provider.

durationSec

Number

order duration in seconds

resourceType

String

"ENERGY" or "BANDWIDTH", default: ENERGY

{
    "error": false,
    "message": "Success",
    "data": [
        {
            price: number, // price in SUN
            availableResourceAmount: number, // available resource amount at this price
        },
        {}
    ]
}

Example

Query Params

Key
Value

address

TFwUFWr3QV376677Z8VWXxGUAMFSrq11111

resourceType

BANDWIDTH

minDelegateAmount

1000

durationSec

86400

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