@railpath/finance-toolkit
Version:
Production-ready finance library for portfolio construction, risk analytics, quantitative metrics, and ML-based regime detection
14 lines (13 loc) • 613 B
TypeScript
/**
* Calculate derivative of Net Present Value (NPV) with respect to discount rate
*
* NPV' = -Σ(CF_i * t_i / (1 + r)^(t_i + 1))
*
* This is used in the Newton-Raphson method for IRR calculation.
*
* @param cashFlows - Array of cash flows (positive for inflows, negative for outflows)
* @param timePeriods - Array of time periods in years corresponding to each cash flow
* @param rate - Discount rate (as decimal, e.g., 0.1 for 10%)
* @returns Derivative of NPV with respect to rate
*/
export declare function calculateNPVDerivative(cashFlows: number[], timePeriods: number[], rate: number): number;