Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5530/qlo
Modified Files:
ratehelpers.cpp ratehelpers.hpp
Log Message:
Updated qlRateHelperSelection with 1 more parameter, still unused.
Index: ratehelpers.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/ratehelpers.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ratehelpers.hpp 11 Dec 2006 09:40:05 -0000 1.7
--- ratehelpers.hpp 14 Dec 2006 15:22:48 -0000 1.8
***************
*** 73,76 ****
--- 73,78 ----
};
+ // Process the set of curve bootstrapping instruments
+ // and selects a subset according to the given rules and parameters
std::vector<std::string> qlRateHelperSelection(
const std::vector<std::string>& instrumentIDs,
***************
*** 78,82 ****
const std::vector<long>& priority,
const long nFutures,
! const long frontContractRollingDays);
}
--- 80,85 ----
const std::vector<long>& priority,
const long nFutures,
! const long frontFuturesRollingDays,
! const bool depoIncludeFlag);
}
Index: ratehelpers.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/ratehelpers.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ratehelpers.cpp 11 Dec 2006 09:40:05 -0000 1.12
--- ratehelpers.cpp 14 Dec 2006 15:22:47 -0000 1.13
***************
*** 143,158 ****
std::vector<std::string> qlRateHelperSelection(
! const std::vector<std::string>& instrumentID,
const std::vector<bool>& includeFlag,
const std::vector<long>& priority,
const long nFutures,
! const long frontContractRollingDays)
{
! QL_REQUIRE(!instrumentID.empty(), "no instrument given");
! QL_REQUIRE(frontContractRollingDays>=0,
! "negative (" << frontContractRollingDays <<
! ")frontContractRollingDays");
!
! QuantLib::Size nInstruments = instrumentID.size();
QL_REQUIRE(includeFlag.size()==nInstruments,
"includeFlag / instruments mismatch");
--- 143,159 ----
std::vector<std::string> qlRateHelperSelection(
! const std::vector<std::string>& instrumentIDs,
const std::vector<bool>& includeFlag,
const std::vector<long>& priority,
const long nFutures,
! const long frontFuturesRollingDays,
! const bool depoIncludeFlag)
{
! // Checks
! QL_REQUIRE(!instrumentIDs.empty(), "no instrument given");
! QL_REQUIRE(frontFuturesRollingDays>=0,
! "negative (" << frontFuturesRollingDays <<
! ")frontFuturesRollingDays");
! QuantLib::Size nInstruments = instrumentIDs.size();
QL_REQUIRE(includeFlag.size()==nInstruments,
"includeFlag / instruments mismatch");
***************
*** 164,170 ****
boost::shared_ptr<QuantLib::RateHelper> qlrh;
QuantLib::Size i;
! for (i=0; i<nInstruments; i++)
! {
! OH_GET_OBJECT(qlarh, instrumentID[i], RateHelper);
bool isFutures;
if (boost::dynamic_pointer_cast<FuturesRateHelper>(qlarh))
--- 165,170 ----
boost::shared_ptr<QuantLib::RateHelper> qlrh;
QuantLib::Size i;
! for (i=0; i<nInstruments; i++) {
! OH_GET_OBJECT(qlarh, instrumentIDs[i], RateHelper);
bool isFutures;
if (boost::dynamic_pointer_cast<FuturesRateHelper>(qlarh))
***************
*** 172,179 ****
else
isFutures = false;
-
qlarh->getLibraryObject(qlrh);
rhsAll.push_back(detail::RateHelperItem(isFutures,
! instrumentID[i],
includeFlag[i],
priority[i],
--- 172,178 ----
else
isFutures = false;
qlarh->getLibraryObject(qlrh);
rhsAll.push_back(detail::RateHelperItem(isFutures,
! instrumentIDs[i],
includeFlag[i],
priority[i],
***************
*** 182,192 ****
}
! // preliminary sort RateHelperItems according to
// their latest date and priority
std::sort(rhsAll.begin(), rhsAll.end(),
detail::RateHelperPrioritySorter());
! // purge input rate helpers according to their includeFlag,
! // their expiration, and maximum number of allowed futures
long futuresCounter = 0;
QuantLib::Date evalDate = QuantLib::Settings::instance().evaluationDate();
--- 181,191 ----
}
! // Preliminary sort of RateHelperItems according to
// their latest date and priority
std::sort(rhsAll.begin(), rhsAll.end(),
detail::RateHelperPrioritySorter());
! // Select input rate helpers according to their includeFlag,
! // their expiration, maximum number of allowed Futures and depoIncludeFlag
long futuresCounter = 0;
QuantLib::Date evalDate = QuantLib::Settings::instance().evaluationDate();
***************
*** 197,201 ****
rhs.push_back(rhsAll[i]);
} else if (futuresCounter<nFutures &&
! (rhsAll[i].earliestDate-2-frontContractRollingDays >= evalDate)) {
futuresCounter++;
rhs.push_back(rhsAll[i]);
--- 196,200 ----
rhs.push_back(rhsAll[i]);
} else if (futuresCounter<nFutures &&
! (rhsAll[i].earliestDate-2-frontFuturesRollingDays >= evalDate)) {
futuresCounter++;
rhs.push_back(rhsAll[i]);
***************
*** 206,210 ****
std::vector<std::string> result;
! // zero or one rate helper left
if (rhs.size()<2) {
std::vector<detail::RateHelperItem>::const_iterator i;
--- 205,209 ----
std::vector<std::string> result;
! // Zero or one rate helper left
if (rhs.size()<2) {
std::vector<detail::RateHelperItem>::const_iterator i;
***************
*** 214,218 ****
}
! // sort rate helpers according to their latest date and priority
std::sort(rhs.begin(), rhs.end(), detail::RateHelperPrioritySorter());
--- 213,217 ----
}
! // Sort rate helpers according to their latest date and priority
std::sort(rhs.begin(), rhs.end(), detail::RateHelperPrioritySorter());
***************
*** 222,226 ****
result.push_back(rhs[i].objectID);
}
! // add the last one in any case
result.push_back(rhs[i].objectID);
--- 221,225 ----
result.push_back(rhs[i].objectID);
}
! // Add the last one in any case
result.push_back(rhs[i].objectID);
|