Nest Calculate Rebalance logo

Catalog action Utility

Calculate optimal vault rebalancing based on APY-weighted allocation strategy. Takes current balances and vault APYs as input, outputs withdrawals and deposits needed. Ideal for: automated rebalancing, yield optimization, portfolio management workflows.

At a Glance

FieldValue
Action IDnest-calculate-rebalance
CategoryUtility
ConnectorNot required
Requires gasNo
Funds movementNone declared
Tagsdefi, plume, nest, rebalancing, strategy, utility, calculation

Payload Schema

FieldTypeRequiredDescription
balancesarrayYesToken balances from nest-detect-balance output.
vaultApysarrayYesVault APY data from nest-get-vault-apys output.
minApyDifferentialnumberNoMinimum APY differential per withdrawal to trigger rebalancing (default: 0.01 = 1%).
maxAllocationPercentnumberNoMaximum allocation per vault as decimal (default: 0.50 = 50%).
minAllocationPercentnumberNoMinimum allocation per vault to include (default: 0.05 = 5%).
minRebalanceValuePusdnumberNoMinimum pUSD value of a withdrawal/deposit to execute (default: 10).
circuitBreakerThresholdnumberNoMax allowed ratio of |apy7d - apy30d| / |apy30d| before excluding a vault (default: 2.0).

Result Schema

FieldTypeRequiredDescription
needsRebalancebooleanYesWhether any rebalancing is needed.
hasWithdrawalsbooleanYesWhether any withdrawals are needed.
withdrawalsarrayYesList of withdrawal operations needed.
depositsarrayYesList of deposit operations needed.
currentAllocationobjectNoCurrent allocation breakdown (symbol -> percentage).
targetAllocationobjectNoTarget allocation (symbol -> percentage).
eligibleVaultsarrayNoVaults that passed guard rails.
excludedVaultsarrayNoVaults excluded with reasons.
retryArrayarrayYesArray of 50 zeros for retry polling loop (for-each, max ~12.5h). $item is unused.
summarystringNoHuman-readable summary of the rebalancing decision.

Examples

json
{ "type": "nest-calculate-rebalance", "payload": { "balances": [], "vaultApys": [] }, "children": []}

Payload fields can use workflow expressions such as {{$trigger.body.amount}}, {{$nodes.fetch.result.price}}, and {{$props.asset}} when the value should come from a trigger, prior node, or reusable workflow prop.

Ask a question... ⌘I