lmi-commits
[Top][All Lists]
Advanced

[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
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]