# Dollar-Cost Averaging Calculator

> Simulates investing a fixed amount at each of a list of prices, and reports the units bought, the average cost per unit (harmonic mean of prices), the simple average price, the current value at the last price and the gain or loss.

- Calculator id: `dca-average-cost` · Category: Investing & Real Estate (`investing`) · Tool name: `calculate_dca_average_cost`
- Canonical page: https://tttkmbb.com/investing/dca-average-cost · This document: https://tttkmbb.com/investing/dca-average-cost.md · JSON definition: https://tttkmbb.com/investing/dca-average-cost.json

## Purpose

Simulates investing a fixed amount at each of a list of prices, and reports the units bought, the average cost per unit (harmonic mean of prices), the simple average price, the current value at the last price and the gain or loss.

**Use when:** You invest the same amount every period and want your true average cost, or want to see how a fixed-amount plan compares with the average price.

**Do not use when:** You buy a fixed number of units each time (the average cost is then the simple average price) or want a projection with a growth rate (use compound-interest). Informational only; not financial advice.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `amount_per_period` | number |  | required | Fixed currency amount invested at each price. (> 0, max 1000000000000) |
| `prices` | number_list |  | required | Unit price at each purchase, in time order (2–60 values, all greater than 0). |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `periods` | integer |  | Length of the price list. |
| `total_invested` | number |  | amount_per_period × periods. |
| `units_bought` | number |  | Σ amount_per_period / price_i. |
| `average_cost_per_unit` | number |  | total_invested / units_bought (harmonic mean of the prices). |
| `simple_average_price` | number |  | Arithmetic mean of the prices (average cost when buying a fixed number of units). |
| `difference_percent` | number | % | (average_cost_per_unit − simple_average_price) / simple_average_price × 100; never positive. |
| `current_value` | number |  | units_bought × last price. |
| `gain_loss_percent` | number | % | (current_value − total_invested) / total_invested × 100. |
| `schedule` | list |  | One row per purchase: period, price, units. |

## Formula

`units = Σ_i amount_per_period / prices[i]; average_cost_per_unit = (n × amount_per_period) / units; simple_average_price = Σ prices[i] / n; current_value = units × prices[n]`

Because a fixed amount buys more units when prices are low, the average cost is the harmonic mean of the prices, which is always at or below the arithmetic mean. Fees, taxes and dividends are ignored. Informational mathematics only; not financial advice.

## Data Sources

- Wikipedia – Dollar cost averaging — https://en.wikipedia.org/wiki/Dollar_cost_averaging (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/dca-average-cost?amount_per_period=…&prices=…`
- `POST https://tttkmbb.com/api/v1/calculate/dca-average-cost` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/dca-average-cost · OpenAPI operationId `calculate_dca_average_cost` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "dca-average-cost", "inputs": {…}}`

## Example

- 100 per period at 10, 8, 12.5: inputs `{"amount_per_period":100,"prices":[10,8,12.5]}` → `{"periods":3,"total_invested":300,"units_bought":30.5,"average_cost_per_unit":9.8361,"simple_average_price":10.1667,"difference_percent":-3.25,"current_value":381.25,"gain_loss_percent":27.08}`
- 500 per month at 50, 45, 40, 48, 55: inputs `{"amount_per_period":500,"prices":[50,45,40,48,55]}` → `{"total_invested":2500,"units_bought":53.1187,"average_cost_per_unit":47.0644,"simple_average_price":47.6,"difference_percent":-1.13,"current_value":2921.53,"gain_loss_percent":16.86}`

```
GET https://tttkmbb.com/api/v1/calculate/dca-average-cost?amount_per_period=100&prices=10%2C8%2C12.5
```

## Limitations

You buy a fixed number of units each time (the average cost is then the simple average price) or want a projection with a growth rate (use compound-interest). Informational only; not financial advice. Because a fixed amount buys more units when prices are low, the average cost is the harmonic mean of the prices, which is always at or below the arithmetic mean. Fees, taxes and dividends are ignored. Informational mathematics only; not financial advice. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Why is the average cost below the average price?**

Each fixed amount buys more units at low prices than at high ones, so low prices get more weight; mathematically the average cost is the harmonic mean, which is ≤ the arithmetic mean unless all prices are equal.

**Does dollar-cost averaging beat investing a lump sum?**

Not on average in rising markets, where investing earlier tends to win; it reduces the regret and timing risk of a single purchase, which is a behavioural rather than a return advantage.

## Related

- [Compound Interest Calculator](https://tttkmbb.com/finance/compound-interest.md) — Project a plan with a constant return instead of listed prices.
- [Stock Profit Calculator](https://tttkmbb.com/finance/stock-profit.md) — Profit from selling the accumulated units.
- [CAGR Calculator](https://tttkmbb.com/finance/cagr.md) — Annualized return between two values.
