Price ranges
A vault only earns while the price is inside its range. The agent chooses that range for each vault, both where it sits and how wide it is.
What a range is
A vault doesn't supply its pool at every possible price. It supplies it between two prices, a lower and an upper one. That band is its range. Trades at prices inside the range pay the vault a fee; trades outside it don't.
Keeping all its money in a range, instead of spreading it over every price, is what lets a vault earn more per dollar. The catch is that it only earns while the price stays inside.
What the vault holds
Inside its range, a vault holds both of its tokens, and the mix shifts as the price moves. As the price of a token rises, the vault gradually sells it. As it falls, the vault gradually buys it. The vault is the other side of those trades, and that's what it earns fees on.
At the edges, the mix is all one token. In the USDG/NVDA vault:
- At the top of the range, the vault has sold all its NVDA and holds only USDG.
- At the bottom, it has spent all its USDG and holds only NVDA.
Narrow or wide
How wide to make a range is a trade-off:
| Narrow range | Wide range | |
|---|---|---|
| Earnings per trade | Higher: the same money covers fewer prices | Lower: it's spread over more prices |
| Time in range | Shorter: a small move takes the price out | Longer: it takes a bigger move |
| Moves needed | More, and each move costs money | Fewer |
As a rule of thumb, a range half as wide earns about twice as much per trade, for as long as the price stays inside it.
How the agent picks a range
The agent chooses each vault's range: how wide it is, and where it sits around the price.
- Read the marketIs the price trending, or moving sideways? Is trading picking up, or slowing down?
- Test widthsIt replays recent trading against several widths. For each, it counts what the vault would have earned, minus the cost of every move it would have needed.
- Pick and forecastIt picks the width it expects to earn the most after costs, and writes down how long it expects the price to stay inside.
- Set it onchainIt sets the new range. The vault's contract refuses it if it breaks one of the vault's limits.
In general, it goes narrower when prices are calm and trading is steady, and wider when prices trend or trading slows down.
Two of the contract's limits apply to every range:
- It must include the current price, so a new range starts out earning.
- It can't be too narrow. For today's vaults, a range has to be at least about 2.4% wide, from bottom to top.
How it decides goes deeper into the agent's reasoning.
When the price leaves the range
When the price moves past one of the edges, the vault holds only one of its tokens, and it stops earning. It starts again when the price comes back inside, or when the range is moved.
The agent doesn't always move the range right away. Moving costs money, and prices often come back. Rebalancing explains how it chooses between moving and waiting.