RayDeCampo / java-xirr

Java implementation of xirr with bonus Newton-Raphson implementation
MIT License
75 stars 37 forks source link

Newton-Raphson failed to converge within 1000000000 iterations #20

Open weissliufeng opened 3 years ago

weissliufeng commented 3 years ago

List list = Arrays.asList( new Transaction(-275112000,"2015-07-15"), new Transaction(-57258697.67,"2017-05-02"), new Transaction( 2577101.75,"2017-11-10"), new Transaction(-2184516955.15,"2018-10-10"), new Transaction(-660239840,"2019-01-29"), new Transaction(-26567773295.82,"2021-05-13") );

com.littlefox.xirr.NonconvergenceException: Newton-Raphson failed to converge within 1000000000 iterations.

RayDeCampo commented 3 years ago

Did you forget to put in the present value as a withdrawal at the end of the sequence? This sequence as it is is essentially a 100% loss. You've deposited over 29 trillion units and taken out only 2.5 million.