Retorno de la inversión (ROI)
fin-roiCalcula el retorno sobre la inversión (ROI) y ROI anualizado. Cuándo: un cálculo de dinero, impuestos o matemática financiera tiene que ser exacto y reproducible (redondeo, centavos, tasas). No para: calcular la tasa de crecimiento anual compuesta entre dos valores (fin-cagr). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Computes the return on investment ROI = (gain − cost) / cost, and the annualized ROI when a holding period in years is given. When: a money, tax or financial-math result has to be exact and reproducible (rounding, cents, rates). Not for: computing the compound annual growth rate between two values (fin-cagr). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cost | Yes | Investment cost (number; required; > 0). | |
| years | No | Holding period in years (number; optional; > 0; max 1000). | |
| final_value | Yes | Final value / gain (number; required; min 0). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| profit | No | ||
| roi_percent | No | ||
| annualized_percent | No |