finrb 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/finrb.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/configurable'
4
+ require 'finrb/cashflows'
4
5
  require 'finrb/config'
5
6
  require 'finrb/decimal'
6
- require 'finrb/cashflows'
7
7
  require 'finrb/utils'
8
8
 
9
9
  class FinrbError < StandardError; end
metadata CHANGED
@@ -1,16 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadir Cohen
8
- - Martin Bjeldbak Madsen
9
- - Bill Kranec
10
- autorequire:
8
+ autorequire:
11
9
  bindir: bin
12
10
  cert_chain: []
13
- date: 2022-08-05 00:00:00.000000000 Z
11
+ date: 2023-01-21 00:00:00.000000000 Z
14
12
  dependencies:
15
13
  - !ruby/object:Gem::Dependency
16
14
  name: activesupport
@@ -26,6 +24,20 @@ dependencies:
26
24
  - - ">="
27
25
  - !ruby/object:Gem::Version
28
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bigdecimal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.1.2
29
41
  - !ruby/object:Gem::Dependency
30
42
  name: business_time
31
43
  requirement: !ruby/object:Gem::Requirement
@@ -55,7 +67,7 @@ dependencies:
55
67
  - !ruby/object:Gem::Version
56
68
  version: '0'
57
69
  - !ruby/object:Gem::Dependency
58
- name: minitest
70
+ name: pry
59
71
  requirement: !ruby/object:Gem::Requirement
60
72
  requirements:
61
73
  - - ">="
@@ -69,7 +81,7 @@ dependencies:
69
81
  - !ruby/object:Gem::Version
70
82
  version: '0'
71
83
  - !ruby/object:Gem::Dependency
72
- name: pry
84
+ name: rake
73
85
  requirement: !ruby/object:Gem::Requirement
74
86
  requirements:
75
87
  - - ">="
@@ -83,7 +95,7 @@ dependencies:
83
95
  - !ruby/object:Gem::Version
84
96
  version: '0'
85
97
  - !ruby/object:Gem::Dependency
86
- name: rake
98
+ name: rspec
87
99
  requirement: !ruby/object:Gem::Requirement
88
100
  requirements:
89
101
  - - ">="
@@ -111,7 +123,7 @@ dependencies:
111
123
  - !ruby/object:Gem::Version
112
124
  version: '0'
113
125
  - !ruby/object:Gem::Dependency
114
- name: rubocop-minitest
126
+ name: rubocop-packaging
115
127
  requirement: !ruby/object:Gem::Requirement
116
128
  requirements:
117
129
  - - ">="
@@ -153,7 +165,7 @@ dependencies:
153
165
  - !ruby/object:Gem::Version
154
166
  version: '0'
155
167
  - !ruby/object:Gem::Dependency
156
- name: semver
168
+ name: rubocop-rspec
157
169
  requirement: !ruby/object:Gem::Requirement
158
170
  requirements:
159
171
  - - ">="
@@ -167,7 +179,7 @@ dependencies:
167
179
  - !ruby/object:Gem::Version
168
180
  version: '0'
169
181
  - !ruby/object:Gem::Dependency
170
- name: solargraph
182
+ name: semver
171
183
  requirement: !ruby/object:Gem::Requirement
172
184
  requirements:
173
185
  - - ">="
@@ -180,70 +192,11 @@ dependencies:
180
192
  - - ">="
181
193
  - !ruby/object:Gem::Version
182
194
  version: '0'
183
- description: |+
184
- The finrb library (forked from the finance gem) provides a Ruby interface for financial calculations/modeling.
185
-
186
- - Working with interest rates
187
- - Mortgage amortization
188
- - Cashflows (NPV, IRR, etc.)
189
- - Computing bank discount yield (BDY) for a T-bill
190
- - Computing money market yield (MMY) for a T-bill
191
- - Cash ratio - Liquidity ratios measure the firm's ability to satisfy its short-term obligations as they come due.
192
- - Computing Coefficient of variation
193
- - Cost of goods sold and ending inventory under three methods (FIFO,LIFO,Weighted average)
194
- - Current ratio - Liquidity ratios measure the firm's ability to satisfy its short-term obligations as they come due.
195
- - Depreciation Expense Recognition - double-declining balance (DDB), the most common declining balance method, which applies two times the straight-line rate to the declining balance.
196
- - Debt ratio - Solvency ratios measure the firm's ability to satisfy its long-term obligations.
197
- - Diluted Earnings Per Share
198
- - Computing the rate of return for each period
199
- - Convert stated annual rate to the effective annual rate
200
- - Convert stated annual rate to the effective annual rate with continuous compounding
201
- - Bond-equivalent yield (BEY), 2 x the semiannual discount rate
202
- - Computing HPR, the holding period return
203
- - Equivalent/proportional Interest Rates
204
- - Basic Earnings Per Share
205
- - Financial leverage - Solvency ratios measure the firm's ability to satisfy its long-term obligations.
206
- - Estimate future value (fv)
207
- - Estimate future value of an annuity
208
- - Estimate future value (fv) of a single sum
209
- - Computing the future value of an uneven cash flow series
210
- - Geometric mean return
211
- - Gross profit margin - Evaluate a company's financial performance
212
- - Harmonic mean, average price
213
- - Computing HPR, the holding period return
214
- - Bond-equivalent yield (BEY), 2 x the semiannual discount rate
215
- - Convert holding period return to the effective annual rate
216
- - Computing money market yield (MMY) for a T-bill
217
- - Computing IRR, the internal rate of return
218
- - Calculate the net increase in common shares from the potential exercise of stock options or warrants
219
- - Long-term debt-to-equity - Solvency ratios measure the firm's ability to satisfy its long-term obligations.
220
- - Computing HPR, the holding period return
221
- - Estimate the number of periods
222
- - Net profit margin - Evaluate a company's financial performance
223
- - Computing NPV, the PV of the cash flows less the initial (time = 0) outlay
224
- - Estimate period payment
225
- - Estimate present value (pv)
226
- - Estimate present value (pv) of an annuity
227
- - Estimate present value of a perpetuity
228
- - Estimate present value (pv) of a single sum
229
- - Computing the present value of an uneven cash flow series
230
- - Quick ratio - Liquidity ratios measure the firm's ability to satisfy its short-term obligations as they come due.
231
- - Convert a given norminal rate to a continuous compounded rate
232
- - Convert a given continuous compounded rate to a norminal rate
233
- - Rate of return for a perpetuity
234
- - Computing Sampling error
235
- - Computing Roy's safety-first ratio
236
- - Computing Sharpe Ratio
237
- - Depreciation Expense Recognition - Straight-line depreciation (SL) allocates an equal amount of depreciation each year over the asset's useful life
238
- - Total debt-to-equity - Solvency ratios measure the firm's ability to satisfy its long-term obligations.
239
- - Computing TWRR, the time-weighted rate of return
240
- - Calculate weighted average shares - weighted average number of common shares
241
- - Weighted mean as a portfolio return
242
-
195
+ description: "The finrb library (forked from the finance gem) provides a Ruby interface
196
+ for financial calculations/modeling. Working with interest rates, Mortgage amortization,
197
+ Cashflows (NPV, IRR, etc.) and other basic utilities.\n\n"
243
198
  email:
244
199
  - nadircs11@gmail.com
245
- - me@martinbjeldbak.com
246
- - wkranec@gmail.com
247
200
  executables: []
248
201
  extensions: []
249
202
  extra_rdoc_files:
@@ -252,25 +205,10 @@ extra_rdoc_files:
252
205
  - COPYING.LESSER
253
206
  - CHANGELOG.md
254
207
  files:
255
- - ".dockerignore"
256
- - ".gitattributes"
257
- - ".gitignore"
258
- - ".rubocop.yml"
259
- - ".ruby-version"
260
- - ".semver"
261
- - ".travis.yml"
262
- - ".yardopts"
263
208
  - CHANGELOG.md
264
209
  - COPYING
265
210
  - COPYING.LESSER
266
- - Dockerfile
267
- - Gemfile
268
- - Gemfile.lock
269
211
  - README.md
270
- - Rakefile
271
- - docs/.gitkeep
272
- - docs/api.md
273
- - finrb.gemspec
274
212
  - lib/finrb.rb
275
213
  - lib/finrb/amortization.rb
276
214
  - lib/finrb/cashflows.rb
@@ -284,7 +222,7 @@ licenses:
284
222
  - LGPL-3.0
285
223
  metadata:
286
224
  rubygems_mfa_required: 'true'
287
- post_install_message:
225
+ post_install_message:
288
226
  rdoc_options: []
289
227
  require_paths:
290
228
  - lib
@@ -299,8 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
237
  - !ruby/object:Gem::Version
300
238
  version: '0'
301
239
  requirements: []
302
- rubygems_version: 3.3.7
303
- signing_key:
240
+ rubygems_version: 3.4.1
241
+ signing_key:
304
242
  specification_version: 4
305
243
  summary: Ruby gem for financial calculations/modeling
306
244
  test_files: []
data/.dockerignore DELETED
@@ -1,2 +0,0 @@
1
- .dockerignore
2
- Dockerfile
data/.gitattributes DELETED
@@ -1,83 +0,0 @@
1
- # Common settings that generally should always be used with your language specific settings
2
-
3
- # Auto detect text files and perform LF normalization
4
- * text=auto
5
-
6
- #
7
- # The above will handle all files NOT found below
8
- #
9
-
10
- # Documents
11
- *.bibtex text diff=bibtex
12
- *.doc diff=astextplain
13
- *.DOC diff=astextplain
14
- *.docx diff=astextplain
15
- *.DOCX diff=astextplain
16
- *.dot diff=astextplain
17
- *.DOT diff=astextplain
18
- *.pdf diff=astextplain
19
- *.PDF diff=astextplain
20
- *.rtf diff=astextplain
21
- *.RTF diff=astextplain
22
- *.md text diff=markdown
23
- *.mdx text diff=markdown
24
- *.tex text diff=tex
25
- *.adoc text
26
- *.textile text
27
- *.mustache text
28
- *.csv text
29
- *.tab text
30
- *.tsv text
31
- *.txt text
32
- *.sql text
33
- *.epub diff=astextplain
34
-
35
- # Graphics
36
- *.png binary
37
- *.jpg binary
38
- *.jpeg binary
39
- *.gif binary
40
- *.tif binary
41
- *.tiff binary
42
- *.ico binary
43
- # SVG treated as text by default.
44
- *.svg text
45
- # If you want to treat it as binary,
46
- # use the following line instead.
47
- # *.svg binary
48
- *.eps binary
49
-
50
- # Scripts
51
- *.bash text eol=lf
52
- *.fish text eol=lf
53
- *.sh text eol=lf
54
- *.zsh text eol=lf
55
- # These are explicitly windows files and should use crlf
56
- *.bat text eol=crlf
57
- *.cmd text eol=crlf
58
- *.ps1 text eol=crlf
59
-
60
- # Serialisation
61
- *.json text
62
- *.toml text
63
- *.xml text
64
- *.yaml text
65
- *.yml text
66
-
67
- # Archives
68
- *.7z binary
69
- *.gz binary
70
- *.tar binary
71
- *.tgz binary
72
- *.zip binary
73
-
74
- # Text files where line endings should be preserved
75
- *.patch -text
76
-
77
- #
78
- # Exclude files from exporting
79
- #
80
-
81
- .gitattributes export-ignore
82
- .gitignore export-ignore
83
- .gitkeep export-ignore
data/.gitignore DELETED
@@ -1,114 +0,0 @@
1
- # Used by dotenv library to load environment variables.
2
- # .env
3
-
4
- # Ignore Byebug command history file.
5
- .byebug_history
6
-
7
- ## Specific to RubyMotion:
8
- .dat*
9
- .repl_history
10
- build/
11
- *.bridgesupport
12
- build-iPhoneOS/
13
- build-iPhoneSimulator/
14
-
15
- ## Specific to RubyMotion (use of CocoaPods):
16
- #
17
- # We recommend against adding the Pods directory to your .gitignore. However
18
- # you should judge for yourself, the pros and cons are mentioned at:
19
- # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
20
- #
21
- # vendor/Pods/
22
-
23
- ## Documentation cache and generated files:
24
- /.yardoc/
25
- /_yardoc/
26
- /doc/
27
- /rdoc/
28
-
29
- ## Environment normalization:
30
- /.bundle/
31
- /vendor/bundle
32
- /lib/bundler/man/
33
-
34
- # for a library or gem, you might want to ignore these files since the code is
35
- # intended to run in multiple environments; otherwise, check them in:
36
- # Gemfile.lock
37
- # .ruby-version
38
- # .ruby-gemset
39
-
40
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
41
- .rvmrc
42
-
43
- # Used by RuboCop. Remote config files pulled in from inherit_from directive.
44
- # .rubocop-https?--*
45
-
46
- *.rbc
47
- capybara-*.html
48
- .rspec
49
- /db/*.sqlite3
50
- /db/*.sqlite3-journal
51
- /db/*.sqlite3-[0-9]*
52
- /public/system
53
- /coverage/
54
- /spec/tmp
55
- *.orig
56
- rerun.txt
57
- pickle-email-*.html
58
-
59
- # Ignore all logfiles and tempfiles.
60
- /log/*
61
- /tmp/*
62
- !/log/.keep
63
- !/tmp/.keep
64
-
65
- # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
66
- config/initializers/secret_token.rb
67
- config/master.key
68
-
69
- # Only include if you have production secrets in this file, which is no longer a Rails default
70
- # config/secrets.yml
71
-
72
- # dotenv, dotenv-rails
73
- # TODO Comment out these rules if environment variables can be committed
74
- .env
75
- .env*.local
76
-
77
- ## Environment normalization:
78
- /.bundle
79
- /vendor/bundle
80
-
81
- # these should all be checked in to normalize the environment:
82
- # Gemfile.lock, .ruby-version, .ruby-gemset
83
-
84
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
85
- .rvmrc
86
-
87
- # if using bower-rails ignore default bower_components path bower.json files
88
- /vendor/assets/bower_components
89
- *.bowerrc
90
- bower.json
91
-
92
- # Ignore pow environment settings
93
- .powenv
94
-
95
- # Ignore Byebug command history file.
96
- .byebug_history
97
-
98
- # Ignore node_modules
99
- node_modules/
100
-
101
- # Ignore precompiled javascript packs
102
- /public/packs
103
- /public/packs-test
104
- /public/assets
105
-
106
- # Ignore yarn files
107
- /yarn-error.log
108
- yarn-debug.log*
109
- .yarn-integrity
110
-
111
- # Ignore uploaded files in development
112
- /storage/*
113
- !/storage/.keep
114
- /public/uploads
data/.rubocop.yml DELETED
@@ -1,19 +0,0 @@
1
- require:
2
- - rubocop-performance
3
- - rubocop-rake
4
- - rubocop-minitest
5
-
6
- Lint/NumberConversion:
7
- Enabled: false
8
-
9
- AllCops:
10
- TargetRubyVersion: 3.0
11
- EnabledByDefault: true
12
- NewCops: enable
13
- UseCache: true
14
- Exclude:
15
- - '.git/**/*'
16
- - 'tmp/**/*'
17
- - 'bin/**/*'
18
- CacheRootDirectory: tmp
19
- MaxFilesInCache: 36000
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.1.2
data/.semver DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 0
3
- :minor: 0
4
- :patch: 1
5
- :special: ''
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- cache:
3
- bundler: true
4
- rvm:
5
- - '3.1.2'
6
- script:
7
- - bundle exec rake test_units
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- --no-private lib/**/*.rb - COPYING COPYING.LESSER HISTORY README
data/Dockerfile DELETED
@@ -1,35 +0,0 @@
1
- FROM ruby:3.1.2 AS development
2
-
3
- LABEL maintainer="nadircs11@gmail.co.il"
4
-
5
- RUN dpkg --add-architecture i386
6
-
7
- SHELL [ "/bin/bash", "-c" ]
8
-
9
- RUN apt update -yqq && \
10
- apt install --no-install-recommends -yqq nano apt-utils locales && \
11
- apt clean && \
12
- rm -rf /var/lib/apt/lists/*
13
-
14
- RUN gem install bundler
15
- RUN bundle config --global jobs 16
16
-
17
- RUN mkdir -pv /app
18
- WORKDIR /app
19
-
20
- RUN mkdir -pv ./lib/
21
- COPY *.gemspec ./
22
- COPY Gemfile* ./
23
- RUN bundle install
24
-
25
- WORKDIR /app
26
-
27
- COPY . .
28
-
29
- ENTRYPOINT ["/bin/bash", "-c", "/bin/bash"]
30
-
31
- FROM development AS testing
32
-
33
- RUN bundle exec rake test_units || exit 0
34
-
35
- ENTRYPOINT ["/bin/bash", "-c", "/bin/bash"]
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'http://rubygems.org'
4
-
5
- gemspec
data/Gemfile.lock DELETED
@@ -1,116 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- finrb (0.0.1)
5
- activesupport
6
- business_time
7
- flt
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activesupport (7.0.3.1)
13
- concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 1.6, < 2)
15
- minitest (>= 5.1)
16
- tzinfo (~> 2.0)
17
- ast (2.4.2)
18
- backport (1.2.0)
19
- benchmark (0.2.0)
20
- business_time (0.13.0)
21
- activesupport (>= 3.2.0)
22
- tzinfo
23
- coderay (1.1.3)
24
- concurrent-ruby (1.1.10)
25
- diff-lcs (1.5.0)
26
- e2mmap (0.1.0)
27
- flt (1.5.4)
28
- i18n (1.12.0)
29
- concurrent-ruby (~> 1.0)
30
- jaro_winkler (1.5.4)
31
- json (2.6.2)
32
- kramdown (2.4.0)
33
- rexml
34
- kramdown-parser-gfm (1.1.0)
35
- kramdown (~> 2.0)
36
- method_source (1.0.0)
37
- mini_portile2 (2.8.0)
38
- minitest (5.16.2)
39
- nokogiri (1.13.8)
40
- mini_portile2 (~> 2.8.0)
41
- racc (~> 1.4)
42
- parallel (1.22.1)
43
- parser (3.1.2.0)
44
- ast (~> 2.4.1)
45
- pry (0.14.1)
46
- coderay (~> 1.1)
47
- method_source (~> 1.0)
48
- racc (1.6.0)
49
- rainbow (3.1.1)
50
- rake (13.0.6)
51
- regexp_parser (2.5.0)
52
- reverse_markdown (2.1.1)
53
- nokogiri
54
- rexml (3.2.5)
55
- rubocop (1.33.0)
56
- json (~> 2.3)
57
- parallel (~> 1.10)
58
- parser (>= 3.1.0.0)
59
- rainbow (>= 2.2.2, < 4.0)
60
- regexp_parser (>= 1.8, < 3.0)
61
- rexml (>= 3.2.5, < 4.0)
62
- rubocop-ast (>= 1.19.1, < 2.0)
63
- ruby-progressbar (~> 1.7)
64
- unicode-display_width (>= 1.4.0, < 3.0)
65
- rubocop-ast (1.19.1)
66
- parser (>= 3.1.1.0)
67
- rubocop-minitest (0.21.0)
68
- rubocop (>= 0.90, < 2.0)
69
- rubocop-performance (1.14.3)
70
- rubocop (>= 1.7.0, < 2.0)
71
- rubocop-ast (>= 0.4.0)
72
- rubocop-rake (0.6.0)
73
- rubocop (~> 1.0)
74
- ruby-progressbar (1.11.0)
75
- semver (1.0.1)
76
- solargraph (0.45.0)
77
- backport (~> 1.2)
78
- benchmark
79
- bundler (>= 1.17.2)
80
- diff-lcs (~> 1.4)
81
- e2mmap
82
- jaro_winkler (~> 1.5)
83
- kramdown (~> 2.3)
84
- kramdown-parser-gfm (~> 1.1)
85
- parser (~> 3.0)
86
- reverse_markdown (>= 1.0.5, < 3)
87
- rubocop (>= 0.52)
88
- thor (~> 1.0)
89
- tilt (~> 2.0)
90
- yard (~> 0.9, >= 0.9.24)
91
- thor (1.2.1)
92
- tilt (2.0.11)
93
- tzinfo (2.0.5)
94
- concurrent-ruby (~> 1.0)
95
- unicode-display_width (2.2.0)
96
- webrick (1.7.0)
97
- yard (0.9.28)
98
- webrick (~> 1.7.0)
99
-
100
- PLATFORMS
101
- ruby
102
-
103
- DEPENDENCIES
104
- finrb!
105
- minitest
106
- pry
107
- rake
108
- rubocop
109
- rubocop-minitest
110
- rubocop-performance
111
- rubocop-rake
112
- semver
113
- solargraph
114
-
115
- BUNDLED WITH
116
- 1.17.2
data/Rakefile DELETED
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rake'
4
- require 'rake/testtask'
5
-
6
- task default: [:test_units]
7
-
8
- Rake::TestTask.new('test_units') do |t|
9
- t.pattern = 'test/*.rb'
10
- t.verbose = true
11
- t.warning = true
12
- end
13
-
14
- namespace :docker do
15
- desc 'Build docker instance'
16
- task :build do
17
- Dir.chdir(__dir__.to_s) do
18
- system 'docker build --target development -t finrb:1.0 -f Dockerfile .'
19
- end
20
- end
21
-
22
- desc 'Run test docker build'
23
- task :test do
24
- Dir.chdir(__dir__.to_s) do
25
- system 'docker build --target testing -t finrb:1.0 -f Dockerfile .'
26
- end
27
- end
28
-
29
- desc 'Run dev docker instance'
30
- task :run do
31
- system 'docker run --init -it --rm finrb:1.0'
32
- end
33
- end
data/docs/.gitkeep DELETED
File without changes