exonio 0.6.1 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +1 -1
- data/.github/workflows/tests.yml +5 -3
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +13 -14
- data/README.md +10 -1
- data/exonio.gemspec +1 -2
- data/lib/exonio/financial.rb +18 -0
- data/lib/exonio/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98f201bb844c16499156bf6e771c9685de8077e122177264f8dd7da579d0cdb9
|
4
|
+
data.tar.gz: 864f3ab57b22c5bc476bd94e91fa6a875b957e0981662ec3bbd2a848beca2678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50084b438bad2464cf253f3a4742fa7e9a99f9e254beaea5100c0062b3a481b12ebcd4d920e9e9b6eafc9f91bf3cdc309e8129ddcbfd5ee4f1aaa29fd8234701
|
7
|
+
data.tar.gz: '059d0b131138627a4d791372ddea8e9bc88b7d88ae0a07b5779fe3052306864f4502d70010b9ffdce9d92868ff056c9a435aaff9b0608c116015ac00358b49ff'
|
data/.github/workflows/tests.yml
CHANGED
@@ -8,15 +8,17 @@ on:
|
|
8
8
|
jobs:
|
9
9
|
test:
|
10
10
|
strategy:
|
11
|
+
fail-fast: false
|
11
12
|
matrix:
|
12
13
|
os: [ubuntu-latest, macos-latest]
|
13
|
-
ruby: ["2.3.
|
14
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
|
14
15
|
|
15
16
|
runs-on: ${{ matrix.os }}
|
16
17
|
|
17
18
|
steps:
|
18
|
-
- uses: actions/checkout@
|
19
|
-
|
19
|
+
- uses: actions/checkout@v4
|
20
|
+
- name: Remove Gemfile.lock
|
21
|
+
run: rm Gemfile.lock
|
20
22
|
- name: Set up Ruby
|
21
23
|
uses: ruby/setup-ruby@v1
|
22
24
|
with:
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
exonio (0.
|
4
|
+
exonio (0.7.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -17,27 +17,26 @@ GEM
|
|
17
17
|
byebug (~> 8.0)
|
18
18
|
pry (~> 0.10)
|
19
19
|
rake (13.0.6)
|
20
|
-
rspec (3.
|
21
|
-
rspec-core (~> 3.
|
22
|
-
rspec-expectations (~> 3.
|
23
|
-
rspec-mocks (~> 3.
|
24
|
-
rspec-core (3.
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-expectations (3.
|
20
|
+
rspec (3.12.0)
|
21
|
+
rspec-core (~> 3.12.0)
|
22
|
+
rspec-expectations (~> 3.12.0)
|
23
|
+
rspec-mocks (~> 3.12.0)
|
24
|
+
rspec-core (3.12.0)
|
25
|
+
rspec-support (~> 3.12.0)
|
26
|
+
rspec-expectations (3.12.0)
|
27
27
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-mocks (3.
|
28
|
+
rspec-support (~> 3.12.0)
|
29
|
+
rspec-mocks (3.12.0)
|
30
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-support (3.
|
31
|
+
rspec-support (~> 3.12.0)
|
32
|
+
rspec-support (3.12.0)
|
33
33
|
|
34
34
|
PLATFORMS
|
35
35
|
ruby
|
36
36
|
|
37
37
|
DEPENDENCIES
|
38
|
-
bundler (~> 1.11)
|
39
38
|
exonio!
|
40
|
-
pry-byebug (~> 3.3
|
39
|
+
pry-byebug (~> 3.3)
|
41
40
|
rake (~> 13.0)
|
42
41
|
rspec (~> 3.0)
|
43
42
|
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ To use Exonio you just have to call the method you like to use. Example:
|
|
34
34
|
|
35
35
|
### EFFECT
|
36
36
|
|
37
|
-
The Excel EFFECT function returns the effective annual interest rate, given a nominal interest rate and the number of compounding periods per year.
|
37
|
+
The Excel EFFECT function returns the effective annual interest rate, given a nominal interest rate and the number of compounding periods per year.
|
38
38
|
Effective annual interest rate is the interest rate actually earned due to compounding.
|
39
39
|
More about this function [EFFECT](https://exceljet.net/excel-functions/excel-effect-function)
|
40
40
|
|
@@ -42,6 +42,15 @@ More about this function [EFFECT](https://exceljet.net/excel-functions/excel-eff
|
|
42
42
|
Exonio.effect(0.05, 10 * 12) # ==> 0.05126014873337037
|
43
43
|
```
|
44
44
|
|
45
|
+
### NOMINAL
|
46
|
+
|
47
|
+
The Excel NOMINAL function returns the nominal interest rate when given an effective annual interest rate and the number of compounding periods per year. The effective rate is the actual rate due to compounding. The nominal rate is typically the stated rate.
|
48
|
+
More about this function [NOMINAL](https://exceljet.net/functions/nominal-function)
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
Exonio.nominal(0.05, 12 / 6) # ==> 0.04939015319191986
|
52
|
+
```
|
53
|
+
|
45
54
|
### FV
|
46
55
|
|
47
56
|
What is the future value after 10 years of saving $100 now, with
|
data/exonio.gemspec
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.11"
|
22
21
|
spec.add_development_dependency "rake", "~> 13.0"
|
23
22
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
-
spec.add_development_dependency "pry-byebug", "~> 3.3
|
23
|
+
spec.add_development_dependency "pry-byebug", "~> 3.3"
|
25
24
|
end
|
data/lib/exonio/financial.rb
CHANGED
@@ -17,6 +17,22 @@ module Exonio
|
|
17
17
|
(1 + rate / nper) ** nper - 1
|
18
18
|
end
|
19
19
|
|
20
|
+
# Calculates the nominal interest rate when given an effective annual interest rate and the number of compounding periods per year.
|
21
|
+
# The effective rate is the actual rate due to compounding. The nominal rate is typically the stated rate.
|
22
|
+
#
|
23
|
+
# @param rate [Float] The effective annual interest rate as decimal (not per cent).
|
24
|
+
# @param npery [Integer] Number of compounding periods per year.
|
25
|
+
#
|
26
|
+
# @return [Float]
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# Exonio.nominal(0.05, 12 / 2) # ==> 0.04939015319191986
|
30
|
+
#
|
31
|
+
def nominal(rate, npery)
|
32
|
+
npery * ((1 + rate)**(1.0/npery) - 1)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
20
36
|
# Calculates the future value of an annuity investment based on
|
21
37
|
# constant-amount periodic payments and a constant interest rate.
|
22
38
|
#
|
@@ -103,6 +119,8 @@ module Exonio
|
|
103
119
|
# Exonio.pmt(0.075/12, 12*15, 200_000) # ==> -1854.0247200054619
|
104
120
|
#
|
105
121
|
def pmt(rate, nper, pv, fv = 0, end_or_beginning = 0)
|
122
|
+
return (-pv - fv) / nper if rate.zero?
|
123
|
+
|
106
124
|
temp = (1 + rate) ** nper
|
107
125
|
fact = (1 + rate * end_or_beginning) * (temp - 1) / rate
|
108
126
|
|
data/lib/exonio/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exonio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Izidoro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.11'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +44,14 @@ dependencies:
|
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.3
|
47
|
+
version: '3.3'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.3
|
54
|
+
version: '3.3'
|
69
55
|
description: This gem implements some useful Excel formulas like PMT, IPMT, NPER,
|
70
56
|
PV, etc...
|
71
57
|
email:
|
@@ -109,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
requirements: []
|
112
|
-
rubygems_version: 3.3.
|
98
|
+
rubygems_version: 3.3.27
|
113
99
|
signing_key:
|
114
100
|
specification_version: 4
|
115
101
|
summary: Excel usefull formulas written in Ruby
|