[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 671e3f2 05/25: Almost move two blocks of code
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 671e3f2 05/25: Almost move two blocks of code |
Date: |
Wed, 24 Feb 2021 19:00:51 -0500 (EST) |
branch: master
commit 671e3f2c3dbe45e056cd3c33f2db865e1f3b6fc5
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Almost move two blocks of code
The originals are left intact, surrounded by distinctive markers.
The copies are commented out because they must be modified to compile
in their new location. This transitional commit thus involves only
literal copying, and it is trivial to verify that the copy is purely
literal.
---
ihs_basicval.cpp | 4 +++
irc7702_interest.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 2477086..11604d1 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -260,10 +260,12 @@ void BasicValues::Init()
;
}
+#if 1 // 7702 !! moved to class i7702
SpreadFor7702_.assign
(Length
,StratifiedCharges_->minimum_tiered_spread_for_7702()
);
+#endif // 1 // 7702 !! moved to class i7702
// Multilife contracts will need a vector of mortality-rate objects.
@@ -429,6 +431,7 @@ void BasicValues::Init7702()
|| mce_variable_loan_rate != yare_input_.LoanRateType
);
+#if 1 // 7702 !! moved to class i7702
// Monthly guar net int for 7702 is
// greater of {iglp(), igsp()} and annual guar int rate
// less 7702 spread
@@ -491,6 +494,7 @@ void BasicValues::Init7702()
);
database().query_into(DB_NaarDiscount, Mly7702ig);
+#endif // 1 // 7702 !! moved to class i7702
// TODO ?? We should avoid reading the rate file again; but
// the GPT server doesn't initialize a MortalityRates object
diff --git a/irc7702_interest.cpp b/irc7702_interest.cpp
index 59d322c..2a13673 100644
--- a/irc7702_interest.cpp
+++ b/irc7702_interest.cpp
@@ -58,4 +58,73 @@ i7702::i7702
:database_ {database}
,stratified_ {stratified}
{
+#if 0
+ SpreadFor7702_.assign
+ (Length
+ ,StratifiedCharges_->minimum_tiered_spread_for_7702()
+ );
+
+ // Monthly guar net int for 7702 is
+ // greater of {iglp(), igsp()} and annual guar int rate
+ // less 7702 spread
+ // transformed to monthly (simple subtraction?).
+ // These interest rates belong here because they're used by
+ // DCV calculations in the account value class as well as
+ // GPT calculations in the 7702 class.
+
+ std::vector<double> statutory7702i;
+ database().query_into(DB_AnnInterestRate7702, statutory7702i);
+
+ std::vector<double> guar_int;
+ database().query_into(DB_GuarInt, guar_int);
+
+ // For 7702 purposes, the rate guaranteed by the contract is the
+ // highest rate on any potential path, at each duration; thus,
+ // it is no less than the guaranteed fixed loan rate, i.e.:
+ // (fixed rate charged on loans) - (guaranteed loan spread)
+ if(!database().query<bool>(DB_IgnoreLoanRateFor7702))
+ {
+ std::vector<double> allow_fixed_loan;
+ database().query_into(DB_AllowFixedLoan, allow_fixed_loan);
+ if(!each_equal(allow_fixed_loan, false))
+ {
+ std::vector<double> gross_loan_rate;
+ database().query_into(DB_FixedLoanRate , gross_loan_rate);
+ std::vector<double> guar_loan_spread;
+ database().query_into(DB_GuarRegLoanSpread, guar_loan_spread);
+ assign
+ (guar_int
+ ,apply_binary
+ (greater_of<double>()
+ ,guar_int
+ ,gross_loan_rate - guar_loan_spread
+ )
+ );
+ }
+ }
+
+ // If lmi someday implements VLR, then the current VLR rate on
+ // the issue date constitutes a short-term guarantee that must be
+ // reflected in the 7702 interest rates (excluding the GLP rate).
+
+ Mly7702iGlp.assign(Length, 0.0);
+ assign
+ (Mly7702iGlp
+ ,apply_unary
+ (i_upper_12_over_12_from_i<double>()
+ ,apply_binary(greater_of<double>(), statutory7702i, guar_int) -
SpreadFor7702_
+ )
+ );
+
+ Mly7702iGsp.assign(Length, 0.0);
+ assign
+ (Mly7702iGsp
+ ,apply_unary
+ (i_upper_12_over_12_from_i<double>()
+ ,apply_binary(greater_of<double>(), 0.02 + statutory7702i,
guar_int) - SpreadFor7702_
+ )
+ );
+
+ database().query_into(DB_NaarDiscount, Mly7702ig);
+#endif // 0
}
- [lmi-commits] [lmi] master updated (a62fbec -> 2f74b41), Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 04484e6 03/25: Remove a duplicative defect marker [300], Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 671e3f2 05/25: Almost move two blocks of code,
Greg Chicares <=
- [lmi-commits] [lmi] master 3ba52f9 01/25: Add a '7702 !!' marker for new 7702 issues, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 447290e 04/25: Move an assertion; rewrite and duplicate its comment, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 5dbf2e3 06/25: Validate class i7702, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 2f74b41 25/25: Improve encapsulation of 7702 "spread", Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 3a06237 08/25: Deduplicate, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 3c341a6 10/25: Remove more dead code, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master e6f9397 14/25: Obtain DCV interest rate from i7702 object, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master d17fda2 20/25: Bring bogosity into focus before eradicating it, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master bbe2802 21/25: Reduce bogosity ever so slightly, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 8c27092 24/25: Use correct interest rates for '.mec' input, Greg Chicares, 2021/02/24