Inventory, cash and marked wealth

Reconcile partial sales, lot attribution, fees and remaining inventory before comparing marked wealth with liquidation proceeds.

34 minutes · intermediate · Original Poker4Quant lesson

What you will learn

Derive a cash-plus-inventory reconciliation, construct FIFO and LIFO realized/unrealized decompositions, prove total marked gain is invariant to lot attribution and price an explicit liquidation gap.

Prerequisites: Price-time order matching · Quotes, spreads and reference prices · Resting exposure and future fills · Net payoff and sunk costs

Start with two balances and a declared clock

A sale receipt is not automatically profit, and cash remaining after a purchase is not the whole account. Buying transfers chips out of cash while adding an asset; selling reverses those directions. To evaluate a partially closed position, retain both a cash balance C and a unit balance q. At a declared reference mark M, marked wealth is W=C+qM. This is a valuation statement at one time. It does not establish that the remaining units can actually be sold for M. The distinction matters most when a favorable closed trade distracts attention from an unfavorable open position.

Assume one fictional asset, one chip currency, unit multiplier one, starting cash 1,000 and zero starting inventory. There are no deposits, withdrawals, dividends, interest, borrowing, short sales, taxes or corporate actions. Executions are supplied facts, not forecasts: buy two units at 98, then buy two at 104, then sell three at 103. Every executed unit incurs a fee of half a chip, paid immediately from cash. Fees are expensed separately; acquisition lot costs below exclude fees. This explicit teaching convention differs from broker statements that incorporate commissions into lot basis and proceeds. Do not combine their net figures with our separate fee subtraction.

Reconstruct the cash and unit tapes independently

For an execution of signed quantity x at price p, let x be positive for a purchase and negative for a sale. Update q by x and cash by −xp−f, where f is that execution’s nonnegative fee. A mark update changes neither balance. Our first purchase leaves cash 1000−196−1=803 and inventory two. The second leaves cash 803−208−1=594 and inventory four. The sale adds 309 of proceeds but costs another 3/2 in fees, leaving cash 1803/2=901.5 and inventory one. Total acquisition spending before fees is 404; sale proceeds are 309; cumulative fees are 7/2.

At mark 100, wealth is 1803/2+100=2003/2, so gain from the starting account is 3/2. The cash change alone is −197/2: it omits the remaining asset. Conversely, calling the receipt of 309 profit ignores the cost of the units sold. Independently net all transfers at once: 1000−404+309−7/2=1803/2. Then add the remaining inventory value once. These two checks use different groupings of the same transfers, making a duplicated sale receipt or forgotten fee visible without relying on a profit label.

Assign closing units to lots without changing executions

The two acquisition lots are A: two units costing 98 each, followed by B: two costing 104 each. A lot convention answers which acquisition costs are attributed to a later sale of fungible units. FIFO assigns the earliest purchased units first. LIFO assigns the latest first. This is accounting attribution, separate from the price-time rule that matches orders on an exchange. Interactive Brokers documents several matching methods for realized reporting. Here both methods are alternative teaching ledgers for an identical execution tape; we make no claim about permitted tax elections or the settings of a particular live account.

Under FIFO the three sold units are A,A,B, with attributed cost Ksold=98+98+104=300. Gross realized gain R is proceeds minus that cost: 309−300=9. The remaining B unit has cost Kopen=104, so gross unrealized gain U at mark 100 is 100−104=−4. Under LIFO the sold units are B,B,A, cost 306; R=3 and the remaining A costs 98, giving U=2. Cash and physical unit count have not changed. Counting a different lot as closed can move six chips between R and U without generating a single new chip.

Prove the reconciliation before interpreting a winning trade

Let total historical purchases be K=404, total sale proceeds S, and cumulative fees F. Every acquired unit must appear exactly once among sold or open units, so Ksold+Kopen=K. Gross realized gain is R=S−Ksold; gross unrealized gain is U=qM−Kopen. Adding and subtracting fees gives R+U−F=S+qM−K−F. The cash tape independently gives C=C0−K+S−F. Therefore R+U−F=C+qM−C0. Lot costs cancel because they partition a fixed acquisition total, rather than because either reported component has an intrinsic priority.

For FIFO, 9−4−7/2=3/2; for LIFO, 3+2−7/2=3/2. Both equal the direct wealth change. Now lower only the mark from 100 to 96. The remaining unit loses four of marked value, cash stays 901.5 and the already realized gain stays fixed under each convention. Total marked gain becomes −5/2. FIFO still displays a positive realized nine, but unrealized gain is now −8 and fees remain 7/2. This is a concrete counterexample to treating a profitable closed sale as proof of a profitable whole account. It is a deterministic accounting result, not an expected return.

Distinguish a mark from a liquidation instruction

Suppose an additional explicit scenario offers enough immediate bid depth to sell every remaining unit at b=M−2, with the same half-chip fee per sold unit. Assume that price stays fixed throughout this hypothetical liquidation. Final cash would be L=C+qb−q/2. Relative to the marked account, liquidation reduces wealth by q(M−b)+q/2. At the starting mark of 100, the remaining unit sells for 98, incurs another half-chip fee and leaves 999 chips. Marked gain is +1.5, yet fully liquidated gain is −1. The gap is 2.5. The future liquidation fee belongs only to this hypothetical branch, not to the earlier marked balance.

In the workshop, change the number of units sold, the mark, the fee and the lot convention. Construct the sold-lot allocation yourself, then reconcile cash, open basis, both gross gains, total marked gain and liquidation gain. Changing the convention must leave both total gains fixed; changing only the mark must leave cash fixed; when all four units are sold, mark changes must affect neither gain. With zero units sold, realized gain is zero but purchase fees and open exposure still matter. SEC order guidance explains why a displayed last price need not be an execution price. Our fixed liquidation bid is an explicit extra assumption; real depth, timing and price impact require a richer model.

Worked example

Buy A:2 at 98, buy B:2 at 104, sell three at 103. Fee is 1/2 per executed unit; mark is 100. Reconcile FIFO, LIFO and liquidation at bid 98.

  1. Cash tape: 1000 → 803 → 594 → 1803/2. Unit tape: 0 → 2 → 4 → 1. Fees: 1+1+3/2=7/2.
  2. FIFO sells A,A,B: sold basis 300, remaining basis 104, gross R=309−300=9, gross U=100−104=−4.
  3. LIFO sells B,B,A: sold basis 306, remaining basis 98, gross R=3, gross U=2.
  4. Both gain decompositions give R+U−F=5−7/2=3/2. Direct marked wealth gives 1803/2+100−1000=3/2.
  5. Independent per-unit attribution: FIFO closed edges 5+5−1=9, open edge −4. LIFO closed edges −1−1+5=3, open edge 2. Both gross totals are five.
  6. Hypothetical liquidation adds 98−1/2=195/2 to cash, giving 999. Liquidated gain is −1, below marked gain by 5/2. At mark 96, marked gain falls to −5/2 without any new execution.

Lot attribution changes the realized/unrealized split, while complete wealth is fixed by actual transfers, remaining units, the declared mark and fees.

Hands-on: Build two views of one inventory

Attribute sold units to acquisition lots, reconcile gross and net balances, and challenge marked wealth with a separate liquidation scenario.

Build two views of one inventory

Start with cash 1,000 and zero inventory. Executions: buy A:2 at 98, buy B:2 at 104, then sell s at 103. Fees are paid per executed unit and expensed separately from gross lot costs. Mark M is a valuation; hypothetical liquidation sells all remaining units at bid M−2 with the same additional per-unit fee and sufficient fixed depth. No funding flows, taxes, borrowing or short sales. Draft lasts for this visit and earns no credit.

Edit the tape and reporting view

Sold 3 at 103; mark 100; fee 0.5 per executed unit; method FIFO. Remaining units 1; paid fees 3.5. Both buys always execute.

Attribute the sold units

Construct which acquisition units are attributed to the sale. Each lot has two units. Cycle its sold count from zero through two. The draft totals below are aids, not correctness certificates. Changing any tape or reporting setting clears allocations and answers.

Lot A: two units at 98

Lot B: two units at 104

Draft assigned quantity 0; draft open basis 404; draft gross realized 309; draft gross unrealized -304. Matching a total alone does not certify the lot convention.

All entries are chip amounts. Use signed decimals or fractions. Gross gains exclude fees; total gains include them. Liquidated gain always uses the extra bid and exit-fee scenario.

Construct the sold-lot allocation, then reconcile all six balances.

Common mistakes

  • Calling sale proceeds profit without attributing acquisition cost.
  • Treating cash change as wealth change while inventory remains.
  • Confusing acquisition-lot FIFO with exchange order priority.
  • Subtracting commissions twice after importing fee-inclusive basis.
  • Changing cash when only the mark changes.
  • Counting a hypothetical exit fee in the marked account before liquidation.

Keep these ideas

  • Track cash and units separately for each execution.
  • Partition acquired cost between sold and open units exactly once.
  • With separately expensed fees, marked gain is gross realized plus gross unrealized minus fees.
  • Lot conventions preserve total wealth; a liquidation bid and its fees can change obtainable cash.

Further reading

  • Interactive Brokers Reporting Reference: Realized and Unrealized Performance Summary ↗

    Read opening matching definitions, FIFO/LIFO alternatives, commissions paragraph and total fields. Original two-lot reconciliation and activity. Our gross lot costs with fees expensed separately deliberately differ from the documented netted-commission convention. No tax eligibility, live account settings or video review claimed. Checked 2026-10-25.

  • SEC Investor.gov: Types of Orders, market-order execution paragraph ↗

    Read market-order paragraph distinguishing bid/ask execution from last-traded price and noting execution-price uncertainty. Our fixed-depth liquidation bid and additional exit fee are explicit original assumptions, not a current market quote or guaranteed real execution. Checked 2026-10-25.

Check your understanding

Untimed · 4 checks · Guest progress stays in this browser. Sign in to save account snapshots.

Loading saved lesson…