Create order

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

Create a new order by API key

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

Create a new buy energy order by API key

Rate limit: 15 requests per 1 second

Headers

Name
Type
Description

apikey*

String

Tronsave api key that present for internal account

Request Body

Field
Type
Description

resourceType

String

"ENERGY" or "BANDWIDTH", default: ENERGY

unitPrice

Number, String

"FAST", "MEDIUM", "SLOW", or a number. Default: "MEDIUM"

-"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

resourceAmount*

Number

The number of resources.

receiver*

String

Resource receiving address

durationSec

Number

The duration of the bought resource, time unit, is in seconds. Default: 259200 (3 days).

sponsor

String

sponsor code

options

Object

optional

options.allowPartialFill

Boolean

Allow the order to be filled partially or not

options.onlyCreateWhenFulfilled

Boolean

[true]=> order only creates when it can be fulfilled

[false]=> order will create even if it can not be fulfilled

Default value: false

options.maxPriceAccepted

Number

Only create order when the estimate price less than this value.

options.preventDuplicateIncompleteOrders

Boolean

[true]=> Only create if no uncompleted order with the same parameters exists.

[false]=> Always create a new order, regardless of existing unfinished ones.

Default value: false

options.minResourceDelegateRequiredAmount

Number

The minimum resource amount delegated by a single provider.

Return the order ID if successful

Example

Example Code

Get detailed orders here

Last updated