loan_creator 0.12.0 → 0.12.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 +5 -0
- data/lib/loan_creator/bullet.rb +13 -10
- data/lib/loan_creator/common.rb +17 -0
- data/lib/loan_creator/linear.rb +2 -15
- data/lib/loan_creator/standard.rb +2 -14
- data/lib/loan_creator/uncapitalized_bullet.rb +2 -1
- data/lib/loan_creator/version.rb +1 -1
- data/loan_creator.gemspec +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e7d8a7b39adf42e2c93e977c82ecf6c53f5695716cc5ef291a6b5a0963e0dd5
|
|
4
|
+
data.tar.gz: a4ed3fcf50360222a3795846d0d1ec3367126b851e6381a8ffbfc98ba972a709
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6e6465cc26a14667894139cc4f57e1bab128ebd77a01559d2b04d1ba77b3aecc9c5ec457fe5ba7a1c1cea4ac9f7021fa6f26d16646f6241167ade85b9251d98
|
|
7
|
+
data.tar.gz: 144466496ce6a6b8895fca5657cf07db090e0ca8834b04ac84631a0dbfe71e89d8dfce2d8697358f905486edae636b1014cc049597c267fa0ec829088966d406
|
data/CHANGELOG.md
CHANGED
data/lib/loan_creator/bullet.rb
CHANGED
|
@@ -33,16 +33,19 @@ module LoanCreator
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def compute_capitalized_interests(timetable)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
periodic_theoric_interests =
|
|
37
|
+
if multi_part_interests_calculation && term_dates? && (timetable_term_dates[timetable.current_index] + 1.year) < @due_on
|
|
38
|
+
multi_part_interests(
|
|
39
|
+
timetable_term_dates[timetable.current_index],
|
|
40
|
+
@due_on,
|
|
41
|
+
annual_interests_rate,
|
|
42
|
+
amount_to_capitalize
|
|
43
|
+
)
|
|
44
|
+
else
|
|
45
|
+
compute_period_generated_interests(periodic_interests_rate(timetable_term_dates[timetable.current_index], @due_on))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
apply_interests_roundings(periodic_theoric_interests)
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
def compute_term(timetable)
|
data/lib/loan_creator/common.rb
CHANGED
|
@@ -295,5 +295,22 @@ module LoanCreator
|
|
|
295
295
|
def amount_to_capitalize
|
|
296
296
|
@crd_beginning_of_period + @due_interests_beginning_of_period
|
|
297
297
|
end
|
|
298
|
+
|
|
299
|
+
def apply_interests_roundings(periodic_theoric_interests)
|
|
300
|
+
@period_theoric_interests = periodic_theoric_interests
|
|
301
|
+
@delta_interests = @period_theoric_interests - @period_theoric_interests.round(2)
|
|
302
|
+
@accrued_delta_interests += @delta_interests
|
|
303
|
+
@amount_to_add = bigd(
|
|
304
|
+
if @accrued_delta_interests >= bigd('0.01')
|
|
305
|
+
'0.01'
|
|
306
|
+
elsif @accrued_delta_interests <= bigd('-0.01')
|
|
307
|
+
'-0.01'
|
|
308
|
+
else
|
|
309
|
+
'0'
|
|
310
|
+
end
|
|
311
|
+
)
|
|
312
|
+
@accrued_delta_interests -= @amount_to_add
|
|
313
|
+
@period_theoric_interests.round(2) + @amount_to_add
|
|
314
|
+
end
|
|
298
315
|
end
|
|
299
316
|
end
|
data/lib/loan_creator/linear.rb
CHANGED
|
@@ -28,7 +28,7 @@ module LoanCreator
|
|
|
28
28
|
@crd_beginning_of_period = @crd_end_of_period
|
|
29
29
|
@due_interests_beginning_of_period = @due_interests_end_of_period
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
period_theoric_interests =
|
|
32
32
|
# if period is more than a year
|
|
33
33
|
if multi_part_interests_calculation && term_dates? && (timetable_term_dates[timetable.current_index] + 1.year) < @due_on
|
|
34
34
|
multi_part_interests(
|
|
@@ -40,21 +40,8 @@ module LoanCreator
|
|
|
40
40
|
else
|
|
41
41
|
period_theoric_interests(periodic_interests_rate(timetable_term_dates[timetable.current_index], @due_on))
|
|
42
42
|
end
|
|
43
|
-
)
|
|
44
43
|
|
|
45
|
-
@
|
|
46
|
-
@accrued_delta_interests += @delta_interests
|
|
47
|
-
@amount_to_add = bigd(
|
|
48
|
-
if @accrued_delta_interests >= bigd('0.01')
|
|
49
|
-
'0.01'
|
|
50
|
-
elsif @accrued_delta_interests <= bigd('-0.01')
|
|
51
|
-
'-0.01'
|
|
52
|
-
else
|
|
53
|
-
'0'
|
|
54
|
-
end
|
|
55
|
-
)
|
|
56
|
-
@accrued_delta_interests -= @amount_to_add
|
|
57
|
-
@period_interests = @period_theoric_interests.round(2) + @amount_to_add
|
|
44
|
+
@period_interests = apply_interests_roundings(period_theoric_interests)
|
|
58
45
|
@period_capital = period_capital
|
|
59
46
|
@total_paid_capital_end_of_period += @period_capital
|
|
60
47
|
@total_paid_interests_end_of_period += @period_interests
|
|
@@ -27,20 +27,8 @@ module LoanCreator
|
|
|
27
27
|
computed_periodic_interests_rate = periodic_interests_rate(timetable_term_dates[timetable.current_index], @due_on)
|
|
28
28
|
|
|
29
29
|
@crd_beginning_of_period = @crd_end_of_period
|
|
30
|
-
|
|
31
|
-
@
|
|
32
|
-
@accrued_delta_interests += @delta_interests
|
|
33
|
-
@amount_to_add = bigd(
|
|
34
|
-
if @accrued_delta_interests >= bigd('0.01')
|
|
35
|
-
'0.01'
|
|
36
|
-
elsif @accrued_delta_interests <= bigd('-0.01')
|
|
37
|
-
'-0.01'
|
|
38
|
-
else
|
|
39
|
-
'0'
|
|
40
|
-
end
|
|
41
|
-
)
|
|
42
|
-
@accrued_delta_interests -= @amount_to_add
|
|
43
|
-
@period_interests = @period_theoric_interests.round(2) + @amount_to_add
|
|
30
|
+
|
|
31
|
+
@period_interests = apply_interests_roundings(period_theoric_interests(@index, computed_periodic_interests_rate))
|
|
44
32
|
@period_capital = period_capital(@index, computed_periodic_interests_rate)
|
|
45
33
|
@total_paid_capital_end_of_period += @period_capital
|
|
46
34
|
@total_paid_interests_end_of_period += @period_interests
|
|
@@ -34,7 +34,8 @@ module LoanCreator
|
|
|
34
34
|
|
|
35
35
|
def compute_interests(due_date, timetable)
|
|
36
36
|
computed_periodic_interests_rate = periodic_interests_rate(timetable_term_dates[timetable.current_index], due_date)
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
apply_interests_roundings(amount.mult(bigd(computed_periodic_interests_rate), BIG_DECIMAL_DIGITS))
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def compute_term(timetable)
|
data/lib/loan_creator/version.rb
CHANGED
data/loan_creator.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: loan_creator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.12.
|
|
4
|
+
version: 0.12.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thibaulth
|
|
@@ -9,10 +9,10 @@ authors:
|
|
|
9
9
|
- younes.serraj
|
|
10
10
|
- Antoine Becquet
|
|
11
11
|
- Jerome Drevet
|
|
12
|
-
autorequire:
|
|
12
|
+
autorequire:
|
|
13
13
|
bindir: exe
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date: 2022-
|
|
15
|
+
date: 2022-08-04 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: bundler
|
|
@@ -140,7 +140,7 @@ dependencies:
|
|
|
140
140
|
- - ">="
|
|
141
141
|
- !ruby/object:Gem::Version
|
|
142
142
|
version: '0'
|
|
143
|
-
description:
|
|
143
|
+
description:
|
|
144
144
|
email:
|
|
145
145
|
- thibault@capsens.eu
|
|
146
146
|
- nicolas.besnard@capsens.eu
|
|
@@ -188,7 +188,7 @@ homepage: https://github.com/CapSens/loan-creator
|
|
|
188
188
|
licenses:
|
|
189
189
|
- MIT
|
|
190
190
|
metadata: {}
|
|
191
|
-
post_install_message:
|
|
191
|
+
post_install_message:
|
|
192
192
|
rdoc_options: []
|
|
193
193
|
require_paths:
|
|
194
194
|
- lib
|
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
204
204
|
version: '0'
|
|
205
205
|
requirements: []
|
|
206
206
|
rubygems_version: 3.1.2
|
|
207
|
-
signing_key:
|
|
207
|
+
signing_key:
|
|
208
208
|
specification_version: 4
|
|
209
209
|
summary: Create and update timetables from input data
|
|
210
210
|
test_files: []
|