financial_maths 0.0.12 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bbd02c7bf4024c740d7d75a566d285665c96c03
4
- data.tar.gz: dd22d4cec4aca97f2090ea5284a4f80262705a2a
3
+ metadata.gz: fdc72e11ac66bcf24e52de9c8c167946bf84c13b
4
+ data.tar.gz: 8302a66a56aacf2cecdd393b6911828b37cffca5
5
5
  SHA512:
6
- metadata.gz: 9266448a212e1ae9930d7cbf61c602c3ecbd0a8b94106a95c50cd231385d8e69f917680b4157f659dbc30eacf39ac534386889ecf15f35c9c15c5571089b7ba0
7
- data.tar.gz: 227e513b3dd9e2b7b84caccbded7de61f5665447d25ca95e0ee500675418dcf1ae43c46b158677ed1b19252a1ea5416c4ca13f777f4b4c27d0afeac632906f21
6
+ metadata.gz: 39a5b5d339a594345b8bc775ff55c520a94174430ded4c1aae55a7364caf4bc95c871705e2632bdfabb616ada583e9d483d8c83a288113ff274449bb54fe0744
7
+ data.tar.gz: 663d297089c54977a7ee88dcf50bd9a210a56be9eb9cd85b951a1e2c3232d039fae2ec5defd45cd5dc317514576aa20e8354750d43a53308bcb5f20eaecdd1b7
@@ -89,6 +89,41 @@ module FinancialMaths
89
89
  end
90
90
  result
91
91
  end
92
+
93
+ def due_interest_amortization(periods, amount, rate)
94
+ result = []
95
+ result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
96
+
97
+ for i in 1..(periods - 1) do
98
+ result << {period: i, monthly_payment: 0, interest: (amount * rate), payment: (amount * rate), balance: amount}
99
+ end
100
+
101
+ result << {period: periods, monthly_payment: amount , interest: amount * rate, payment: amount * rate + amount, balance: 0}
102
+ end
103
+
104
+ def anticipated_interest_amortization(periods, amount, rate)
105
+ result = []
106
+
107
+ for i in 0..(periods - 2) do
108
+ result << {period: i, monthly_payment: 0, interest: (amount * rate), payment: (amount * rate), balance: 0}
109
+ end
110
+
111
+ result << {period: periods - 1, monthly_payment: amount , interest: amount * rate, payment: amount * rate + amount, balance: 0}
112
+ end
113
+
114
+ def unique_payment_amortization(periods, amount, rate)
115
+ result = []
116
+ result << {:period=> 0, :monthly_payment => nil, :interest => nil, :payment => nil, :balance => amount}
117
+
118
+ interest = (amount * rate) * periods
119
+
120
+ for i in 1..(periods - 1) do
121
+ result << {:period=> i, :monthly_payment => 0, :interest => 0, :payment => 0, :balance => amount}
122
+ end
123
+
124
+ result << {:period=> periods, :monthly_payment => amount, :interest => interest, :payment => amount + interest , :balance => 0}
125
+ end
126
+
92
127
 
93
128
  # hallar futuro dado el valor presente HFDP
94
129
  def future_given_present(present_value, interest, term)
@@ -1,3 +1,3 @@
1
1
  module FinancialMaths
2
- VERSION = "0.0.12"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: financial_maths
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Espinosa
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-11 00:00:00.000000000 Z
12
+ date: 2014-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler