{
  "schemaVersion": 1,
  "slug": "roi-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "f5c06c58e5bc8bab90d7727a487b29ccc071f0770b4dbaae7e0b8940780a34ae",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/roi-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": "ROI = (G - C) ÷ C × 100",
    "vars": [
      [
        "C",
        "Amount invested"
      ],
      [
        "G",
        "Final value returned"
      ],
      [
        "P",
        "Profit: G - C"
      ]
    ],
    "note": "ROI is a percentage; with zero cost the calculator returns 0."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "Investor.gov — Investment fees and expenses",
        "url": "https://www.investor.gov/introduction-investing/general-resources/news-alerts/alerts-bulletins/investor-bulletins/updated"
      }
    ],
    "referenceRole": "context",
    "implementationHash": "f5c06c58e5bc8bab90d7727a487b29ccc071f0770b4dbaae7e0b8940780a34ae",
    "basis": "ROI = (G - C) ÷ C × 100",
    "limitations": "The references provide context and limitations. They do not validate this page’s illustrative multipliers, lookup values or predictions."
  },
  "contract": {
    "compute": "const profit = gain - cost; return { profit, roi: cost > 0 ? (profit / cost) * 100 : null };",
    "inputs": [
      {
        "name": "cost",
        "type": "number",
        "default": 30000,
        "min": 0,
        "step": 100
      },
      {
        "name": "gain",
        "type": "number",
        "default": 45000,
        "min": 0,
        "step": 100
      }
    ],
    "outputs": [
      {
        "name": "roi",
        "precision": 2,
        "optional": true
      },
      {
        "name": "profit",
        "precision": 2,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
