Utilities

NPV / IRR over periodic or dated cashflows

Computes net present value at a given rate and the internal rate of return for a cashflow series — either periodic (NPV/IRR, one flow per period) or dated (XNPV/XIRR, actual/365 day-count). IRR is a bounded root-find (sign-change scan + bisection with a fixed iteration cap); it is omitted when the cashflows never change sign. Provide exactly one of cashflows or dated_cashflows. Deterministic.

post/v1/cashflow/npv-irr

Request

  • Base URL: https://api.numeratica.com
  • URL: https://api.numeratica.com/v1/cashflow/npv-irr
  • Auth: one of:
    • HTTP bearer
    • API key in header X-API-Key

Request body

ratenumber required

Discount rate for NPV: per-period (periodic) or annual (dated).

cashflowsnumber[]

Periodic amounts at the end of periods 0, 1, 2, …

Example request

{
  "rate": 0.1,
  "cashflows": [
    -1000,
    500,
    400,
    300,
    100
  ],
  "dated_cashflows": [
    {
      "date": "2025-01-01"
    }
  ]
}

Response

NPV/IRR result

result_idstring
engine_versionstring
disclaimerstring

Example response

{
  "result_id": "npv_1a2b3c4d5e6f7a8b",
  "engine_version": "npv-irr-1.0.0",
  "inputs": {
    "rate": 0.1,
    "cashflows": [
      -1000,
      500,
      400,
      300,
      100
    ],
    "dated_cashflows": [
      {
        "date": "2025-01-01"
      }
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.