exonio 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/exonio/financial.rb +4 -6
- data/lib/exonio/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a78b47da7f327af032c2c2eb15b19873b3633216
|
4
|
+
data.tar.gz: c307fa7b9e8e3b8072e14fa2ad9f56fdf660eab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb43b81c45f8fd358a3ec755bfb92c9f76d90de0cc81c8bbe50db6eed48df939ae2e45d48b7e660295bf1445e15c08216a790d610cc7ff81284287695186b3b
|
7
|
+
data.tar.gz: 5d63764dfe31e91ad66ad82b30567a1c68d41450c536cefc0a3ee0361eed55fef9b5a146b05e4d583f512f817f2b0f88766bc1770ff6ba0e503ed662a7bbb25d
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
To use Exonio you just have to call the method you like to use. Example:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.
|
27
|
+
Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.0247200054619
|
28
28
|
```
|
29
29
|
|
30
30
|
## Available Formulas
|
@@ -36,7 +36,7 @@ an additional monthly savings of $100 with the interest rate at
|
|
36
36
|
5% (annually) compounded monthly?
|
37
37
|
|
38
38
|
```ruby
|
39
|
-
Exonio.fv(0.05 / 12, 10 * 12, -100, -100) # ==> 15692.
|
39
|
+
Exonio.fv(0.05 / 12, 10 * 12, -100, -100) # ==> 15692.928894335748
|
40
40
|
```
|
41
41
|
|
42
42
|
By convention, the negative sign represents cash flow out (i.e. money not
|
@@ -60,7 +60,7 @@ What is the monthly payment needed to pay off a $200,000 loan in 15
|
|
60
60
|
years at an annual interest rate of 7.5%?
|
61
61
|
|
62
62
|
```ruby
|
63
|
-
Exonio.
|
63
|
+
Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.0247200054619
|
64
64
|
```
|
65
65
|
|
66
66
|
In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained
|
data/lib/exonio/financial.rb
CHANGED
@@ -13,14 +13,13 @@ module Exonio
|
|
13
13
|
# @return [Float]
|
14
14
|
#
|
15
15
|
# @example
|
16
|
-
# Exonio.fv(0.05 / 12, 12 * 10, -100, -100) # ==> 15692.
|
16
|
+
# Exonio.fv(0.05 / 12, 12 * 10, -100, -100) # ==> 15692.928894335748
|
17
17
|
#
|
18
18
|
def fv(rate, nper, pmt, pv, end_or_beginning = 0)
|
19
19
|
temp = (1 + rate) ** nper
|
20
20
|
fact = (1 + rate* end_or_beginning) * (temp - 1) / rate
|
21
|
-
result = -(pv * temp + pmt * fact)
|
22
21
|
|
23
|
-
|
22
|
+
-(pv * temp + pmt * fact)
|
24
23
|
end
|
25
24
|
|
26
25
|
|
@@ -59,14 +58,13 @@ module Exonio
|
|
59
58
|
# @return [Float]
|
60
59
|
#
|
61
60
|
# @example
|
62
|
-
# Exonio.pmt(0.075/12, 12*15, 200_000) # ==> -1854.
|
61
|
+
# Exonio.pmt(0.075/12, 12*15, 200_000) # ==> -1854.0247200054619
|
63
62
|
#
|
64
63
|
def pmt(rate, nper, pv, fv = 0, end_or_beginning = 0)
|
65
64
|
temp = (1 + rate) ** nper
|
66
65
|
fact = (1 + rate * end_or_beginning) * (temp - 1) / rate
|
67
|
-
result = -(fv + pv * temp) / fact
|
68
66
|
|
69
|
-
|
67
|
+
-(fv + pv * temp) / fact
|
70
68
|
end
|
71
69
|
end
|
72
70
|
end
|
data/lib/exonio/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exonio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Izidoro
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".rspec"
|
65
65
|
- ".travis.yml"
|
66
|
+
- CHANGELOG.md
|
66
67
|
- Gemfile
|
67
68
|
- Gemfile.lock
|
68
69
|
- LICENSE.md
|