Money.Financial.present_value
You're seeing just the function
present_value
, go back to Money.Financial module for more information.
Specs
Calculates the present value for a list of cash flows and an interest rate.
flows
is a list of tuples representing a cash flow. Each flow is represented as a tuple of the form{period, %Money{}}
interest_rate
is a float representation of an interest rate. For example, 12% would be represented as0.12
Example
iex> Money.Financial.present_value([{4, Money.new(:USD, 10000)}, {5, Money.new(:USD, 10000)}, {6, Money.new(:USD, 10000)}], 0.13)
#Money<:USD, 16363.97191111964880256655144>
iex> Money.Financial.present_value [{0, Money.new(:USD, -1000)},{1, Money.new(:USD, -4000)}], 0.1
#Money<:USD, -4636.363636363636363636363636>
Specs
Calculates the present value for future value, an interest rate and a number of periods
future_value
is a %Money{} representation of the future valueinterest_rate
is a float representation of an interest rate. For example, 12% would be represented as0.12
periods
in an integer number of periods
Examples
iex> Money.Financial.present_value Money.new(:USD, 100), 0.08, 2
#Money<:USD, 85.73388203017832647462277092>
iex> Money.Financial.present_value Money.new(:USD, 1000), 0.10, 20
#Money<:USD, 148.6436280241436864020760472>