Closed neosis closed 5 years ago
You managed to hit a cycle where the candidates kept going through the same set of numbers over and over without quite getting the value close to zero. It will converge if you ease up on the tolerance:
final double xirr = Xirr.builder()
.withNewtonRaphsonBuilder(
NewtonRaphson.builder().withTolerance(0.000_001))
.withTransactions(
new Transaction(-516250000, "2019-12-01"),
new Transaction(6676867.348, "2019-12-31"),
new Transaction(-23985279.65, "2020-03-31"),
new Transaction(-9226199.498, "2020-06-30"),
new Transaction(-4756239.031, "2020-09-30"),
new Transaction(9424601.751, "2020-12-31"),
new Transaction(13316322.85, "2021-03-31"),
new Transaction(42283061.51, "2021-06-30"),
new Transaction(48107917.48, "2021-09-30"),
new Transaction(73370583.37, "2021-12-31"),
new Transaction(78071059.19, "2022-03-31"),
new Transaction(88001127.23, "2022-06-30"),
new Transaction(93155837.61, "2022-09-30"),
new Transaction(98048409.57, "2022-12-31"),
new Transaction(102678843.1, "2023-03-31"),
new Transaction(91850303.81, "2023-06-30"),
new Transaction(36640855.3, "2023-09-30")
).xirr();
Worked with specified tolerance.
Best Ashutosh
Hi
Tried calculating xirr as follows -
final double xirr = new Xirr( new Transaction(-516250000, "2019-12-01"), new Transaction(6676867.348, "2019-12-31"), new Transaction(-23985279.65, "2020-03-31"), new Transaction(-9226199.498, "2020-06-30"), new Transaction(-4756239.031, "2020-09-30"), new Transaction(9424601.751, "2020-12-31"), new Transaction(13316322.85, "2021-03-31"), new Transaction(42283061.51, "2021-06-30"), new Transaction(48107917.48, "2021-09-30"), new Transaction(73370583.37, "2021-12-31"), new Transaction(78071059.19, "2022-03-31"), new Transaction(88001127.23, "2022-06-30"), new Transaction(93155837.61, "2022-09-30"), new Transaction(98048409.57, "2022-12-31"), new Transaction(102678843.1, "2023-03-31"), new Transaction(91850303.81, "2023-06-30"), new Transaction(36640855.3, "2023-09-30") ).xirr();
Got following error -
org.decampo.xirr.NonconvergenceException: Newton-Raphson failed to converge within 10000 iterations.
Any help/pointers where I am going wrong? Will providing guess help?
Best Ashutosh