SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
double r = new Xirr(
new Transaction(984290.64, dateFormat.parse("25-10-2019")),
new Transaction(-156452.14, dateFormat.parse("25-10-2020")),
new Transaction(-156000.00, dateFormat.parse("25-10-2021")),
new Transaction(-156000.00, dateFormat.parse("25-10-2022")),
new Transaction(-319306.62, dateFormat.parse("25-10-2023")),
new Transaction(-319306.62, dateFormat.parse("25-10-2024")),
new Transaction(-319306.62, dateFormat.parse("25-10-2025")),
new Transaction(-319306.62, dateFormat.parse("25-10-2026")),
new Transaction(-582400.00, dateFormat.parse("25-10-2027"))).xirr();
System.out.println(r*100);
Error:
Exception in thread "main" java.lang.IllegalArgumentException: Newton-Raphson failed to converge within 10000 iterations.
at org.decampo.xirr.NewtonRaphson.inverse(NewtonRaphson.java:99)
at org.decampo.xirr.NewtonRaphson.findRoot(NewtonRaphson.java:67)
at org.decampo.xirr.NewtonRaphson$Builder.findRoot(NewtonRaphson.java:147)
at org.decampo.xirr.Xirr.xirr(Xirr.java:106)
Hi, I'm getting error with these values.
Error:
It should by 18.84%