Sha256: 9c869f255a78d7e44e035023d1dbc95594cb28b244f3d13a404fb3fbbecc7cd1

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

require "financial_maths/version"

module FinancialMaths
  class Credit
    def fixed_payment_equity(year, amount, year_interest)
      years = year*12
      monthly_payments = amount/years
      result = []
      result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}

      for i in 1..years
        interest = amount * year_interest
        month_payment = monthly_payments + interest 
        amount -= monthly_payments
        #date += 1
        result << {:period=> i, :payment => month_payment, :interest => interest, :monthly_payment => monthly_payments, :balance => amount}
      end
      result
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
financial_maths-0.0.2 lib/financial_maths.rb
financial_maths-0.0.1 lib/financial_maths.rb