Sha256: 1bb481fc18c8833b93d022a3eb2c27a87f09037b9e547b79b4335114d007ed7b

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

module CashFlowAnalysis
  module Calculator
    module Payment
      # Calculates the {http://en.wikipedia.org/wiki/Mortgage_calculator payment for a loan}, assuming fixed payments and rates.
      #
      # @param principal [Numeric] the present value of the loan
      # @param term [Fixnum] the term of the load
      # @param per_period_rate [Numeric] the interest rate per period
      # @return [Numeric] the payment required per period
      def self.calculate(principal, term, per_period_rate)
        (per_period_rate * principal) / (1 - ((1 + per_period_rate) ** (-1 * term)))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cash_flow_analysis-0.2.0 lib/cash_flow_analysis/calculator/payment.rb
cash_flow_analysis-0.1.0 lib/cash_flow_analysis/calculator/payment.rb