Hedged and multi-market strategies
Strategies that read and trade more than one market at once, such as a liquidity range hedged on a perp, a lending loop, options hedged with perps, or spot held beside a yield position.
A strategy that reads a second market (another pool, a perp, a feed), a liquidity range, a protocol or the wallet's cash becomes a strategy over several markets. It keeps a book for each and reports them together.
What it can do#
| Reads | Trades |
|---|---|
pool.close("chain:0x…", interval), perp.close("venue:SYMBOL", interval), perp.funding(…), feed.close("name", interval) | lp.range({ widthPct }), lp.close({}) |
lp.inRange(), lp.widthPct(), lp.value(), lp.fees() | perp.hedge({ ratio }), perp.target({ usd }) |
perp.sizeUsd(), perp.entry(), perp.equity(), wallet.cash() | funds.toPerp({ usd }), funds.toWallet({ usd }) |
A protocol's rates, aave.supplyApy(…), morpho.apy(…), pendle.impliedApy(…) | Supply, borrow, deposit, buy fixed rates, trade options |
It may size orders from computed values (publish each with metric()), and it may hold spot on its own series beside those books.
A range hedged on a perp#
The Hedged LP starter holds liquidity on ETH/USDG, as wide as ETH has been moving, and shorts on a perp what the range holds in ETH, so the position earns fees without riding ETH's price. It:
- moves the range when the price has been out of it for a while, when the width it should have drifts, or on a clock;
- resizes the short to follow what the range holds each bar;
- tops the perp account up from the wallet when the short outgrows it.
Its backtest reports legs (each book at each bar) and liquidity stats: fees earned, time in range, impermanent loss and hedge P&L.
On live wallets#
A live project's wallets are made to hold, on each protocol and venue, what the paper books hold: the range minted on chain, the short on the perp, the supply on Aave. Funds bridge out from the wallet's chain by themselves and come home on close out. Count the bridge and gas cost in the backtest with moveCost (about 1 on Base or Arbitrum, 5 on Ethereum).
Limits#
- One pool, one perp, one feed and one market per protocol in a strategy.
- Spot on a second chain is a strategy of its own on that chain's pool.
- Spot beside other books runs on paper only.
- A few protocols stay on paper books for now; Protocols marks them.