pub struct NpvSolution { /* private fields */ }Expand description
The custom solution information of a NPV scenario. The struct values are immutable by the user of the library.
Implementations§
Source§impl NpvSolution
impl NpvSolution
Sourcepub fn new(
rates: Vec<f64>,
periods: u32,
initial_investment: f64,
cashflows: Vec<f64>,
sum_of_cashflows: f64,
sum_of_discounted_cashflows: f64,
net_present_value: f64,
) -> Self
pub fn new( rates: Vec<f64>, periods: u32, initial_investment: f64, cashflows: Vec<f64>, sum_of_cashflows: f64, sum_of_discounted_cashflows: f64, net_present_value: f64, ) -> Self
Create a new instance of the struct
pub fn series(&self) -> NpvSeries
Sourcepub fn rate_avg(&self) -> f64
pub fn rate_avg(&self) -> f64
Call rate_avg on a NpvSolution to get the simple average rate of a schedule;
Sourcepub fn initial_investment(&self) -> f64
pub fn initial_investment(&self) -> f64
Returns the initial investment as f64.
Sourcepub fn sum_of_cashflows(&self) -> f64
pub fn sum_of_cashflows(&self) -> f64
Returns the sum of the cashflows at their future value.
Sourcepub fn sum_of_discounted_cashflows(&self) -> f64
pub fn sum_of_discounted_cashflows(&self) -> f64
Returns the sum of the cashflows at their present value.
Sourcepub fn net_present_value(&self) -> f64
pub fn net_present_value(&self) -> f64
Returns the net present value as f64.
Sourcepub fn print_table(&self)
pub fn print_table(&self)
Pretty-print a table of the calculations at each period for visual analysis.
Sourcepub fn print_table_locale(&self, locale: &Locale, precision: usize)
pub fn print_table_locale(&self, locale: &Locale, precision: usize)
Pretty-print a table of the calculations at each period for visual analysis, and provide a Locale for monetary formatting and preferred decimal precision.
Sourcepub fn max_discounted_cashflow(&self) -> f64
pub fn max_discounted_cashflow(&self) -> f64
Return the max discounted cashflow (present value of the cashflow)
Sourcepub fn min_discounted_cashflow(&self) -> f64
pub fn min_discounted_cashflow(&self) -> f64
Return the min discounted cashflow (present value of the cashflow)