Realized and Unrealized P&L Need Separate Agent Labels
By DX Research Group · · Execution mechanics
A partial close changes both accounting categories. A simplified position case separates closed trade profit, remaining marks and independent cash movements.
Realized trading P&L describes closed exposure under an accounting convention. Unrealized P&L values exposure that remains open at a selected mark. We would keep these labels separate in agent feedback and owner reports. Hyperliquid’s margin documentation includes unrealized P&L in collateral behavior, so a gain can affect capacity while remaining economically exposed to future price changes.
A mark and a close answer different questions
Illustrative simplified case: an agent buys 10 units at $100, ignoring fees for this step. At a $110 mark, unrealized gain is $100. It sells 4 at $108. Realized gross gain is 4 × $8 = $32. The remaining 6 marked at $110 carry unrealized gain of $60. Combined marked trade P&L is $92 because the closed portion executed $2 below the earlier mark. Adding the old $100 unrealized value to $32 realized would double-count closed inventory.
Make the accounting convention reproducible
Record entry basis convention, executed closing quantity, closing price and remaining mark timestamp. Charge fees and other cash movements through their separate ledger categories. Deposits increase equity without becoming trading profit. A test should move the mark after the close while leaving realized gain fixed, then add a deposit while leaving both trade categories fixed. For agent evaluation, compare decisions using the same mark policy and time boundary. A favorable live mark alone offers weak evidence about exit execution or fully realized economics.
Choose feedback labels deliberately
Agent feedback should state whether the label represents closed trade profit, marked account change or cash-adjusted equity change. Those quantities answer different research questions. Preserve the time boundary and price source so another evaluator can reconstruct the label. A deposit or a rising mark should never silently become a positive label for an execution decision that did not produce it.
Our execution and reconciliation framework provides the broader mandate-to-outcome trace. The state and memory contract explains how the verified result should enter the next decision. These notes narrow those published methods to one execution boundary; the worked amounts above are illustrative and the test is a proposed local fixture. The source inspected for the venue-specific statements is the official Hyperliquid margining.
An owner report can show both categories without implying that marked gain is spendable cash. Any available-capital claim must refer to venue margin state and the relevant allocation rules at the same observation time.