# Investment Return API
> Investment return analysis as an API, computed locally and deterministically. The cagr endpoint computes the compound annual growth rate, (end/begin)^(1/years) − 1 — the single constant yearly rate that turns a starting value into an ending value — along with the total return and growth multiple, or runs the other way to project an ending value from a CAGR. The doubling endpoint gives how long an investment takes to double at a given rate, both the exact figure ln(2)/ln(1+r) and the quick Rule-of-72, -70 and -69.3 estimates, or inverts it to the rate needed to double within a target time. The real-return endpoint applies the Fisher equation, real = (1+nominal)/(1+inflation) − 1, to strip inflation out of a headline return — or works backwards to the nominal return needed for a target real return — showing how the rough nominal-minus-inflation shortcut drifts at higher rates. Everything is computed locally and deterministically, so it is instant and private. Ideal for fintech, robo-advisor, portfolio and personal-finance app developers, return and retirement calculators, and finance education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This analyses a lump-sum return; for regular-deposit savings projections use a savings API and for loan amortization a loan API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/investment-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($15/Mo) — 40,000 calls/Mo, 5 req/s
- **Pro** ($39/Mo) — 250,000 calls/Mo, 20 req/s
- **Mega** ($119/Mo) — 1,537,000 calls/Mo, 60 req/s

## Endpoints

### Investment

#### `GET /v1/cagr` — Compound annual growth rate

**Parameters:**
- `begin_value` (query, required, string) — Beginning value Example: `10000`
- `years` (query, required, string) — Number of years Example: `7`
- `end_value` (query, optional, string) — Ending value (for the CAGR) Example: `20000`
- `cagr` (query, optional, string) — Or a CAGR % to project the end value

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/investment-api/v1/cagr?begin_value=10000&years=7&end_value=20000"
```

**Response:**
```json
{
    "data": {
        "note": "CAGR = (end/begin)^(1/years) − 1: the constant annual rate that turns the begin value into the end value.",
        "inputs": {
            "years": 7,
            "end_value": 20000,
            "begin_value": 10000
        },
        "cagr_pct": 10.408951,
        "total_return_pct": 100,
        "total_growth_multiple": 2
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:08.453Z",
        "request_id": "0ba57741-d64c-4ff5-bbb5-090085a4bc33"
    },
    "status": "ok",
    "message": "CAGR",
    "success": true
}
```

#### `GET /v1/doubling` — Doubling time

**Parameters:**
- `rate` (query, optional, string) — Annual rate (%) for doubling time Example: `8`
- `years` (query, optional, string) — Or target years for the rate to double

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/investment-api/v1/doubling?rate=8"
```

**Response:**
```json
{
    "data": {
        "note": "Exact doubling time = ln(2)/ln(1+r). The Rule of 72 (72/rate%) is a quick mental estimate.",
        "inputs": {
            "rate_pct": 8
        },
        "rule_of_70_years": 8.75,
        "rule_of_72_years": 9,
        "rule_of_69_3_years": 8.6625,
        "exact_doubling_years": 9.006468
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:08.556Z",
        "request_id": "5e3dac9e-ce7a-4ddc-90bb-b36a0c7d4095"
    },
    "status": "ok",
    "message": "Doubling time",
    "success": true
}
```

#### `GET /v1/real-return` — Inflation-adjusted return

**Parameters:**
- `inflation` (query, required, string) — Inflation rate (%) Example: `3`
- `nominal` (query, optional, string) — Nominal return (%) Example: `7`
- `real` (query, optional, string) — Or a target real return (%)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/investment-api/v1/real-return?inflation=3&nominal=7"
```

**Response:**
```json
{
    "data": {
        "note": "Fisher equation: real = (1 + nominal)/(1 + inflation) − 1. The rough subtraction (nominal − inflation) drifts at higher rates.",
        "inputs": {
            "nominal_pct": 7,
            "inflation_pct": 3
        },
        "real_return_pct": 3.883495,
        "approx_real_return_pct": 4
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:08.626Z",
        "request_id": "529513e9-ac89-4667-abbb-d0f67105bce0"
    },
    "status": "ok",
    "message": "Real return",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/investment-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "Rates and returns in percent; values in any single currency. Analyses a lump-sum return — for regular-deposit projections use a savings API and for loan amortization a loan API.",
        "service": "investment-api",
        "formulae": {
            "cagr": "(end/begin)^(1/years) − 1",
            "rule_of_72": "72 / rate%",
            "fisher_real": "(1+nominal)/(1+inflation) − 1",
            "doubling_exact": "ln(2)/ln(1+r)"
        },
        "endpoints": {
            "GET /v1/cagr": "CAGR from a begin/end value, or project an ending value from a CAGR.",
            "GET /v1/meta": "This document.",
            "GET /v1/doubling": "Doubling time from a rate, or the rate needed to double in a given time.",
            "GET /v1/real-return": "Inflation-adjusted real return (or the nominal return for a target real return)."
        },
        "description": "Investment return analysis: compound annual growth rate (CAGR), doubling time (Rule of 72 and the exact figure), and inflation-adjusted real return via the Fisher equation."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:08.699Z",
        "request_id": "0880db31-2c67-4535-86f8-832c60d99675"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/investment-api
OpenAPI spec: https://www.oanor.com/api/investment-api/openapi.json
