Basket
Several markets at fixed weights in one token, all long or all short, at one leverage. It trades back to the weights on a schedule, or when a leg drifts.
What it does
“BTC 40%, ETH 30%, SOL 30% at 2×.” Crypto and HIP-3 stocks and commodities mix freely: “AI stocks at fixed weights” or “the big L1s”, in one token. When a leg runs ahead, rebalancing trims it and tops up the others.
- 1Read every legReads each leg's position and markcoreTimeMspositionaccountValuemarkPxPositions, account value, markscoreTimeMspositionaccountValuemarkPx
- 2Open every legWeight × leverage × the pool, eachlimitOrder · IOCOne order per leglimitOrder · IOC
- 3Check the driftHow far each leg's weight moved from its targeton the chain
- 4Back to the weightsOn schedule, or once a leg drifts too farlimitOrder · IOCTrims the winners, tops up the restlimitOrder · IOC
What happens next
The white line is the basket, the dashed ones its legs. Each ring is a rebalance.
If BTC, ETH, SOL rise 8%, 10%, 16% over a week, your $1,000 becomes about $1,223.
If BTC, ETH, SOL go sideways for a week, your $1,000 becomes about $986.
If BTC, ETH, SOL fall 8%, 10%, 16% over a week, your $1,000 becomes about $785.
If SOL jumps 30% while BTC and ETH go sideways, your $1,000 becomes about $1,165.
- Enters
- Rebalance
- The basket, % from the start
Illustrative price paths over a week. What the token does on them, and every dollar figure, comes from the template's own simulator with these settings and Hyperliquid's fees, with funding and order-book slippage where they apply. Before the fees to buy and sell the token. Not a forecast.
How it runs
- 01OpenOpens every leg at its weight × leverage × the pool.
- 02HoldThe token shows “holding”. Each leg's share moves with its price.
- 03DriftWhen a leg's weight moves more than the drift from its target (in points: 5 means 30% → 35%), every leg trades back.
- 04ScheduleEvery 1 h, 4 h, 24 h or 7 days it trades back to the weights.
Settings
| Setting | Range | Default | What it does |
|---|---|---|---|
| Legs | 1–8 markets; weights add up to 100% | BTC 40 · ETH 30 · SOL 30 | Which markets, and how much of each. |
| Direction | All long or all short | Long | One direction for every leg. |
| Leverage | 1× up to the legs' weighted cap × (1 − cash) | 2× | On the whole basket. |
| Rebalance | Every 1 h, 4 h, 24 h, 7 d | 24 h | More often: closer to the weights, more trading cost. |
| Drift | 1 pts–20 pts | 5 pts | Smaller: trades back sooner after a leg runs. |
Plus the settings every template shares: the cash share, breakers, pool cap, end date, fees, market liquidity, metadata and seed. See Shared settings.
Under the hoodintended, on Elysium's precompiles
Every precompile call a Basket token makes, in the order its cycle first makes them, then the pool's own. Until Elysium publishes its precompiles these are the intended calls; the contracts run them on HyperEVM testnet today. What each does, and the assumptions behind them: Precompiles on Elysium.
| Call | Kind | What it does here | Where today |
|---|---|---|---|
coreTimeMs() | read | How fresh the reads are. A step stops when they're older than 2 seconds. | HyperEVM: the block's time |
position(vault, asset) | read | The vault's own position on a market: its size and what it cost. | L1Read 0x…0800 |
accountValue(vault) | read | What the vault's HyperCore account is worth: margin plus the open result. NAV is built from it. | L1Read 0x…080F |
markPx(asset) | read | Hyperliquid's mark price: what the stop, the bands, the levels and the strikes are checked against. | L1Read 0x…0806 |
limitOrder(… IOC) | write | An order that fills at once or cancels, never worse than its limit: entries, stops, rebalances, grid steps. | CoreWriter action 1, time-in-force 3 |
withdrawable(vault) | read | How much USDC can leave the account right now, to pay sellers. | L1Read 0x…0803 |
usdClassTransfer(amount, toPerp) | money | Moves USDC between the account's perp and spot balances. | CoreWriter action 7 |
depositFor(vault, amount, dest) | money | Sends USDC from the vault on the chain into its own HyperCore account. | Circle's CoreDepositWallet |
spotSend(system, USDC, amount) | money | Sends USDC from the HyperCore account back to the vault on the chain, to pay sellers. | CoreWriter action 6 |
coreTimeMs()position(vault, asset)accountValue(vault)markPx(asset)limitOrder(… IOC)withdrawable(vault)usdClassTransfer(amount, toPerp)depositFor(vault, amount, dest)spotSend(system, USDC, amount)