Present Value of a Portfolio

Implementation

(async ()=>{ let dt = await import('/code/calendar/v1.0.0/calendar.mjs'); let presentValue = cashFlows.reduce((accumulator, currentValue, index, array)=>{ let time = dt.fractionOfYear(currentValue.date, now); if(time>=0){ let rate = curve(time); return accumulator + Math.exp(-1*rate*time)*currentValue.amount; } return accumulator; }, 0); $console.log(presentValue); })();