{
  "schemaVersion": 1,
  "slug": "investment-return-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "18143d760423605a1cf5958db3cdb061555183045e12d02052874d10fc8a1752",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/investment-return-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "R = ((V_f + I) ÷ V_0)^(1 ÷ t) − 1",
    "vars": [
      [
        "R",
        "Annualised return"
      ],
      [
        "V_f",
        "Final value"
      ],
      [
        "I",
        "Income/dividends"
      ],
      [
        "V_0",
        "Initial value"
      ],
      [
        "t",
        "Years"
      ]
    ],
    "note": "Annualized equivalent treats cash income as if received at the end of the period; interim payment timing is not modeled."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const profit = finalValue - initialValue + income; const rp = initialValue>0 ? profit/initialValue*100 : 0; const ratio = initialValue>0 ? (finalValue+income)/initialValue : 1; return { profit, returnPercent:rp, annualized: ratio>0 ? (Math.pow(ratio, 1/years)-1)*100 : 0 };",
    "inputs": [
      {
        "name": "initialValue",
        "type": "number",
        "default": 10000,
        "min": 0,
        "max": 1000000000,
        "step": 100
      },
      {
        "name": "finalValue",
        "type": "number",
        "default": 15000,
        "min": 0,
        "max": 1000000000,
        "step": 100
      },
      {
        "name": "income",
        "type": "number",
        "default": 500,
        "min": 0,
        "max": 1000000000,
        "step": 10
      },
      {
        "name": "years",
        "type": "number",
        "default": 3,
        "min": 0.1,
        "max": 100,
        "step": 0.1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "profit",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "returnPercent",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "annualized",
        "precision": 2,
        "unit": "%"
      }
    ],
    "interpret": null
  }
}
