tenet:~/docs/strategies

Strategies

The four kinds of rules, their fields, and what each status means.

A strategy is a rule that lives in your vault: when this holds, do that. TENET has four kinds. You can create them yourself, the agent creates them for you, or you can take one from the marketplace. Rules cannot be edited: you cancel one and create it again.

#The four kinds

#Buy on a schedule

Buys tokenOut with a fixed amount of tokenIn every intervalSeconds. It can be limited to buy only below a price, to stop after a number of buys, or to expire after some days.

Good for building a position gradually without trying to guess the bottom.

#Stop-loss

Sells when the oracle price falls to the level you set. It runs once and is then finished. Leave the amount empty to sell everything.

Good for capping a loss while you are away.

#Take-profit

Sells when the oracle price rises to your target. It also runs once. Example: “sell half my NVDA at $250”.

Good for locking in a gain without watching the chart.

#Rebalance

Keeps a stock at a share of the pair, for example 60% SPY and 40% USDG, with an allowed drift of 5 points. It trades only when the mix leaves the band, at most once per interval, and never more than the maximum dollar amount per trade you set. While the mix is in the band it trades nothing.

Good for keeping your risk where you put it.

#Closing a position

A stop-loss or take-profit with no amount sells the whole position. The contract sells it in chunks: each chunk is no bigger than the run limit, what is left of the day's limit, and the protocol's own per-trade limit (currently $250). A remainder below $1 is treated as dust and the rule finishes.

#The fields

FieldMeaning
kinddca, stopLoss, takeProfit or rebalance
tokenInThe token it gives. A symbol such as USDG, ETH or NVDA. The full list is in /v1/config.
tokenOutThe token it receives.
amountA number as a string. Buy on a schedule: how much to spend each time. Stop-loss and take-profit: how much to sell (empty means all). Rebalance: the most USD per trade.
triggerPriceUsdStop-loss and take-profit: the price that fires it. Buy on a schedule: only buy below this price.
intervalSecondsBuy on a schedule and rebalance: the pause between runs.
targetPercentRebalance: the target share of the stock.
driftPercentRebalance: how far from the target it may drift before trading.
maxRunsLimit on the number of runs.
expiresInDaysHow long the rule lives.
slippagePercentHow much worse than the oracle price a fill may be. The default is 1.5.

The same schema is used by the API and the marketplace catalog.

#What happens at a run

  1. A keeper sees that the rule is due and asks the contract whether it can run.
  2. The contract reads the Chainlink price and works out the least it will accept: the oracle price minus the rule's slippage.
  3. The keeper picks the best allowed pool for the pair by simulating, and sends the trade. If the result is worse than the minimum, the whole transaction reverts and nothing moves.
  4. The result stays in your vault and a receipt is written on chain.

#Statuses

The list in the app shows one status per rule. Most of them are normal waiting, not errors.

StatusMeaning
executingThe rule is ready and will run the next time a keeper picks it up.
waiting for next slotA schedule or repeat gap has not passed yet.
watching priceThe trigger price has not been reached.
in balanceA rebalance sees the mix inside its band, so it trades nothing.
needs fundsThe vault does not hold enough of the token it would spend.
price feed staleThe oracle price is too old, or the token is in a corporate action. The rule waits and resumes when the feed updates.
venue disabledThe pool or adapter it would use is switched off.
above the trade limitThe run would exceed the protocol’s per-trade limit.
beyond the agent's limitsAn agent rule that no longer fits the box, for example you tightened a limit. It stops.
pausedExecutions are paused protocol-wide. Withdrawals still work.
done / finished / expiredIt ran its maximum number of times, ran its single time, or passed its expiry.

#Costs

Every run costs 0.1% to the keeper and 0.1% to the protocol. A $25 buy costs five cents. Over a round trip (buying and selling back) the spread and fees were 0.2–0.8% on liquid stocks in testing, more on COIN and CRCL. See Fees and the token.