Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

ROI Calculator API

Return on investment: gain or loss and ROI in percent, plus the annualised return (CAGR) when a holding period is given.

POST /api/v1/tools/roi-calculatorMCP roi_calculatorCalculators

Calculate return on investment from what you put in and what it is worth now. Add the holding period to get the annualised ROI (CAGR) as well.

Input

Send these as a JSON object. Unknown fields are rejected.

initial
Amount invested (greater than 0). (number, 0 to …, required)
final
Final value of the investment. (number, 0 to …, required)
duration
Optional holding period, in durationUnit, for the annualised return. (number, 0 to …)
durationUnit
years, months or days (days use 365.25 a year). (string, one of years, months, days, default "years")
curl https://pithlab.com/api/v1/tools/roi-calculator \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"initial":5000,"final":7200,"duration":3,"durationUnit":"years"}'
Example response
{
  "ok": true,
  "result": {
    "gain": 2200,
    "roi": 44,
    "annualised": 12.924323465723408,
    "years": 3,
    "text": "Gain of 2,200.00 on 5,000.00: ROI 44%, annualised 12.92% a year over 3 years"
  }
}