exonio 0.5.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +18 -0
- data/.github/workflows/gem-push.yml +26 -0
- data/.github/workflows/tests.yml +32 -0
- data/.gitignore +2 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +16 -17
- data/README.md +20 -1
- data/exonio.gemspec +0 -1
- data/lib/exonio/financial.rb +33 -0
- data/lib/exonio/version.rb +1 -1
- metadata +6 -20
- data/.travis.yml +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9378589552d7f80a4b46042b0a0a55dc84e79d65484f53381a8d534b20186dc
|
4
|
+
data.tar.gz: 91ca4fd17ff38669d5c8284f377fabae0d689ce24e489fa391032815d926c33f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b89195bd85a1fb68a01db4cfbedb845e1b15a3dcdcdf8099fd8bd74f5d782f7e2ebaf538221d467c87b193f2389f1225a41e1b2dfb60e23ffd8d0d428875cb6
|
7
|
+
data.tar.gz: 295d2b187c08d1a65a6533293756f73635ed6457ba57895f220b6b845cd38601d812dde4fdc056bc6330e295d0eecdf816a8ddf0f6959dcbbe2dbbf0fb5a8cc8
|
@@ -0,0 +1,18 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
updates:
|
4
|
+
- open-pull-requests-limit: 10
|
5
|
+
package-ecosystem: "bundler"
|
6
|
+
directory: "/"
|
7
|
+
schedule:
|
8
|
+
interval: "monthly"
|
9
|
+
reviewers:
|
10
|
+
- "noverde/developers"
|
11
|
+
|
12
|
+
- open-pull-requests-limit: 10
|
13
|
+
package-ecosystem: "github-actions"
|
14
|
+
directory: "/"
|
15
|
+
schedule:
|
16
|
+
interval: "monthly"
|
17
|
+
reviewers:
|
18
|
+
- "noverde/developers"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: RubyGem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
publish:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v3
|
14
|
+
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: "3.1"
|
19
|
+
|
20
|
+
- name: Install dependencies
|
21
|
+
run: bundle install
|
22
|
+
|
23
|
+
- name: Publish to RubyGems
|
24
|
+
uses: noverde/github-actions/push-rubygems@main
|
25
|
+
with:
|
26
|
+
rubygems_api_key: ${{ secrets.RUBYGEMS_TOKEN }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
os: [ubuntu-latest, macos-latest]
|
14
|
+
ruby: ["2.3.1", "2.7", "3.0", "3.1", "3.2"]
|
15
|
+
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v3
|
20
|
+
- name: Remove Gemfile.lock
|
21
|
+
run: rm Gemfile.lock
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby }}
|
26
|
+
bundler-cache: true
|
27
|
+
|
28
|
+
- name: Install dependencies
|
29
|
+
run: bundle install
|
30
|
+
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
*.gem
|
2
2
|
*.rbc
|
3
|
+
bin/
|
3
4
|
/.config
|
4
5
|
/coverage/
|
5
6
|
/InstalledFiles
|
@@ -29,8 +30,8 @@ build/
|
|
29
30
|
# for a library or gem, you might want to ignore these files since the code is
|
30
31
|
# intended to run in multiple environments; otherwise, check them in:
|
31
32
|
# Gemfile.lock
|
32
|
-
# .ruby-version
|
33
33
|
# .ruby-gemset
|
34
|
+
.ruby-version
|
34
35
|
|
35
36
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
37
|
.rvmrc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.7.0
|
4
|
+
|
5
|
+
* Implements `nominal` method (#35)
|
6
|
+
* Update dependencies (#32)
|
7
|
+
|
8
|
+
## 0.6.1
|
9
|
+
|
10
|
+
* Update dependencies (#25)
|
11
|
+
|
12
|
+
## 0.6.0
|
13
|
+
|
14
|
+
* Implements `effect` method (#21)
|
15
|
+
|
3
16
|
## 0.5.4
|
4
17
|
|
5
18
|
* Fix zero interest rate (#18)
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
exonio (0.
|
4
|
+
exonio (0.7.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
byebug (8.2.5)
|
10
|
-
coderay (1.1.
|
11
|
-
diff-lcs (1.
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.5.0)
|
12
12
|
method_source (1.0.0)
|
13
|
-
pry (0.
|
13
|
+
pry (0.14.1)
|
14
14
|
coderay (~> 1.1)
|
15
15
|
method_source (~> 1.0)
|
16
16
|
pry-byebug (3.3.0)
|
17
17
|
byebug (~> 8.0)
|
18
18
|
pry (~> 0.10)
|
19
|
-
rake (13.0.
|
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.
|
19
|
+
rake (13.0.6)
|
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
39
|
pry-byebug (~> 3.3.0)
|
41
40
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ This gem brings some useful Excel formulas to Ruby. For now, it just has
|
|
4
4
|
financial formulas, but could have more (like statistical formulas) in the future.
|
5
5
|
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/exonio.svg)](https://badge.fury.io/rb/exonio)
|
7
|
-
[![
|
7
|
+
[![Tests](https://github.com/noverde/exonio/actions/workflows/tests.yml/badge.svg)](https://github.com/noverde/exonio/actions)
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -32,6 +32,25 @@ To use Exonio you just have to call the method you like to use. Example:
|
|
32
32
|
|
33
33
|
## Available Formulas
|
34
34
|
|
35
|
+
### EFFECT
|
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.
|
38
|
+
Effective annual interest rate is the interest rate actually earned due to compounding.
|
39
|
+
More about this function [EFFECT](https://exceljet.net/excel-functions/excel-effect-function)
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
Exonio.effect(0.05, 10 * 12) # ==> 0.05126014873337037
|
43
|
+
```
|
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
|
+
|
35
54
|
### FV
|
36
55
|
|
37
56
|
What is the future value after 10 years of saving $100 now, with
|
data/exonio.gemspec
CHANGED
@@ -18,7 +18,6 @@ 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
23
|
spec.add_development_dependency "pry-byebug", "~> 3.3.0"
|
data/lib/exonio/financial.rb
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
module Exonio
|
2
2
|
module Financial
|
3
|
+
# Calculates the effective annual interest rate, given a nominal interest rate and the number of
|
4
|
+
# compounding periods. Nominal interest rate is the stated rate on the financial product.
|
5
|
+
# Effective annual interest rate is the interest rate actually earned due to compounding.
|
6
|
+
# constant-amount periodic payments and a constant interest rate.
|
7
|
+
#
|
8
|
+
# @param rate [Float] The nominal interest rate as decimal (not per cent) per period
|
9
|
+
# @param nper [Integer] The number of compounding periods
|
10
|
+
#
|
11
|
+
# @return [Float]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Exonio.effect(0.05, 12 * 10) # ==> 0.05126014873337037
|
15
|
+
#
|
16
|
+
def effect(rate, nper)
|
17
|
+
(1 + rate / nper) ** nper - 1
|
18
|
+
end
|
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
|
+
|
3
36
|
# Calculates the future value of an annuity investment based on
|
4
37
|
# constant-amount periodic payments and a constant interest rate.
|
5
38
|
#
|
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.0
|
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: 2023-08-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
|
@@ -74,17 +60,17 @@ executables: []
|
|
74
60
|
extensions: []
|
75
61
|
extra_rdoc_files: []
|
76
62
|
files:
|
63
|
+
- ".github/dependabot.yml"
|
64
|
+
- ".github/workflows/gem-push.yml"
|
65
|
+
- ".github/workflows/tests.yml"
|
77
66
|
- ".gitignore"
|
78
67
|
- ".rspec"
|
79
|
-
- ".travis.yml"
|
80
68
|
- CHANGELOG.md
|
81
69
|
- Gemfile
|
82
70
|
- Gemfile.lock
|
83
71
|
- LICENSE.md
|
84
72
|
- README.md
|
85
73
|
- Rakefile
|
86
|
-
- bin/console
|
87
|
-
- bin/setup
|
88
74
|
- exonio.gemspec
|
89
75
|
- lib/exonio.rb
|
90
76
|
- lib/exonio/financial.rb
|
@@ -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.
|
98
|
+
rubygems_version: 3.3.26
|
113
99
|
signing_key:
|
114
100
|
specification_version: 4
|
115
101
|
summary: Excel usefull formulas written in Ruby
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "exonio"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|