Create Auto-Buy Rule
tronsave_create_auto_buy_settingCreate a rule that automatically buys resourceAmount for receiver whenever its remaining resource falls below thresholdResourceAmount, paying up to unitPrice SUN per unit from the TronSave internal balance.
Instructions
Create a rule that automatically buys resourceAmount for receiver whenever its remaining resource falls below thresholdResourceAmount, paying up to unitPrice SUN per unit from the TronSave internal balance. Side effect: SPENDS internal TRX every time the rule fires until a budget/order limit or endActiveAt stops it; not idempotent (each call adds a rule). Confirm receiver, amounts, price cap and limits with the user first; prefer setting limitBudgetInSun. Requires a wallet signature identity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| receiver | Yes | TRON base58 address that receives each delegation. | |
| unitPrice | Yes | Maximum unit price in SUN, as a decimal string. | |
| durationSec | Yes | Delegation duration of each purchase, in seconds. | |
| endActiveAt | No | Optional Unix time in seconds when the rule stops. | |
| resourceType | Yes | ENERGY or BANDWIDTH. | |
| startActiveAt | No | Optional Unix time in seconds when the rule starts. | |
| resourceAmount | Yes | Resource units bought each time the rule fires. | |
| limitBudgetInSun | No | Optional total budget cap in SUN (decimal string); must be greater than 10000000 (10 TRX). | |
| limitInOrderCount | No | Optional cap on the number of orders. | |
| thresholdResourceAmount | Yes | Rule fires when the receiver's remaining resource drops below this many units (TronSave requires at least 100000). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| message | No | ||
| success | No |