finrb 0.0.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 +7 -0
- data/.dockerignore +2 -0
- data/.gitattributes +83 -0
- data/.gitignore +114 -0
- data/.rubocop.yml +19 -0
- data/.ruby-version +1 -0
- data/.semver +5 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +74 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/Dockerfile +35 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +116 -0
- data/README.md +99 -0
- data/Rakefile +33 -0
- data/docs/.gitkeep +0 -0
- data/docs/api.md +1104 -0
- data/finrb.gemspec +98 -0
- data/lib/finrb/amortization.rb +199 -0
- data/lib/finrb/cashflows.rb +171 -0
- data/lib/finrb/config.rb +11 -0
- data/lib/finrb/decimal.rb +23 -0
- data/lib/finrb/rates.rb +167 -0
- data/lib/finrb/transaction.rb +124 -0
- data/lib/finrb/utils.rb +1171 -0
- data/lib/finrb.rb +23 -0
- metadata +306 -0
data/lib/finrb.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/configurable'
|
4
|
+
require 'finrb/config'
|
5
|
+
require 'finrb/decimal'
|
6
|
+
require 'finrb/cashflows'
|
7
|
+
require 'finrb/utils'
|
8
|
+
|
9
|
+
class FinrbError < StandardError; end
|
10
|
+
|
11
|
+
# The *Finrb* module adheres to the following conventions for
|
12
|
+
# financial calculations:
|
13
|
+
#
|
14
|
+
# * Positive values represent cash inflows (money received); negative
|
15
|
+
# values represent cash outflows (payments).
|
16
|
+
# * *principal* represents the outstanding balance of a loan or annuity.
|
17
|
+
# * *rate* represents the interest rate _per period_.
|
18
|
+
module Finrb
|
19
|
+
autoload :Amortization, 'finrb/amortization'
|
20
|
+
autoload :Rate, 'finrb/rates'
|
21
|
+
autoload :Transaction, 'finrb/transaction'
|
22
|
+
autoload :Utils, 'finrb/utils'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,306 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: finrb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nadir Cohen
|
8
|
+
- Martin Bjeldbak Madsen
|
9
|
+
- Bill Kranec
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: business_time
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: flt
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: minitest
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: pry
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rake
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: rubocop
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rubocop-minitest
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: rubocop-performance
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: rubocop-rake
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
- !ruby/object:Gem::Dependency
|
156
|
+
name: semver
|
157
|
+
requirement: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
type: :development
|
163
|
+
prerelease: false
|
164
|
+
version_requirements: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: solargraph
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
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
|
+
|
243
|
+
email:
|
244
|
+
- nadircs11@gmail.com
|
245
|
+
- me@martinbjeldbak.com
|
246
|
+
- wkranec@gmail.com
|
247
|
+
executables: []
|
248
|
+
extensions: []
|
249
|
+
extra_rdoc_files:
|
250
|
+
- README.md
|
251
|
+
- COPYING
|
252
|
+
- COPYING.LESSER
|
253
|
+
- CHANGELOG.md
|
254
|
+
files:
|
255
|
+
- ".dockerignore"
|
256
|
+
- ".gitattributes"
|
257
|
+
- ".gitignore"
|
258
|
+
- ".rubocop.yml"
|
259
|
+
- ".ruby-version"
|
260
|
+
- ".semver"
|
261
|
+
- ".travis.yml"
|
262
|
+
- ".yardopts"
|
263
|
+
- CHANGELOG.md
|
264
|
+
- COPYING
|
265
|
+
- COPYING.LESSER
|
266
|
+
- Dockerfile
|
267
|
+
- Gemfile
|
268
|
+
- Gemfile.lock
|
269
|
+
- README.md
|
270
|
+
- Rakefile
|
271
|
+
- docs/.gitkeep
|
272
|
+
- docs/api.md
|
273
|
+
- finrb.gemspec
|
274
|
+
- lib/finrb.rb
|
275
|
+
- lib/finrb/amortization.rb
|
276
|
+
- lib/finrb/cashflows.rb
|
277
|
+
- lib/finrb/config.rb
|
278
|
+
- lib/finrb/decimal.rb
|
279
|
+
- lib/finrb/rates.rb
|
280
|
+
- lib/finrb/transaction.rb
|
281
|
+
- lib/finrb/utils.rb
|
282
|
+
homepage: https://rubygems.org/gems/finrb
|
283
|
+
licenses:
|
284
|
+
- LGPL-3.0
|
285
|
+
metadata:
|
286
|
+
rubygems_mfa_required: 'true'
|
287
|
+
post_install_message:
|
288
|
+
rdoc_options: []
|
289
|
+
require_paths:
|
290
|
+
- lib
|
291
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
292
|
+
requirements:
|
293
|
+
- - ">="
|
294
|
+
- !ruby/object:Gem::Version
|
295
|
+
version: '3.0'
|
296
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
297
|
+
requirements:
|
298
|
+
- - ">="
|
299
|
+
- !ruby/object:Gem::Version
|
300
|
+
version: '0'
|
301
|
+
requirements: []
|
302
|
+
rubygems_version: 3.3.7
|
303
|
+
signing_key:
|
304
|
+
specification_version: 4
|
305
|
+
summary: Ruby gem for financial calculations/modeling
|
306
|
+
test_files: []
|