Money.Financial.net_present_value

You're seeing just the function net_present_value, go back to Money.Financial module for more information.
Link to this function

net_present_value(flows, interest_rate)

View Source

Specs

net_present_value([{integer(), Money.t()}], number()) :: Money.t()

Calculates the net present value of an initial investment, 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 as 0.12

  • investment is a %Money{} struct representing the initial investment

Example

iex> flows = [{0, Money.new(:USD, 5000)},{1, Money.new(:USD, 2000)},{2, Money.new(:USD, 500)},{3, Money.new(:USD,10_000)}]
iex> Money.Financial.net_present_value flows, 0.08, Money.new(:USD, 100)
#Money<:USD, 15118.84367220444038002337042>
iex> Money.Financial.net_present_value flows, 0.08
#Money<:USD, 15218.84367220444038002337042>
Link to this function

net_present_value(flows, interest_rate, investment)

View Source

Specs

net_present_value([{integer(), Money.t()}], number(), Money.t()) :: Money.t()
net_present_value(Money.t(), number(), number()) :: Money.t()

Calculates the net present value of an initial investment, a recurring payment, an interest rate and a number of periods

  • investment is a %Money{} struct representing the initial investment

  • future_value is a %Money{} representation of the future value

  • interest_rate is a float representation of an interest rate. For example, 12% would be represented as 0.12

  • periods in an integer number of a period

Example

iex> Money.Financial.net_present_value Money.new(:USD, 10000), 0.13, 2
#Money<:USD, 7831.466833737959119743127888>

iex> Money.Financial.net_present_value Money.new(:USD, 10000), 0.13, 2, Money.new(:USD, 100)
#Money<:USD, 7731.466833737959119743127888>
Link to this function

net_present_value(future_value, interest_rate, periods, investment)

View Source

Specs

net_present_value(Money.t(), number(), number(), Money.t()) :: Money.t()