# How your numbers are calculated

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

Source: https://360marketview.com/docs/reference/calculations/

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).

## A position

**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.

### Worked example

| 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**.

## Today’s move

**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.

## Cash

| 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.

## Your totals

| 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.   |

## Performance over time

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.

```text
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.

### Why it differs from total return

| 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.

### Against the S\&P 500 and the Nasdaq

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.

### Periods, best and worst days

- **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 and splits

- **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.

If a stock you hold has no closing price for more than a week, it is valued at what it cost you, and marked so — never at a guessed price.
