I'm working on a program that calculates the money-weighted return for a given investment, and for some this series of cash flows doesn't work with the crate.
let cf = [-6.1, -13.0, 6.6];
let dates = [
chrono::DateTime::<Utc>::from_utc(NaiveDate::from_ymd(2021,4,3).and_hms(0,0,0), Utc),
chrono::DateTime::<Utc>::from_utc(NaiveDate::from_ymd(2021,4,21).and_hms(0,0,0), Utc),
chrono::DateTime::<Utc>::from_utc(NaiveDate::from_ymd(2021,10,30).and_hms(0,0,0), Utc),];
println!("{}", financial::xirr(&cf, &dates, None).unwrap());
This will panic. If you provide a guess with a negative return, ie. -0.1, then the calculation will work. However, given that Google Sheet can find the XIRR without being provided a guess, there might be a deeper issue behind the calculation?
I'm working on a program that calculates the money-weighted return for a given investment, and for some this series of cash flows doesn't work with the crate.
This will panic. If you provide a guess with a negative return, ie. -0.1, then the calculation will work. However, given that Google Sheet can find the XIRR without being provided a guess, there might be a deeper issue behind the calculation?