financial_maths 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/financial_maths.rb +35 -0
- data/lib/financial_maths/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdc72e11ac66bcf24e52de9c8c167946bf84c13b
|
4
|
+
data.tar.gz: 8302a66a56aacf2cecdd393b6911828b37cffca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39a5b5d339a594345b8bc775ff55c520a94174430ded4c1aae55a7364caf4bc95c871705e2632bdfabb616ada583e9d483d8c83a288113ff274449bb54fe0744
|
7
|
+
data.tar.gz: 663d297089c54977a7ee88dcf50bd9a210a56be9eb9cd85b951a1e2c3232d039fae2ec5defd45cd5dc317514576aa20e8354750d43a53308bcb5f20eaecdd1b7
|
data/lib/financial_maths.rb
CHANGED
@@ -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)
|
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
|
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-
|
12
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|