Calculation method
How MoonMath calculates portfolio
Portfolio Value & Unrealized P&L — What is my saved token context worth?
The formula
Per position, value is amount × price and cost is amount × entry price, with unrealised profit the difference; the 24-hour move is value minus value ÷ (1 + change). Every one of these is absent rather than zero when an input is missing.
What it reads
- The amount and entry price recorded in the workspace, as decimal strings
- The current price and 24-hour change, fetched per token
What it assumes
- The stored amount is the position: nothing is read from a chain balance to confirm it
- Profit and loss covers only positions that have both a value and a recorded cost basis
- A price change of exactly −100% is excluded, having no meaningful prior value to divide by
What this does not establish
- The total is not a complete portfolio value: unpriced positions are excluded rather than counted as zero
- Value is amount times spot price, not proceeds — no depth, slippage, fee or tax is applied
- Profit is unrealised against a recorded entry price and says nothing about realised trades or taxes
- A position with no entry price shows a value and no profit, which is an absence of evidence rather than a break-even
Run it
Value the tokens saved in your workspace against live prices, see how the total moved in 24 hours, and compare each position with the entry price you recorded. No number here comes from a model: every figure is a stored amount, a stored entry price, or a fetched price, multiplied.
Open the Portfolio calculatorHow the market itself works
This page describes MoonMath's arithmetic. The mechanics section describes the market: how an order book forms a price, why order-book depth is not the same thing as pool liquidity, and what a public book does and does not let you observe.
Read the market mechanics