blend_spreadsheet_loan_generator 0.1.10 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blend_spreadsheet_loan_generator/concerns/csv_concern.rb +21 -0
- data/lib/blend_spreadsheet_loan_generator/concerns/spreadsheet_concern.rb +1 -0
- data/lib/blend_spreadsheet_loan_generator/early_repay.rb +4 -3
- data/lib/blend_spreadsheet_loan_generator/realistic_interests.rb +1 -2
- data/lib/blend_spreadsheet_loan_generator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41bd051665f94b48954cb0d2067a075a9740eb8da3e72b672be25a724ffdeee2
|
4
|
+
data.tar.gz: 17a1bbd4686e4a92a7da7720de63f71a5387455563e1853b1bce25508556187b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a55ddabdf7e9b46f56a66cb6c9a2aafd02144a3776ad6ad575f90e922636c08a08448037941e16996ac5794cd51dc046e250a5c147dfa1e352f858fef78817'
|
7
|
+
data.tar.gz: 2ae1b8b409995fef289f60148cbdd73d44a9402664d5b894f2fc83f556bee1055f0bcd1eff56f085773b095cc173f09ca9529425517f6060b1b1f2d974b543fd
|
@@ -27,3 +27,24 @@ module BlendSpreadsheetLoanGenerator
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
|
32
|
+
def generate_csv(data:, name:)
|
33
|
+
CSV.open(name, 'wb') do |csv|
|
34
|
+
data.each do |datum|
|
35
|
+
row = []
|
36
|
+
datum.each.with_index do |value, index|
|
37
|
+
row << (
|
38
|
+
if index == 0
|
39
|
+
value.to_i
|
40
|
+
elsif index == 1
|
41
|
+
Date.parse(value).strftime('%m/%d/%Y')
|
42
|
+
else
|
43
|
+
value.gsub(',', '.').to_f
|
44
|
+
end
|
45
|
+
)
|
46
|
+
end
|
47
|
+
csv << row
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -12,6 +12,7 @@ module BlendSpreadsheetLoanGenerator
|
|
12
12
|
argument :from_path, type: :string, required: true, desc: 'csv to restructure'
|
13
13
|
argument :rate, type: :float, required: true, desc: 'year rate post restructuration'
|
14
14
|
|
15
|
+
option :duration, type: :integer, desc: 'duration'
|
15
16
|
option :period_duration, type: :integer, default: 1, desc: 'duration of a period in months'
|
16
17
|
option :due_on, type: :date, default: Date.today, desc: 'date of the pay day of the first period DD/MM/YYYY'
|
17
18
|
option :deferred_and_capitalized, type: :integer, default: 0, desc: 'periods with no capital or interests paid'
|
@@ -54,7 +55,7 @@ module BlendSpreadsheetLoanGenerator
|
|
54
55
|
if total_to_be_paid == amount_paid
|
55
56
|
1
|
56
57
|
else
|
57
|
-
values.last[:index] - values[last_paid_line][:index]
|
58
|
+
options.fetch(:duration, values.last[:index] - values[last_paid_line][:index])
|
58
59
|
end
|
59
60
|
)
|
60
61
|
|
@@ -94,7 +95,7 @@ module BlendSpreadsheetLoanGenerator
|
|
94
95
|
excel_float(values[last_paid_line][:remaining_capital_end])
|
95
96
|
|
96
97
|
worksheet[2, columns.index('remaining_capital_end') + 1] =
|
97
|
-
"=#{excel_float(values[last_paid_line][:remaining_capital_end]
|
98
|
+
"=#{excel_float(values[last_paid_line][:remaining_capital_end])} - #{period_capital(2)}"
|
98
99
|
|
99
100
|
worksheet[2, columns.index('period_interests') + 1] =
|
100
101
|
"=ARRONDI(#{period_theoric_interests(2)}; 2)"
|
@@ -103,7 +104,7 @@ module BlendSpreadsheetLoanGenerator
|
|
103
104
|
"=#{excel_float(values[last_paid_line + 1][:period_calculated_interests])}"
|
104
105
|
|
105
106
|
worksheet[2, columns.index('period_fees') + 1] =
|
106
|
-
"=#{excel_float(values[last_paid_line + 1][:
|
107
|
+
"=#{excel_float(values[last_paid_line + 1][:period_calculated_fees])}"
|
107
108
|
|
108
109
|
worksheet[2, columns.index('period_capital') + 1] =
|
109
110
|
"=#{excel_float(capital_paid)} - #{period_interests(2)} - #{period_fees(2)}"
|
@@ -11,8 +11,7 @@ module BlendSpreadsheetLoanGenerator
|
|
11
11
|
"=#{excel_float(loan.rate)} * ((#{period_leap_days(line)} / 366) + (#{period_non_leap_days(line)} / 365))"
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
def period_fees_rate_formula(*)
|
14
|
+
def period_fees_rate_formula(line:)
|
16
15
|
"=#{excel_float(loan.fees_rate)} * ((#{period_leap_days(line)} / 366) + (#{period_non_leap_days(line)} / 365))"
|
17
16
|
end
|
18
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blend_spreadsheet_loan_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MZiserman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|