lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6186] Set preferred loan rates reflecting the 20150502T15


From: Greg Chicares
Subject: [lmi-commits] [6186] Set preferred loan rates reflecting the 20150502T1557Z change
Date: Sun, 03 May 2015 16:29:15 +0000

Revision: 6186
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6186
Author:   chicares
Date:     2015-05-03 16:29:14 +0000 (Sun, 03 May 2015)
Log Message:
-----------
Set preferred loan rates reflecting the 20150502T1557Z change

Modified Paths:
--------------
    lmi/trunk/interest_rates.cpp
    lmi/trunk/interest_rates.hpp

Modified: lmi/trunk/interest_rates.cpp
===================================================================
--- lmi/trunk/interest_rates.cpp        2015-05-02 15:57:26 UTC (rev 6185)
+++ lmi/trunk/interest_rates.cpp        2015-05-03 16:29:14 UTC (rev 6186)
@@ -396,6 +396,8 @@
             }
         }
 
+    v.Database_->Query(PrefLoanRateDecr_, DB_PrefLoanRateDecr);
+
     v.Database_->Query(RegLoanSpread_[mce_gen_guar], DB_GuarRegLoanSpread);
     v.Database_->Query(RegLoanSpread_[mce_gen_curr], DB_CurrRegLoanSpread);
     v.Database_->Query(PrfLoanSpread_[mce_gen_guar], DB_GuarPrefLoanSpread);
@@ -629,10 +631,36 @@
         return;
         }
 
+    // Historically, lmi has charged a singular published rate on all
+    // loans, which necessarily differs for fixed vs. variable loans,
+    // but was the same for both regular and preferred. In 2015, it
+    // became necessary to support a new product that charges a lower
+    // (fixed) rate on preferred loans (and doesn't offer VLR). To
+    // accommodate this with minimal violence to existing code, a new
+    // 'PrefLoanRateDecr' entity has been added to the database.
+    // SOMEDAY !! It might be better to replace the current paradigm
+    // (due-rate minus spread) with a new set of database entities
+    // that map directly to the present class's public accessors:
+    //   (Reg|Reg)Ln(Due|Cred)Rate
+    // For now, it is uncertain whether a nonzero 'PrefLoanRateDecr'
+    // should be deducted for VLR, so that case is asserted not to
+    // arise:
+    LMI_ASSERT
+        (  mce_fixed_loan_rate == LoanRateType_
+        || each_equal(PrefLoanRateDecr_.begin(), PrefLoanRateDecr_.end(), 0.0)
+        );
     for(int j = mce_gen_curr; j < mc_n_gen_bases; j++)
         {
         RegLnDueRate_[mce_annual_rate][j] = PublishedLoanRate_;
         PrfLnDueRate_[mce_annual_rate][j] = PublishedLoanRate_;
+        // ET !! PrfLnDueRate_[...] = PublishedLoanRate_ - PrefLoanRateDecr_;
+        std::transform
+            (PrfLnDueRate_[mce_annual_rate][j].begin()
+            ,PrfLnDueRate_[mce_annual_rate][j].end()
+            ,PrefLoanRateDecr_.begin()
+            ,PrfLnDueRate_[mce_annual_rate][j].begin()
+            ,std::minus<double>()
+            );
         }
 
     RegLoanSpread_[mce_gen_mdpt] = Zero_;

Modified: lmi/trunk/interest_rates.hpp
===================================================================
--- lmi/trunk/interest_rates.hpp        2015-05-02 15:57:26 UTC (rev 6185)
+++ lmi/trunk/interest_rates.hpp        2015-05-03 16:29:14 UTC (rev 6186)
@@ -127,12 +127,14 @@
 //   Ann-     annual
 //   Guar-    guaranteed
 //   Curr-    current
-//   Prf-     preferred (loan)
+//   Pref-    preferred (loan)
+//   Prf-     preferred (loan) [three chars for {Prf|Reg} alternation]
 //   Reg-     regular (loan--as opposed to preferred)
 //   Cred-    credited (loan)
 //   Due-     due (loan)
 //   Ln-      loan
 //   -Int     interest rate
+//   -Decr    decrement
 
 class BasicValues;
 
@@ -259,6 +261,7 @@
     bool NeedLoanRates_;
     mcenum_loan_rate_type LoanRateType_;
     std::vector<double> PublishedLoanRate_;
+    std::vector<double> PrefLoanRateDecr_;
     std::vector<double> RegLnCredRate_
         [mc_n_rate_periods]
         [mc_n_gen_bases]




reply via email to

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