Money.Financial.periods

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

periods(present_value, future_value, interest_rate)

View Source

Specs

periods(Money.t(), Money.t(), float()) :: Decimal.t()

Calculates the number of periods between a present value and a future value with a given interest rate.

  • present_value is a %Money{} representation of the present value

  • 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

Example

iex> Money.Financial.periods Money.new(:USD, 1500), Money.new(:USD, 2000), 0.005
#Decimal<57.68013595323872502502238648>