Get Order Book

To using this feature you must have API key. Read at here to know how to get our API key

Get order book by API key

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

Query Parameters

{
    price:number, // price in sun
    available_energy_amount:number, // available resource amount at this price
}[]

Example

{
  "apikey": <YOUR_API_KEY>
}

Example Code

const GetOrderBook = async (api_key, receiver_address) => {
    const url = `https://api.tronsave.io/v0/order-book?address=${receiver_address}`
    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
}

Last updated