[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master a62fbec 7/7: Loan rate affects 7702 if loans
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master a62fbec 7/7: Loan rate affects 7702 if loans allowed, not only if elected |
Date: |
Mon, 22 Feb 2021 07:46:31 -0500 (EST) |
branch: master
commit a62fbecf5aced0574a827c8fafb6391de5e81636
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Loan rate affects 7702 if loans allowed, not only if elected
Incidentally, assert against VLR instead of blithely ignoring it,
so that when lmi eventually implements it, the assertion will flag
the spot where additional code will become necessary.
---
ihs_basicval.cpp | 54 ++++++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index dea9429..8dc797b 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -435,38 +435,40 @@ void BasicValues::Init7702()
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))
{
- // TAXATION !! Rework this. The intention is to make the 7702 interest
- // rate no less, at any duration, than the guaranteed loan rate--here,
- // the fixed rate charged on loans, minus the guaranteed loan spread
- // (if any).
- switch(yare_input_.LoanRateType)
+ std::vector<double> allow_fixed_loan;
+ database().query_into(DB_AllowFixedLoan, allow_fixed_loan);
+ if(!each_equal(allow_fixed_loan, false))
{
- case mce_fixed_loan_rate:
- {
- 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
- )
- );
- }
- break;
- case mce_variable_loan_rate:
- {
- // do nothing
- }
- break;
+ 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 here. Until then, assert that VLR is not used,
+ // or cannot be used:
+ LMI_ASSERT
+ ( false == database().query<bool>(DB_AllowVlr)
+ || mce_variable_loan_rate != yare_input_.LoanRateType
+ );
+
Mly7702iGlp.assign(Length, 0.0);
assign
(Mly7702iGlp
- [lmi-commits] [lmi] master updated (dc99d2e -> a62fbec), Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master d162b18 1/7: Improve documentation, Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master e143602 3/7: Hard-code 7702 i for another unit test, Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master 6c4deff 4/7: Use 7702 statutory i from database, Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master 7b18d1d 2/7: Hard-code 7702 i for a unit test, Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master b7b20c4 5/7: Resurrect ancient code for 7702 (loan) interest, Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master 1a3d3e6 6/7: Fix defect introduced 20050114T1947Z: used the wrong variable [301], Greg Chicares, 2021/02/22
- [lmi-commits] [lmi] master a62fbec 7/7: Loan rate affects 7702 if loans allowed, not only if elected,
Greg Chicares <=