Crates.io | financial |
lib.rs | financial |
version | 1.1.5 |
source | src |
created_at | 2020-07-11 16:34:16.322295 |
updated_at | 2023-02-17 23:29:11.133764 |
description | A collection of finance calculations mimicking some of Excel Financial Functions interface |
homepage | https://github.com/raymon1/financial |
repository | https://github.com/raymon1/financial |
max_upload_size | |
id | 264067 |
size | 198,867 |
Financial
is a Rust crate that contains collection of finance calculations mimicking some of Excel Financial Functions interface.
you can find the crate here
use financial;
let npv = financial::npv(0.1, &[-1000., 500., 500., 500.]);
assert_eq!(npv, 221.29635953828267);
It supports both periodic and scheduled computation for IRR and NPV.
IRR and NPV functions are faster since powers are pre-computed iteratively instead of using power function multiple times. Take this with a grain of salt since no benches tests are offered at the moment.
financial::naive_date::xirr()
and financial::naive_date::xnpv()
provide same functionalities as financial::xirr()
and financial::xnpv()
, except that the former supports NaiveDate
as the input date type while the latter uses DateTime<T>
.