← All tools
🔁

Rotation (FIFO)

Sequence-based realized P&L tracker. Add buy/sell rows in order; we update average cost on each buy and realize profit on each sell using the running average.

📥 Trade Sequence

Side
Price
Quantity

📊 Current Position

Average Cost
—
Holding Quantity
—
Holding Cost
—
Realized P&L
—
Algorithm
On buy(price p, qty q): cost += p×q ; qty += q ; avg = cost ÷ qty
On sell(price p, qty q): filled = min(qty, q) ; realized += (p − avg) × filled ; qty −= filled ; cost −= avg × filled

📅 Step-by-Step Log

# Side Price × Qty Trade P&L Avg Cost (after) Position Qty Cumulative Realized
  • If you try to sell more than you hold, only the held qty fills — the rest is dropped (no short selling here).
  • This calculator ignores fees and taxes — use Return Rate calculator for after-cost figures.