Jul 2, 2026 · 6 min read
How Anello Calculates Your Grid Bot's PnL
Realized vs floating PnL for a spot grid, how the per-bot ledger works, and why Anello checks it against your on-chain balance.
Spot trading on Hyperliquid has had a busy stretch — steady ETF inflows into HYPE, USDC settling in as the aligned quote asset, and a widening set of spot markets. More people running spot strategies means more people staring at a single number on a dashboard and asking the only question that matters: is this PnL real?
It’s a fair question, because PnL is one of the easiest numbers in trading to get subtly wrong. This post walks through how Anello computes it for a grid bot, what the two halves of the number mean, and why we don’t just trust the exchange’s figure or our own running total blindly.
Two numbers, not one
A grid’s PnL is realized plus floating (floating is also called unrealized). They answer different questions and it’s worth keeping them apart.
Realized PnL is profit the bot has already banked. A grid buys a rung, and later sells that inventory at a higher rung. The gap between the two, minus fees, is locked in — it doesn’t move when the price moves afterward. Every completed buy-low/sell-high cycle adds a small, permanent amount to this figure.
Floating PnL is the paper value of what the bot is still holding. When price falls through several buy rungs, the grid accumulates inventory it hasn’t sold yet. Marked against what it paid, that inventory is usually underwater while you wait for a rebound. Floating is the honest picture of that: it moves every tick, and it can be deeply negative even while realized keeps ticking up.
On the grid’s detail view you see both — a realized line and, next to it, the floating value of held inventory. Reading them together is the whole skill: a healthy grid in a choppy range shows steadily rising realized with floating oscillating around zero; a grid whose range has broken to the downside shows flat realized and a large negative float. That’s not a bug in the number — it’s the number doing its job.
Realized, with real numbers
Say you run a grid on HYPE and it does this:
- Buys 10 HYPE at $40 → it now holds 10 units that cost $400.
- Price rises a rung; it sells 10 HYPE at $42 → proceeds $420, against the $400 those units cost. Realized: +$20, minus the small USDC fee on the sell.
Do that fifty times as price chops inside the range and the twenties add up. That’s the entire engine: the grid manufactures round-trips, and each one drops its spacing-minus-fees into realized. Nothing about a later price move can take a banked round-trip away.
Fees are handled exactly, not approximated. On a spot buy you pay the fee in the base token (you simply receive slightly less HYPE), so that cost is already folded into what the inventory cost you. On a spot sell you pay the fee in USDC, so Anello subtracts it directly. No double-counting, no fudge factor. If fees are new to you, the fees and risks article covers them.
Floating, with real numbers
Now suppose after all that trading the bot is still holding 5 HYPE it bought for a total of $200 (a $40 average cost), and the live mid is $44:
floating = held qty × mid − cost basis
= 5 × $44 − $200
= +$20
If the mid were $36 instead, floating would be 5 × 36 − 200 = −$20. Same holdings, opposite sign — that’s the paper swing you’re carrying. Add realized and floating together and you get total return, the bot’s lifetime PnL. Because grid bots run on spot, there’s no liquidation price attached to that negative float; the downside is holding inventory and waiting, which is exactly why we build the strategy on spot rather than perps.
Why we keep our own ledger
Hyperliquid reports a realized-PnL value on spot sells. We don’t use it for grid PnL, and the reason is specific: the exchange measures profit against your wallet’s blended cost basis for a token — averaged across everything you’ve ever done with that coin. A grid bot needs profit for that bot alone.
If you hold HYPE from before, or run two strategies on the same pair, the wallet’s blended basis and the bot’s own basis diverge, and the exchange number would quietly attribute the wrong profit to your grid. So Anello maintains a per-bot weighted-average-cost ledger, built only from fills that belong to that bot’s own orders. Trades from your other activity on the same wallet never leak in. (We still store the exchange’s figure alongside, for auditing.)
Recompute from scratch, then check against the chain
Two properties make the number trustworthy rather than just plausible.
It’s path-independent. The ledger can be rebuilt from zero by replaying the bot’s fills in chronological order. That makes it self-healing: if a fill is momentarily missed and lands later, the next replay simply slots it into place and the total corrects itself. The figure you see isn’t a fragile running tally that drifts a little further off with every glitch — it’s something we can reconstruct deterministically from the fills at any time.
It’s reconciled against your on-chain balance. Because Anello is non-custodial, every fill happens on your wallet, and the chain is the final arbiter. Behind the scenes, Anello continuously checks the inventory the ledger thinks the bot holds against what your wallet actually holds, within a small tolerance for in-flight fills and rounding. Two bounds always have to hold: the bot can’t be committing more base to resting sell orders than it owns, and it can’t own more base than exists in the wallet. If a check trips, the system flags a “break” for a human to look at rather than silently overwriting your number. The point is to catch disagreement between our books and the chain, not to paper over it.
This is the same discipline behind compounding: the realized figure that feeds “reinvest my profits” is the same reconciled number, so growth is measured, not guessed.
The honest edges
A few things this number deliberately does not try to be:
- It’s spot grids. The mechanics above are for Anello’s spot grid strategy. Perp-style funding attribution is a different problem and isn’t part of this figure.
- It counts the bot’s own fills only. PnL is self-contained per bot. If you fund a wallet, move coins around manually, or run separate strategies, those live outside the bot’s ledger by design.
- Floating is mark-to-market, so it’s live. A big negative float isn’t a realized loss — but it isn’t nothing, either. It’s inventory you’re holding through a drawdown, and whether it comes back is the market’s call, not the bot’s.
If you want the ground truth, you can always get it yourself: the fills are on-chain, the realized figure is just your grid’s sells minus what that inventory cost and the USDC fees, and your balances are visible on Hyperliquid. A good PnL display should agree with the chain — and be built so you can check. For more on how the strategy behaves in the ranges where these numbers are made and lost, see how grid trading on Hyperliquid works and the risks of grid trading.
Nothing in this article is financial advice. Grid trading carries real risk, including holding inventory at a loss while a range recovers or breaks.
Frequently asked questions
- What is the difference between realized and unrealized grid PnL?
- Realized PnL is money the bot has already locked in by selling a rung higher than it bought, net of fees — it does not change when the price moves. Unrealized (or floating) PnL is the current market value of the inventory the bot still holds, minus what it paid for it. Floating moves every tick; realized only changes when a sell fills.
- Why does my grid bot's PnL differ from Hyperliquid's number?
- Hyperliquid tracks profit against your wallet's blended cost basis for a token across everything you've ever done with it. A grid bot needs profit for that bot alone, so Anello keeps a separate ledger built only from the bot's own fills. If you also hold or trade the same token elsewhere in the wallet, the two numbers will legitimately differ.
- Does grid trading have a liquidation price?
- Not on Anello. Grid bots run on Hyperliquid spot markets, where you own the asset outright — there is no leverage, no margin, and no liquidation price. The natural downside is holding inventory bought above the current price while you wait for it to recover, not a forced close.
- Can I verify my grid bot's PnL myself?
- Yes. Because Anello is non-custodial, every fill happens on your own wallet and is visible on-chain. The realized figure is the sum of the bot's own sells minus what it paid for that inventory and the USDC fees, and your current holdings and balances are the final source of truth on Hyperliquid.