How PnL is calculated

The exact accounting SquirtFi uses, including where it refuses to answer.

The inputs

Every figure is built from the position’s own event history, valued with a mark at a specific moment. Which moment depends on the question being asked, and the two are never mixed.

TermDefinition
Cost basisEach deposit valued at the mark for the block it landed in, summed.
Withdrawn valueEach withdrawal valued at the mark for its own block.
Fees valueEach fee entry valued at its own block. Fees are already net of principal.
Position valueCurrent principal amounts, derived from tick maths, valued at current marks.
Claimable valueUncollected fees valued at current marks.
Gas costGas for every transaction that touched the position, valued at that transaction’s own block time.

The figures

  • realizedPnl = withdrawn value + fees value − cost basis of what left
  • unrealizedPnl = position value + claimable value − cost basis of what remains
  • grossPnl = realized + unrealized, before gas
  • netPnl = gross − gas

Cost basis is per-lot FIFO

Each deposit is a lot. Withdrawals consume the oldest lot first. With a single deposit this is the same as one blended basis; with several deposits at different prices it is the difference between a correct split and a pro-rata guess. The lots are exposed in the interface so a disputed basis can be traced.

The HODL comparison

“Did providing liquidity beat holding” is a different question from “what did I lock in”, so it is computed differently and reported separately.

  • Both branches are valued as a terminal value at today’s marks, so the comparison sits at one instant.
  • hodlValue = every deposit valued at today’s marks.
  • The LP branch is position value + claimable + withdrawn value at today’s marks + fees at today’s marks.
  • vsHodl is that difference, minus gas — and is null when gas is unknown.
  • divergenceLoss is the same difference with fees taken back out, which isolates the rebalancing effect.

Realized and unrealized PnL deliberately use the mark at each event instead. Mixing a withdrawal valued at its own block with a position valued today compares two different times and is not a benchmark.

Fees are counted exactly once

Fees appear inside the fees and claimable terms, and inside the HODL comparison through those same terms. They are never also added to position value. Corporate-action multipliers live in the price, never in the quantity, so a stock split changes the mark and not the raw balance.

What this is not