Skip to content
360marketview

Average cost, realized and unrealized profit, cash, money put in, and the time-weighted return — the exact rules, with worked examples.

Every figure about your portfolio is calculated from your dated records — trades, deposits, withdrawals, dividends, interest and splits — replayed in date order every time something changes. Nothing is stored as a running total that could drift. The arithmetic is exact decimal arithmetic, not floating point; figures are rounded only for display (money and percentages to 2 decimals, shares to up to 8).

Average cost. 360marketview uses the weighted-average cost of the shares you hold. A buy adds its shares, and its price times shares plus commission to the position’s cost. Average cost is cost divided by shares.

Selling. A sale removes shares at the current average cost, so the average cost of what you keep doesn’t change. Selling everything resets the position.

Realized profit on a sale is what it brought in after commission, minus the average cost of the shares sold.

Unrealized profit is the market value of the shares you hold minus what they cost.

Market value is shares times the latest price, including pre- and after-market trading.

Entry Shares held Cost Average cost Realized
Buy 10 at $100.00, $1 commission 10 $1,001.00 $100.10 —
Buy 10 at $120.00, $0 commission 20 $2,201.00 $110.05 —
Sell 5 at $130.00, $1 commission 15 $1,650.75 $110.05 +$98.75

The sale brought in 5 × $130 − $1 = $649.00. Its shares cost 5 × $110.05 = $550.25. Realized: $649.00 − $550.25 = $98.75. At a price of $125, the 15 shares left are worth $1,875.00: unrealized +$224.25.

Day P/L is your shares times the change between the previous regular close and today’s regular-session price — one regular session, 9:30 to 16:00 New York time. Moves before and after the session are shown separately.

Entry Cash
Deposit goes up by the amount
Withdrawal goes down by the amount
Buy goes down by price × shares + commission
Sale goes up by price × shares − commission
Dividend goes up by the amount less tax withheld
Interest goes up by the amount
Split doesn’t change

Cash can’t go below zero. A trade or withdrawal that would need cash you didn’t have on its date is refused with “Not enough cash”, naming the date — usually a sign that a deposit is missing or dated too late.

Figure Rule
Net contributed Deposits minus withdrawals. Dividends and interest are not money you put in.
Invested What the shares you still hold cost you.
Total value Cash plus the market value of your holdings.
Total P/L Total value minus net contributed — so dividends and interest count as profit.
Total return Total P/L as a percentage of net contributed.
Weight (Holdings) A position’s market value as a share of all positions’ value, cash left out.

Each trading day, your records are replayed up to that day and valued at that day’s closing prices; today uses live prices. That gives your value line.

Your value line goes up when you deposit money, which isn’t a gain. So performance is measured with the time-weighted return (TWR): the return of each day, with that day’s deposits and withdrawals taken out, chained together.

day's growth = value at the day's end ÷ (value at the previous day's end + money put in that day)
TWR = (growth of day 1 × growth of day 2 × …) − 1

Money is treated as arriving at the start of the day. Dividends are part of the return, not money put in.

Day Money put in Value at day’s end Day’s growth
1 $1,000 $1,000 —
2 — $1,100 1,100 ÷ 1,000 = 1.1000
3 $1,000 $2,050 2,050 ÷ (1,100 + 1,000) = 0.9762

TWR: 1.1000 × 0.9762 − 1 = +7.38% — how your investments did. Total return: ($2,050 − $2,000) ÷ $2,000 = +2.50% — what happened to your money, which arrived just before a fall.

Both are true; TWR is the one to compare with an index, because the index never had money added.

The index lines are the indices’ price returns over the same days, without dividends. The difference is your TWR minus the index’s return, in percentage points.

  • 1W, 1M, 3M, 6M, 1Y look back 7, 30, 90, 180 and 365 calendar days; YTD from 1 January; ALL from your first entry.
  • A day’s gain or loss is the change in value less that day’s deposits and withdrawals; the best and worst days are the largest of these.
  • By stock: each stock’s profit over the period — realized, unrealized and dividends — and its return on the money it used: its value at the start of the period plus what you bought during it.
  • By industry: the stocks in it added together, so a big holding counts for more than a small one. Industries are the companies’ own SEC classifications.
  • Dividends are entered as a cash movement, or come in with an imported statement. They aren’t added on their own.
  • Splits come in with an imported statement. A split multiplies your shares by the ratio; what they cost doesn’t change, the average cost is recalculated, and no cash moves. Prices in charts and history are split-adjusted, so before and after line up.

A question the docs don't answer? Write to [email protected].

360marketview is a portfolio tracker and research tool. It does not place trades, hold money or give investment advice.

S&P 500 is a trademark of Standard & Poor's Financial Services LLC; Nasdaq and Nasdaq-100 are trademarks of Nasdaq, Inc. The names only identify the indices; 360marketview is not affiliated with either company or endorsed by them.