xnpv
v1.0.0
Published
to calculate xnpv in case irregular cashflows
Downloads
7
Readme
you can use package as following: -
import XNPV from 'xnpv'; import moment from 'moment';
let cashflows = [0,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000]; let dates = []; dates.push(moment('22-01-2021','DD-MM-YYYY')); let date = moment('28-01-2021','DD-MM-YYYY')
//you can give Date objects as well
while(dates.length<13){ dates.push(date.clone()); date = date.add(1,'M'); } if rate is 22% you can pass it as 0.22 console.log(XNPV(0.22,cashflows,dates))