Home/Stocks, ETFs & Investing/Multi-Trade Cost Basis

Multi-Trade Cost Basis

Compute remaining cost basis and realized P&L under Moving Average or FIFO.

Enter values

Format each line or semicolon entry as "BUY|SELL qty price [fee]". All monetary values use the selected currency.

—
—
Export to Studio →
Show formula
Advanced · Smart Compare A/B/C
Advanced · 1D & 2D Simulation Lab

About this calculator

Compute remaining cost basis and realized P&L under Moving Average or FIFO.

Inputs

  • Trades (BUY/SELL qty price fee; line or ;)
  • Cost basis method

Example with default values

  • Trades (BUY/SELL qty price fee; line or ;): BUY 10 50000 500; BUY 10 60000 500; SELL 5 65000 500
  • Cost basis method: Moving average

Remaining avg cost basis: 55,050 KRW

Formula: Moving average weighted cost on each BUY

Format each line or semicolon entry as "BUY|SELL qty price [fee]".