Estimate TRX

Estimate the TRX required to buy a given amount of Energy or Bandwidth for a chosen rental duration, using your TronSave API key.

Use this endpoint to calculate how much TRX an order will cost before you place it. Pass the resource amount, rental duration, and a unit price (or a speed tier), and TronSave returns the resolved unit price, the estimated TRX, and how much of the requested resource is currently available.

Endpoint

POST https://api.tronsave.io/v2/order-book/estimate-buy-resource

Rate limit: 15 requests per 1 second.

Headers

Header
Value
Required

Content-Type

application/json

Yes

Request body

Field
Type
Description

resourceAmount*

Number

The number of resources.

unitPrice

String, Number

"FAST", "MEDIUM", "SLOW", or number:

- "FAST": If the market is ready to fill = 100%, FAST = MEDIUM. If the market is ready to fill < 100%, FAST = MEDIUM + 10. If market ready to fill = 0%, FAST = SLOW + 20.

- "MEDIUM": The lowest price for the maximum market fill for this order. If market is ready to fill = 0%, MEDIUM = SLOW + 10.

- "SLOW": The lowest price that can be set for this order.

- If the price is a number, the price unit is equal to SUN.

durationSec

Number

The duration of the bought resource, in seconds. Default 3d.

requester

String

The address of the requester.

receiver

String

The address of the resource receiver.

resourceType

String

"ENERGY" or "BANDWIDTH". Default: "ENERGY".

options

Object

Optional.

options.allowPartialFill

Boolean

Allow the order to be filled partially or not.

options.minResourceDelegateRequiredAmount

Number

The minimum resource amount delegated by a single provider.

* Required.

Request body example

Response

Success

The estimateTrx value is returned in SUN (1 TRX = 1,000,000 SUN).

Errors

Returned when a required field is missing or invalid. The message names the offending field.

Request examples

Next steps

Last updated