Create order
Last updated
Last updated
To use this feature, you must have the API key. Read to view how to get our API key
POST
https://api.tronsave.io/v2/buy-resource
Create a new buy energy order by
Rate limit: 15 requests per 1 second
apikey*
String
Tronsave api key that present for internal account
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 energy amount delegated by a single provider.
Return the order ID if successful
Example
Example Code
Get detailed orders