financial_maths 0.0.7 → 0.0.8
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 +7 -0
- data/README.md +4 -0
- data/lib/financial_maths/version.rb +1 -1
- data/lib/financial_maths.rb +13 -5
- metadata +15 -27
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ab56b540f61a10de15d2dc302240b3dabd1cb168
|
4
|
+
data.tar.gz: bf067c92611f17a233d2c41ff3b8e357a0a8b1c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c8b0fa5f735499cdb63e7b1e36c393590c1169fb2e9f01e8ce48f4d05df8c3a4948eed59b5d95f1a1e6f2ed3a389d0a8a061628e0d1d72a5a0abd48c0cf253d7
|
7
|
+
data.tar.gz: 9dd4900b97ed424cf5331325637c5698ce16b0402c6f55e223d0e61571713430fef85d31f6bc6bf7754afb9203abe0ce1e81d7f1603ef4bea524998bb3b0024a
|
data/README.md
CHANGED
@@ -131,3 +131,7 @@ variable_payment (amount, periods)
|
|
131
131
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
132
132
|
4. Push to the branch (`git push origin my-new-feature`)
|
133
133
|
5. Create new Pull Request
|
134
|
+
|
135
|
+
|
136
|
+
[](https://bitdeli.com/free "Bitdeli Badge")
|
137
|
+
|
data/lib/financial_maths.rb
CHANGED
@@ -135,17 +135,25 @@ module FinancialMaths
|
|
135
135
|
end
|
136
136
|
|
137
137
|
##
|
138
|
-
# Description: Find nominal rate expired given effective rate -
|
138
|
+
# Description: Find nominal rate expired given effective rate - HCUA
|
139
139
|
# Formula: ((1 + EFFECTIVE RATE) ^ (1 / PERIODS) - 1)* PERIODS
|
140
|
-
def nominal_due_given_efective(effective_rate, periods)
|
141
|
-
|
140
|
+
def nominal_due_given_efective(effective_rate, periods)
|
141
|
+
((((1 + (effective_rate.to_f/100))**(1/periods.to_f)-1)*periods.to_f)*100).round(4)
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
|
+
##
|
145
|
+
# Description: Find nominal rate expired given effective rate - EFNV
|
146
|
+
# Formula: (1 - ((1 / (TASA EFECTIVA + 1))^(1/PERIODOS))
|
147
|
+
def anticipated_interest(rate, periods)
|
148
|
+
(1 - (( 1 / ( rate.to_f + 1 )) ** (1 / periods)))
|
149
|
+
end
|
150
|
+
|
144
151
|
# == End conversion rates
|
145
152
|
|
146
153
|
# Hallar la cuota fija anticipada HCFA
|
147
154
|
def anticipated_fixed_payment(present_value, rate, term)
|
148
|
-
|
155
|
+
a_rate = anticipated_interest(rate, term)
|
156
|
+
((present_value.to_f * a_rate.to_f) / ((a_rate.to_f + 1) - (1 / (1 + a_rate) ** (term - 1)))).round(4)
|
149
157
|
end
|
150
158
|
|
151
159
|
def variable_payment(amount, periods)
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: financial_maths
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ruben Espinosa
|
@@ -10,38 +9,34 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: bundler
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- - ~>
|
18
|
+
- - "~>"
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '1.3'
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- - ~>
|
25
|
+
- - "~>"
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '1.3'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: rake
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - ">="
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - ">="
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
description: gem to use financial methods inside ruby
|
@@ -53,10 +48,10 @@ extensions: []
|
|
53
48
|
extra_rdoc_files:
|
54
49
|
- README.md
|
55
50
|
files:
|
56
|
-
- .gitignore
|
57
|
-
- .project
|
58
|
-
- .rspec
|
59
|
-
- .travis.yml
|
51
|
+
- ".gitignore"
|
52
|
+
- ".project"
|
53
|
+
- ".rspec"
|
54
|
+
- ".travis.yml"
|
60
55
|
- CHANGELOG.md
|
61
56
|
- Gemfile
|
62
57
|
- LICENSE.txt
|
@@ -71,34 +66,27 @@ files:
|
|
71
66
|
homepage: https://github.com/rderoldan1/financial_maths
|
72
67
|
licenses:
|
73
68
|
- MIT
|
69
|
+
metadata: {}
|
74
70
|
post_install_message: thanks to install financial_maths gem, I hope improve this gem
|
75
71
|
soon!
|
76
72
|
rdoc_options: []
|
77
73
|
require_paths:
|
78
74
|
- lib
|
79
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
76
|
requirements:
|
82
|
-
- -
|
77
|
+
- - ">="
|
83
78
|
- !ruby/object:Gem::Version
|
84
79
|
version: '0'
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
hash: -2271796007664673551
|
88
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
81
|
requirements:
|
91
|
-
- -
|
82
|
+
- - ">="
|
92
83
|
- !ruby/object:Gem::Version
|
93
84
|
version: '0'
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
hash: -2271796007664673551
|
97
85
|
requirements: []
|
98
86
|
rubyforge_project:
|
99
|
-
rubygems_version:
|
87
|
+
rubygems_version: 2.2.2
|
100
88
|
signing_key:
|
101
|
-
specification_version:
|
89
|
+
specification_version: 4
|
102
90
|
summary: calculate loan payments and other things
|
103
91
|
test_files:
|
104
92
|
- spec/spec_helper.rb
|