24#include <boost/lexical_cast.hpp>
25#include <boost/make_shared.hpp>
26#include <boost/tokenizer.hpp>
34#include <ql/time/calendars/weekendsonly.hpp>
38using boost::lexical_cast;
45 if (s ==
"Compounding")
47 else if (s ==
"Averaging")
50 QL_FAIL(
"SubPeriodsCoupon type " << s <<
" not recognized");
53void checkContinuationMappings(
const map<Natural, Natural>& mp,
const string&
name) {
55 Natural previousValue = 0;
56 for (
const auto& kv : mp) {
57 QL_REQUIRE(kv.first <= kv.second,
"Not allowed a " <<
name <<
" continuation mapping where From (" <<
58 kv.first <<
") is greater than To (" << kv.second <<
").");
59 QL_REQUIRE(kv.second > previousValue,
"The To " <<
name <<
" continuation mappings should be strictly " <<
60 "increasing but got " << kv.second <<
" <= " << previousValue);
61 previousValue = kv.second;
73 QL_REQUIRE(!
conventions_.empty(),
"InstrumentConventions: No conventions provided.");
74 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
75 Date dt = d == Date() ? Settings::instance().evaluationDate() : d;
79 QL_REQUIRE(it !=
conventions_.begin(),
"InstrumentConventions: Could not find conventions for " << dt);
81 constexpr std::size_t max_num_warnings = 10;
84 WLOG(
"InstrumentConventions: Could not find conventions for "
85 << dt <<
", using conventions from " << it->first
93 const QuantLib::ext::shared_ptr<ore::data::Conventions>& conventions, QuantLib::Date d) {
94 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
99 const string& compoundingFrequency)
100 :
Convention(id,
Type::Zero), tenorBased_(false), strDayCounter_(dayCounter), strCompounding_(compounding),
101 strCompoundingFrequency_(compoundingFrequency) {
106 const string& compounding,
const string& compoundingFrequency,
107 const string& spotLag,
const string& spotCalendar,
const string& rollConvention,
109 :
Convention(id,
Type::Zero), tenorBased_(true), strDayCounter_(dayCounter), strTenorCalendar_(tenorCalendar),
110 strCompounding_(compounding), strCompoundingFrequency_(compoundingFrequency), strSpotLag_(spotLag),
111 strSpotCalendar_(spotCalendar), strRollConvention_(rollConvention), strEom_(eom) {
172 const string& eom,
const string& dayCounter,
const string& settlementDays)
174 strEom_(eom), strDayCounter_(dayCounter), strSettlementDays_(settlementDays) {
228 const QuantLib::RateAveraging::Type overnightIndexFutureNettingType,
231 overnightIndexFutureNettingType_(overnightIndexFutureNettingType) {
286 const string& fixedDayCounter,
const string& fixedCalendar,
const string& paymentLag,
287 const string& eom,
const string& fixedFrequency,
const string& fixedConvention,
288 const string& fixedPaymentConvention,
const string& rule,
const string& paymentCal)
289 :
Convention(id,
Type::OIS), strSpotLag_(spotLag), strIndex_(index), strFixedDayCounter_(fixedDayCounter),
290 strFixedCalendar_(fixedCalendar), strPaymentLag_(paymentLag), strEom_(eom), strFixedFrequency_(fixedFrequency),
291 strFixedConvention_(fixedConvention), strFixedPaymentConvention_(fixedPaymentConvention), strRule_(rule),
292 strPaymentCal_(paymentCal) {
363 QL_REQUIRE(tmp,
"The index string '" <<
strIndex_ <<
"' does not represent an overnight index.");
368 const Size settlementDays,
const string& businessDayConvention,
369 const bool endOfMonth)
370 :
Convention(id,
Type::IborIndex), localId_(id), strFixingCalendar_(fixingCalendar), strDayCounter_(dayCounter),
371 settlementDays_(settlementDays), strBusinessDayConvention_(businessDayConvention), endOfMonth_(endOfMonth) {
400 vector<string> tokens;
401 split(tokens,
localId_, boost::is_any_of(
"-"));
402 QL_REQUIRE(tokens.size() == 2 || tokens.size() == 3,
403 "Two or three tokens required in IborIndexConvention " <<
localId_ <<
": CCY-INDEX or CCY-INDEX-TERM");
411 const string& dayCounter,
const Size settlementDays)
412 :
Convention(id,
Type::OvernightIndex), strFixingCalendar_(fixingCalendar), strDayCounter_(dayCounter),
413 settlementDays_(settlementDays) {
438 vector<string> tokens;
439 split(tokens,
id_, boost::is_any_of(
"-"));
440 QL_REQUIRE(tokens.size() == 2,
"Two tokens required in OvernightIndexConvention " <<
id_ <<
": CCY-INDEX");
444 :
Convention(id,
Type::SwapIndex), strConventions_(conventions), fixingCalendar_(fixingCalendar) {}
468 const string& fixedConvention,
const string& fixedDayCounter,
const string& index,
469 bool hasSubPeriod,
const string& floatFrequency,
const string& subPeriodsCouponType)
470 :
Convention(id,
Type::
Swap), hasSubPeriod_(hasSubPeriod), strFixedCalendar_(fixedCalendar),
471 strFixedFrequency_(fixedFrequency), strFixedConvention_(fixedConvention), strFixedDayCounter_(fixedDayCounter),
472 strIndex_(index), strFloatFrequency_(floatFrequency), strSubPeriodsCouponType_(subPeriodsCouponType) {
541 const string& fixedDayCounter,
const string& fixedCalendar,
542 const string& fixedConvention,
const string& fixedPaymentConvention,
543 const string& fixedFrequency,
const string& index,
const string& onTenor,
544 const string& rateCutoff)
546 strFixedDayCounter_(fixedDayCounter), strFixedCalendar_(fixedCalendar), strFixedConvention_(fixedConvention),
547 strFixedPaymentConvention_(fixedPaymentConvention), strIndex_(index), strOnTenor_(onTenor),
548 strRateCutoff_(rateCutoff) {
607 QL_REQUIRE(tmp,
"The index string '" <<
strIndex_ <<
"' does not represent an overnight index.");
612 const string& receiveFrequency,
const string& payFrequency,
613 const string& spreadOnRec,
const string& includeSpread,
614 const string& subPeriodsCouponType)
616 strReceiveFrequency_(receiveFrequency), strPayFrequency_(payFrequency), strSpreadOnRec_(spreadOnRec),
617 strIncludeSpread_(includeSpread), strSubPeriodsCouponType_(subPeriodsCouponType) {
625 QuantLib::ext::shared_ptr<OvernightIndex> payON = QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(
payIndex());
626 QuantLib::ext::shared_ptr<OvernightIndex> recON = QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(
receiveIndex());
631 WLOG(
"receiveFrequency_ empty and overnight, set to 1 Year");
634 WLOG(
"receiveFrequency_ empty set to index tenor.");
642 WLOG(
"payFrequency_ empty and overnight, set to 1 Year");
645 WLOG(
"payFrequency_ empty set to index tenor.");
653 QL_FAIL(
"IncludeSpread must be false for overnight index legs.");
678 ALOG(
"TenorBasisSwapConvention: LongIndex is deprecated, fill empty PayIndex");
681 QL_FAIL(
"TenorBasisSwapConvention : PayIndex field missing.");
687 ALOG(
"TenorBasisSwapConvention: ShortIndex is deprecated, fill empty ReceiveIndex");
690 QL_FAIL(
"TenorBasisSwapConvention : ReceiveIndex field missing.");
695 ALOG(
"TenorBasisSwapConvention: LongPayTenor is deprecated, fill empty PayFrequency");
702 ALOG(
"TenorBasisSwapConvention: ShortPayTenor is deprecated, fill empty ReceiveFrequency");
709 ALOG(
"TenorBasisSwapConvention: SpreadOnShort is deprecated, fill empty SpreadOnRec");
740 const string&
id,
const string&
calendar,
const string& longFixedFrequency,
const string& longFixedConvention,
741 const string& longFixedDayCounter,
const string& longIndex,
const string& shortFixedFrequency,
742 const string& shortFixedConvention,
const string& shortFixedDayCounter,
const string& shortIndex,
743 const string& longMinusShort)
744 :
Convention(id,
Type::TenorBasisTwoSwap), strCalendar_(
calendar), strLongFixedFrequency_(longFixedFrequency),
745 strLongFixedConvention_(longFixedConvention), strLongFixedDayCounter_(longFixedDayCounter),
746 strLongIndex_(longIndex), strShortFixedFrequency_(shortFixedFrequency),
747 strShortFixedConvention_(shortFixedConvention), strShortFixedDayCounter_(shortFixedDayCounter),
748 strShortIndex_(shortIndex), strLongMinusShort_(longMinusShort) {
808 :
Convention(id,
Type::BMABasisSwap), strLiborIndex_(longIndex), strBmaIndex_(shortIndex) {
841 QL_REQUIRE(tmp,
"the index string '" <<
strBmaIndex_ <<
"' does not represent a BMA / SIFMA index.");
848 const string& targetCurrency,
const string& pointsFactor,
const string& advanceCalendar,
849 const string& spotRelative,
const string& endOfMonth,
const string& convention)
850 :
Convention(id,
Type::
FX), strSpotDays_(spotDays), strSourceCurrency_(sourceCurrency),
851 strTargetCurrency_(targetCurrency), strPointsFactor_(pointsFactor), strAdvanceCalendar_(advanceCalendar),
852 strSpotRelative_(spotRelative), strEndOfMonth_(endOfMonth), strConvention_(convention) {
908 const string&
id,
const string& strSettlementDays,
const string& strSettlementCalendar,
909 const string& strRollConvention,
const string& flatIndex,
const string& spreadIndex,
const string& strEom,
910 const string& strIsResettable,
const string& strFlatIndexIsResettable,
const string& strFlatTenor,
911 const string& strSpreadTenor,
const string& strPaymentLag,
const string& strFlatPaymentLag,
912 const string& strIncludeSpread,
const string& strLookback,
const string& strFixingDays,
const string& strRateCutoff,
913 const string& strIsAveraged,
const string& strFlatIncludeSpread,
const string& strFlatLookback,
914 const string& strFlatFixingDays,
const string& strFlatRateCutoff,
const string& strFlatIsAveraged,
916 :
Convention(id,
Type::CrossCcyBasis), strSettlementDays_(strSettlementDays),
917 strSettlementCalendar_(strSettlementCalendar), strRollConvention_(strRollConvention), strFlatIndex_(flatIndex),
918 strSpreadIndex_(spreadIndex), strEom_(strEom), strIsResettable_(strIsResettable),
919 strFlatIndexIsResettable_(strFlatIndexIsResettable), strFlatTenor_(strFlatTenor), strSpreadTenor_(strSpreadTenor),
920 strPaymentLag_(strPaymentLag), strFlatPaymentLag_(strFlatPaymentLag), strIncludeSpread_(strIncludeSpread),
921 strLookback_(strLookback), strFixingDays_(strFixingDays), strRateCutoff_(strRateCutoff),
922 strIsAveraged_(strIsAveraged), strFlatIncludeSpread_(strFlatIncludeSpread), strFlatLookback_(strFlatLookback),
923 strFlatFixingDays_(strFlatFixingDays), strFlatRateCutoff_(strFlatRateCutoff),
924 strFlatIsAveraged_(strFlatIsAveraged) {
942 if (QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(tmp))
952 if (QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(tmp))
1083 const string&
id,
const string& settlementDays,
const string& settlementCalendar,
1084 const string& settlementConvention,
const string& fixedCurrency,
const string& fixedFrequency,
1085 const string& fixedConvention,
const string& fixedDayCounter,
const string& index,
const string& eom,
1086 const std::string& strIsResettable,
const std::string& strFloatIndexIsResettable)
1087 :
Convention(id,
Type::CrossCcyFixFloat), strSettlementDays_(settlementDays),
1088 strSettlementCalendar_(settlementCalendar), strSettlementConvention_(settlementConvention),
1089 strFixedCurrency_(fixedCurrency), strFixedFrequency_(fixedFrequency), strFixedConvention_(fixedConvention),
1090 strFixedDayCounter_(fixedDayCounter), strIndex_(index), strEom_(eom),
1091 strIsResettable_(strIsResettable), strFloatIndexIsResettable_(strFloatIndexIsResettable){
1161 rule_(DateGeneration::CDS2015), settlesAccrual_(true), paysAtDefaultTime_(true), upfrontSettlementDays_(3) {}
1164 const string& strFrequency,
const string& strPaymentConvention,
const string& strRule,
1165 const string& strDayCounter,
const string& strSettlesAccrual,
1166 const string& strPaysAtDefaultTime,
const string& strUpfrontSettlementDays,
1167 const string& lastPeriodDayCounter)
1168 :
Convention(id,
Type::CDS), strSettlementDays_(strSettlementDays), strCalendar_(strCalendar),
1169 strFrequency_(strFrequency), strPaymentConvention_(strPaymentConvention), strRule_(strRule),
1170 strDayCounter_(strDayCounter), strSettlesAccrual_(strSettlesAccrual),
1171 strPaysAtDefaultTime_(strPaysAtDefaultTime), strUpfrontSettlementDays_(strUpfrontSettlementDays),
1172 strLastPeriodDayCounter_(lastPeriodDayCounter) {
1236 : fixConvention_(Following), interpolated_(false), adjustInfObsDates_(false),
1240 const string& strFixConvention,
const string& strDayCounter,
1241 const string& strIndex,
const string& strInterpolated,
1242 const string& strObservationLag,
const string& strAdjustInfObsDates,
1243 const string& strInfCalendar,
const string& strInfConvention,
1245 const QuantLib::ext::shared_ptr<ScheduleData>& publicationScheduleData)
1247 strDayCounter_(strDayCounter), strIndex_(strIndex), strInterpolated_(strInterpolated),
1248 strObservationLag_(strObservationLag), strAdjustInfObsDates_(strAdjustInfObsDates),
1249 strInfCalendar_(strInfCalendar), strInfConvention_(strInfConvention),
1250 publicationRoll_(publicationRoll), publicationScheduleData_(publicationScheduleData) {
1267 " so expect non-null publication schedule data.");
1296 QL_REQUIRE(n,
"PublicationRoll is " <<
publicationRoll_ <<
" for " <<
id() <<
1297 " so expect non-empty PublicationSchedule.");
1322 <<
id() <<
" so expect PublicationSchedule.");
1338 const string& compounding,
const string& compoundingFrequency)
1339 :
Convention(id,
Type::SecuritySpread), tenorBased_(false), strDayCounter_(dayCounter),
1340 strCompounding_(compounding), strCompoundingFrequency_(compoundingFrequency) {
1345 const string& tenorCalendar,
const string& compounding,
1346 const string& compoundingFrequency,
const string& spotLag,
1347 const string& spotCalendar,
const string& rollConvention,
1349 :
Convention(id,
Type::SecuritySpread), tenorBased_(true), strDayCounter_(dayCounter),
1350 strTenorCalendar_(tenorCalendar), strCompounding_(compounding), strCompoundingFrequency_(compoundingFrequency),
1351 strSpotLag_(spotLag), strSpotCalendar_(spotCalendar), strRollConvention_(rollConvention), strEom_(eom) {
1415 const string& strSpotDays,
const string& strSwapTenor,
1416 const string& strFixingDays,
const string& strCalendar,
1417 const string& strDayCounter,
const string& strConvention)
1418 :
Convention(id,
Type::CMSSpreadOption), strForwardStart_(strForwardStart), strSpotDays_(strSpotDays),
1419 strSwapTenor_(strSwapTenor), strFixingDays_(strFixingDays), strCalendar_(strCalendar),
1420 strDayCounter_(strDayCounter), strRollConvention_(strConvention) {
1467 const string& pointsFactor,
const string& advanceCalendar,
1468 const string& spotRelative, BusinessDayConvention bdc,
1471 strPointsFactor_(pointsFactor), strAdvanceCalendar_(advanceCalendar), strSpotRelative_(spotRelative) {
1528 : useBusinessDays_(true), deliveryRollDays_(0), futureMonthOffset_(0),
1529 dailyExpiryOffset_(Null<Natural>()), period_(
CalculationPeriod::ExpiryToExpiry) {}
1532 const string& pricingCalendar,
bool useBusinessDays,
const string& conventionsId,
1533 Natural deliveryRollDays, Natural futureMonthOffset, Natural dailyExpiryOffset)
1534 : commodityName_(commodityName), strPeriod_(period), strPricingCalendar_(pricingCalendar),
1535 useBusinessDays_(useBusinessDays), conventionsId_(conventionsId), deliveryRollDays_(deliveryRollDays),
1536 futureMonthOffset_(futureMonthOffset), dailyExpiryOffset_(dailyExpiryOffset),
1537 period_(CalculationPeriod::ExpiryToExpiry) {
1542 return commodityName_;
1550 return pricingCalendar_;
1554 return useBusinessDays_;
1558 return conventionsId_;
1562 return deliveryRollDays_;
1566 return futureMonthOffset_;
1570 return dailyExpiryOffset_;
1574 return commodityName_.empty();
1583 useBusinessDays_ =
true;
1589 deliveryRollDays_ = 0;
1594 futureMonthOffset_ = 0;
1599 dailyExpiryOffset_ = Null<Natural>();
1614 if (!conventionsId_.empty())
1616 if (deliveryRollDays_ != 0)
1617 XMLUtils::addChild(doc, node,
"DeliveryRollDays",
static_cast<int>(deliveryRollDays_));
1618 if (futureMonthOffset_ != 0)
1619 XMLUtils::addChild(doc, node,
"FutureMonthOffset",
static_cast<int>(futureMonthOffset_));
1620 if (dailyExpiryOffset_ != Null<Natural>())
1621 XMLUtils::addChild(doc, node,
"DailyExpiryOffset",
static_cast<int>(dailyExpiryOffset_));
1634 const string& offPeakIndex,
1635 const string& peakIndex,
1636 const string& offPeakHours,
1637 const string& peakCalendar)
1638 : offPeakIndex_(offPeakIndex),
1639 peakIndex_(peakIndex),
1640 strOffPeakHours_(offPeakHours),
1641 strPeakCalendar_(peakCalendar) {
1646 offPeakHours_ =
parseReal(strOffPeakHours_);
1673 : forFuture_(true), futureBdc_(Preceding), forOption_(true),
optionBdc_(Preceding) {}
1677 BusinessDayConvention futureBdc,
1679 BusinessDayConvention optionBdc)
1680 : expiry_(expiry), forFuture_(true), futureBdc_(Preceding),
1687 forFuture_ = tmp.empty() ? true :
parseBool(tmp);
1691 forOption_ = tmp.empty() ? true :
parseBool(tmp);
1737 const string& contractFrequency,
const string&
calendar,
1738 const string& expiryCalendar, Size expiryMonthLag,
1739 const string& oneContractMonth,
const string& offsetDays,
1740 const string& bdc,
bool adjustBeforeOffset,
bool isAveraging,
1741 const OptionExpiryAnchorDateRule& optionExpiryDateRule,
1742 const set<ProhibitedExpiry>& prohibitedExpiries,
1743 Size optionExpiryMonthLag,
1744 const string& optionBdc,
1745 const map<Natural, Natural>& futureContinuationMappings,
1746 const map<Natural, Natural>& optionContinuationMappings,
1747 const AveragingData& averagingData,
1748 Natural hoursPerDay,
1749 const boost::optional<OffPeakPowerIndexData>& offPeakPowerIndexData,
1750 const string& indexName,
1751 const std::string& optionFrequency)
1752 :
Convention(id, Type::CommodityFuture), anchorType_(AnchorType::DayOfMonth),
1753 strDayOfMonth_(dayOfMonth.dayOfMonth_), strContractFrequency_(contractFrequency), strCalendar_(
calendar),
1754 strExpiryCalendar_(expiryCalendar), expiryMonthLag_(expiryMonthLag), strOneContractMonth_(oneContractMonth),
1755 strOffsetDays_(offsetDays), strBdc_(bdc), adjustBeforeOffset_(adjustBeforeOffset), isAveraging_(isAveraging),
1756 prohibitedExpiries_(prohibitedExpiries),optionExpiryMonthLag_(optionExpiryMonthLag), strOptionBdc_(optionBdc),
1757 futureContinuationMappings_(futureContinuationMappings), optionContinuationMappings_(optionContinuationMappings),
1758 averagingData_(averagingData), hoursPerDay_(hoursPerDay), offPeakPowerIndexData_(offPeakPowerIndexData),
1759 indexName_(indexName), strOptionContractFrequency_(optionFrequency), optionAnchorType_(optionExpiryDateRule.type_), strOptionExpiryOffset_(optionExpiryDateRule.daysBefore_),
1760 strOptionExpiryDay_(optionExpiryDateRule.expiryDay_), strOptionNth_(optionExpiryDateRule.nth_),
1761 strOptionWeekday_(optionExpiryDateRule.weekday_), balanceOfTheMonth_(false) {
1766 const string& contractFrequency,
const string&
calendar,
1767 const string& expiryCalendar, Size expiryMonthLag,
1768 const string& oneContractMonth,
const string& offsetDays,
1769 const string& bdc,
bool adjustBeforeOffset,
bool isAveraging,
1770 const OptionExpiryAnchorDateRule& optionExpiryDateRule,
1771 const set<ProhibitedExpiry>& prohibitedExpiries,
1772 Size optionExpiryMonthLag,
1773 const string& optionBdc,
1774 const map<Natural, Natural>& futureContinuationMappings,
1775 const map<Natural, Natural>& optionContinuationMappings,
1776 const AveragingData& averagingData,
1777 Natural hoursPerDay,
1778 const boost::optional<OffPeakPowerIndexData>& offPeakPowerIndexData,
1779 const string& indexName,
1780 const std::string& optionFrequency)
1781 :
Convention(id, Type::CommodityFuture), anchorType_(AnchorType::NthWeekday), strNth_(nth), strWeekday_(weekday),
1782 strContractFrequency_(contractFrequency), strCalendar_(
calendar), strExpiryCalendar_(expiryCalendar),
1783 expiryMonthLag_(expiryMonthLag), strOneContractMonth_(oneContractMonth), strOffsetDays_(offsetDays), strBdc_(bdc),
1784 adjustBeforeOffset_(adjustBeforeOffset), isAveraging_(isAveraging),
1785 prohibitedExpiries_(prohibitedExpiries), optionExpiryMonthLag_(optionExpiryMonthLag), strOptionBdc_(optionBdc),
1786 futureContinuationMappings_(futureContinuationMappings), optionContinuationMappings_(optionContinuationMappings),
1787 averagingData_(averagingData), hoursPerDay_(hoursPerDay), offPeakPowerIndexData_(offPeakPowerIndexData),
1788 indexName_(indexName), strOptionContractFrequency_(optionFrequency),
1789 optionAnchorType_(optionExpiryDateRule.type_), strOptionExpiryOffset_(optionExpiryDateRule.daysBefore_),
1790 strOptionExpiryDay_(optionExpiryDateRule.expiryDay_), strOptionNth_(optionExpiryDateRule.nth_),
1791 strOptionWeekday_(optionExpiryDateRule.weekday_), balanceOfTheMonth_(false) {
1796 const string& contractFrequency,
const string&
calendar,
1797 const string& expiryCalendar, Size expiryMonthLag,
1798 const string& oneContractMonth,
const string& offsetDays,
1799 const string& bdc,
bool adjustBeforeOffset,
bool isAveraging,
1800 const OptionExpiryAnchorDateRule& optionExpiryDateRule,
1801 const set<ProhibitedExpiry>& prohibitedExpiries,
1802 Size optionExpiryMonthLag,
1803 const string& optionBdc,
1804 const map<Natural, Natural>& futureContinuationMappings,
1805 const map<Natural, Natural>& optionContinuationMappings,
1806 const AveragingData& averagingData,
1807 Natural hoursPerDay,
1808 const boost::optional<OffPeakPowerIndexData>& offPeakPowerIndexData,
1809 const string& indexName,
1810 const std::string& optionFrequency)
1811 : Convention(id, Type::CommodityFuture), anchorType_(AnchorType::CalendarDaysBefore),
1812 strCalendarDaysBefore_(calendarDaysBefore.calendarDaysBefore_), strContractFrequency_(contractFrequency),
1813 strCalendar_(
calendar), strExpiryCalendar_(expiryCalendar), expiryMonthLag_(expiryMonthLag),
1814 strOneContractMonth_(oneContractMonth), strOffsetDays_(offsetDays), strBdc_(bdc),
1815 adjustBeforeOffset_(adjustBeforeOffset), isAveraging_(isAveraging),
1816 prohibitedExpiries_(prohibitedExpiries), optionExpiryMonthLag_(optionExpiryMonthLag), strOptionBdc_(optionBdc),
1817 futureContinuationMappings_(futureContinuationMappings),
1818 optionContinuationMappings_(optionContinuationMappings), averagingData_(averagingData), hoursPerDay_(hoursPerDay), offPeakPowerIndexData_(offPeakPowerIndexData),
1819 indexName_(indexName), strOptionContractFrequency_(optionFrequency),
1820 optionAnchorType_(optionExpiryDateRule.type_), strOptionExpiryOffset_(optionExpiryDateRule.daysBefore_),
1821 strOptionExpiryDay_(optionExpiryDateRule.expiryDay_), strOptionNth_(optionExpiryDateRule.nth_),
1822 strOptionWeekday_(optionExpiryDateRule.weekday_), balanceOfTheMonth_(false) {
1827 const string& contractFrequency,
const string&
calendar,
1828 const string& expiryCalendar, Size expiryMonthLag,
1829 const string& oneContractMonth,
const string& offsetDays,
1830 const string& bdc,
bool adjustBeforeOffset,
bool isAveraging,
1831 const OptionExpiryAnchorDateRule& optionExpiryDateRule,
1832 const set<ProhibitedExpiry>& prohibitedExpiries,
1833 Size optionExpiryMonthLag,
1834 const string& optionBdc,
1835 const map<Natural, Natural>& futureContinuationMappings,
1836 const map<Natural, Natural>& optionContinuationMappings,
1837 const AveragingData& averagingData,
1838 Natural hoursPerDay,
1839 const boost::optional<OffPeakPowerIndexData>& offPeakPowerIndexData,
1840 const string& indexName,
1841 const std::string& optionFrequency)
1842 : Convention(id, Type::CommodityFuture), anchorType_(AnchorType::BusinessDaysAfter),
1843 strBusinessDaysAfter_(businessDaysAfter.businessDaysAfter_), strContractFrequency_(contractFrequency),
1844 strCalendar_(
calendar), strExpiryCalendar_(expiryCalendar), expiryMonthLag_(expiryMonthLag),
1845 strOneContractMonth_(oneContractMonth), strOffsetDays_(offsetDays), strBdc_(bdc),
1846 adjustBeforeOffset_(adjustBeforeOffset), isAveraging_(isAveraging),
1847 prohibitedExpiries_(prohibitedExpiries), optionExpiryMonthLag_(optionExpiryMonthLag), strOptionBdc_(optionBdc),
1848 futureContinuationMappings_(futureContinuationMappings),
1849 optionContinuationMappings_(optionContinuationMappings), averagingData_(averagingData), hoursPerDay_(hoursPerDay), offPeakPowerIndexData_(offPeakPowerIndexData),
1850 indexName_(indexName), strOptionContractFrequency_(optionFrequency),
1851 optionAnchorType_(optionExpiryDateRule.type_), strOptionExpiryOffset_(optionExpiryDateRule.daysBefore_),
1852 strOptionExpiryDay_(optionExpiryDateRule.expiryDay_), strOptionNth_(optionExpiryDateRule.nth_),
1853 strOptionWeekday_(optionExpiryDateRule.weekday_), balanceOfTheMonth_(false) {
1880 QL_FAIL(
"Failed to parse AnchorDay node, the WeeklyDayOfTheWeek node is required for weekly contract expiries.");
1884 QL_REQUIRE(anchorNode,
"Expected an AnchorDay node in the FutureExpiry convention");
1902 QL_FAIL(
"Failed to parse AnchorDay node");
1933 bool foundOptionExpiryRule =
false;
1934 std::string previouslyFoundOptionExpiryRule =
"";
1940 foundOptionExpiryRule =
true;
1941 previouslyFoundOptionExpiryRule =
"OptionExpiryOffset";
1945 QL_REQUIRE(!foundOptionExpiryRule,
"Expect exactly one option expiry anchor date rule, found "
1946 << previouslyFoundOptionExpiryRule <<
" and OptionExpiryDay");
1950 foundOptionExpiryRule =
true;
1951 previouslyFoundOptionExpiryRule =
"OptionExpiryDay";
1955 QL_REQUIRE(!foundOptionExpiryRule,
"Expect exactly one option expiry anchor date rule, found "
1956 << previouslyFoundOptionExpiryRule <<
" and OptionNthWeekday");
1958 "OptionNthWeekday is not allowed for weekly option expiries");
1962 foundOptionExpiryRule =
true;
1963 previouslyFoundOptionExpiryRule =
"OptionNthWeekday";
1967 QL_REQUIRE(!foundOptionExpiryRule,
"Expect exactly one option expiry anchor date rule, found "
1968 << previouslyFoundOptionExpiryRule <<
" and OptionExpiryLastWeekdayOfMonth");
1970 "OptionExpiryLastWeekdayOfMonth is not allowed for weekly option expiries");
1973 foundOptionExpiryRule =
true;
1974 previouslyFoundOptionExpiryRule =
"OptionExpiryLastWeekdayOfMonth";
1978 QL_REQUIRE(!foundOptionExpiryRule,
"Expect exactly one option expiry anchor date rule, found "
1979 << previouslyFoundOptionExpiryRule
1980 <<
" and OptionExpiryWeeklyDayOfTheWeek");
1982 "OptionExpiryWeeklyDayOfTheWeek only allowed for weekly option expiries");
1985 foundOptionExpiryRule =
true;
1986 previouslyFoundOptionExpiryRule =
"OptionExpiryWeeklyDayOfTheWeek";
1993 }
else if (!foundOptionExpiryRule) {
2002 QL_REQUIRE(datesNode,
"ProhibitedExpiries node must have a Dates node.");
2004 for (
const auto& dateNode : dateNodes) {
2016 if (validContractMonthNode) {
2018 for (
const auto& month : monthNodes) {
2028 "ContinuationMapping",
"From",
"To",
false);
2029 for (
const auto& kv : tmp) {
2035 "ContinuationMapping",
"From",
"To",
false);
2036 for (
const auto& kv : tmp) {
2145 map<string, string> tmp;
2150 "ContinuationMapping",
"From",
"To", tmp);
2154 map<string, string> tmp;
2159 "ContinuationMapping",
"From",
"To", tmp);
2266 QL_REQUIRE(
id_ != opIdx,
"The off-peak index (" << opIdx <<
") cannot equal the index for which" <<
2267 " we are providing conventions (" <<
id_ <<
").");
2269 QL_REQUIRE(
id_ != pIdx,
"The peak index (" << pIdx <<
") cannot equal the index for which" <<
2270 " we are providing conventions (" <<
id_ <<
").");
2285 QL_REQUIRE(freq == Annual || freq == Quarterly || freq == Monthly || freq == Weekly || freq == Daily,
2286 "Contract frequency should be annual, quarterly, monthly, weekly or daily but got " << freq);
2292 for (
auto bdc : bdcs) {
2293 if (!(bdc == Preceding || bdc == Following || bdc == ModifiedPreceding || bdc == ModifiedFollowing)) {
2294 WLOG(
"Prohibited expiry bdc must be one of {Preceding, Following, ModifiedPreceding," <<
2295 " ModifiedFollowing} but got " << bdc <<
" for date " << io::iso_date(pe.
expiry()) <<
".");
2303 const string& switchTenor,
const string& longTermAtmType,
2304 const string& longTermDeltaType,
const string& riskReversalInFavorOf,
2305 const string& butterflyStyle,
const string& fxConventionID)
2306 :
Convention(id,
Type::
FxOption), fxConventionID_(fxConventionID), strAtmType_(atmType), strDeltaType_(deltaType),
2307 strSwitchTenor_(switchTenor), strLongTermAtmType_(longTermAtmType), strLongTermDeltaType_(longTermDeltaType),
2308 strRiskReversalInFavorOf_(riskReversalInFavorOf), strButterflyStyle_(butterflyStyle) {
2334 QL_FAIL(
"invalid butterfly style '" <<
strButterflyStyle_ <<
"', expected Broker or Smile");
2372 : compounding_(Compounded), compoundingName_(
"Compounded"),
2373 frequency_(Annual), frequencyName_(
"Annual"),
2375 accuracy_(1.0e-8), maxEvaluations_(100), guess_(0.05) {}
2379 const string& compoundingName,
2380 const string& frequencyName,
2381 const string& priceTypeName,
2383 Size maxEvaluations,
2386 compoundingName_(compoundingName),
2387 frequencyName_(frequencyName),
2388 priceTypeName_(priceTypeName),
2389 accuracy_(accuracy),
2390 maxEvaluations_(maxEvaluations),
2432 : revised_(false), frequency_(Monthly) {}
2436 const string& regionName,
2437 const string& regionCode,
2439 const string& frequency,
2440 const string& availabilityLag,
2441 const string& currency)
2443 regionName_(regionName),
2444 regionCode_(regionCode),
2446 strFrequency_(frequency),
2447 strAvailabilityLag_(availabilityLag),
2448 strCurrency_(currency),
2449 frequency_(Monthly) {
2499 QuantLib::ext::shared_ptr<Convention> convention;
2513 if (type ==
"IborIndex") {
2514 convention = QuantLib::ext::make_shared<IborIndexConvention>();
2515 }
else if (type ==
"FX") {
2516 convention = QuantLib::ext::make_shared<FXConvention>();
2517 }
else if (type ==
"OvernightIndex") {
2518 convention = QuantLib::ext::make_shared<OvernightIndexConvention>();
2521 string id =
"unknown";
2525 DLOG(
"Building Convention " <<
id);
2526 convention->fromXML(child);
2528 }
catch (
const std::exception& e) {
2529 WLOG(
"Exception parsing convention "
2530 <<
id <<
": " << e.what() <<
". This is only a problem if this convention is used later on.");
2535 DLOG(
"Reading Convention " <<
id);
2537 }
catch (
const std::exception& e) {
2538 WLOG(
"Exception during retrieval of convention "
2539 <<
id <<
": " << e.what() <<
". This is only a problem if this convention is used later on.");
2546 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
2550 map<string, QuantLib::ext::shared_ptr<Convention>>::const_iterator it;
2551 for (it =
data_.begin(); it !=
data_.end(); ++it) {
2555 return conventionsNode;
2559 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
2564std::string flip(
const std::string&
id,
const std::string& sep =
"-") {
2565 boost::tokenizer<boost::escaped_list_separator<char>> tokenSplit(
2566 id, boost::escaped_list_separator<char>(
"\\", sep,
"\""));
2567 std::vector<std::string> tokens(tokenSplit.begin(), tokenSplit.end());
2569 bool eligible =
false;
2570 for (
auto const& t : tokens) {
2571 eligible = eligible || (t ==
"XCCY" || t ==
"FX" || t ==
"FXOPTION");
2574 if (eligible && (tokens.size() > 2 && tokens[0].size() == 3 && tokens[1].size() == 3)) {
2575 std::string id2 = tokens[1] + sep + tokens[0];
2576 for (Size i = 2; i < tokens.size(); ++i)
2577 id2 += sep + tokens[i];
2588 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
2589 if (
auto it =
data_.find(
id); it !=
data_.end()) {
2593 if (
auto it =
data_.find(flip(
id)); it !=
data_.end()) {
2594 used_.insert(flip(
id));
2599 std::string type, unparsed;
2601 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
2603 std::tie(type, unparsed) = it->second;
2606 std::tie(type, unparsed) = it->second;
2611 if (unparsed.empty()) {
2612 QL_FAIL(
"Convention '" <<
id <<
"' not found.");
2615 QuantLib::ext::shared_ptr<Convention> convention;
2616 if (type ==
"Zero") {
2617 convention = QuantLib::ext::make_shared<ZeroRateConvention>();
2618 }
else if (type ==
"Deposit") {
2619 convention = QuantLib::ext::make_shared<DepositConvention>();
2620 }
else if (type ==
"Future") {
2621 convention = QuantLib::ext::make_shared<FutureConvention>();
2622 }
else if (type ==
"FRA") {
2623 convention = QuantLib::ext::make_shared<FraConvention>();
2624 }
else if (type ==
"OIS") {
2625 convention = QuantLib::ext::make_shared<OisConvention>();
2626 }
else if (type ==
"Swap") {
2627 convention = QuantLib::ext::make_shared<IRSwapConvention>();
2628 }
else if (type ==
"AverageOIS") {
2629 convention = QuantLib::ext::make_shared<AverageOisConvention>();
2630 }
else if (type ==
"TenorBasisSwap") {
2631 convention = QuantLib::ext::make_shared<TenorBasisSwapConvention>();
2632 }
else if (type ==
"TenorBasisTwoSwap") {
2633 convention=QuantLib::ext::make_shared<TenorBasisTwoSwapConvention>();
2634 }
else if (type ==
"BMABasisSwap") {
2635 convention = QuantLib::ext::make_shared<BMABasisSwapConvention>();
2636 }
else if (type ==
"CrossCurrencyBasis") {
2637 convention=QuantLib::ext::make_shared<CrossCcyBasisSwapConvention>();
2638 }
else if (type ==
"CrossCurrencyFixFloat") {
2639 convention=QuantLib::ext::make_shared<CrossCcyFixFloatSwapConvention>();
2640 }
else if (type ==
"CDS") {
2641 convention=QuantLib::ext::make_shared<CdsConvention>();
2642 }
else if (type ==
"SwapIndex") {
2643 convention=QuantLib::ext::make_shared<SwapIndexConvention>();
2644 }
else if (type ==
"InflationSwap") {
2645 convention=QuantLib::ext::make_shared<InflationSwapConvention>();
2646 }
else if (type ==
"CmsSpreadOption") {
2647 convention=QuantLib::ext::make_shared<CmsSpreadOptionConvention>();
2648 }
else if (type ==
"CommodityForward") {
2649 convention = QuantLib::ext::make_shared<CommodityForwardConvention>();
2650 }
else if (type ==
"CommodityFuture") {
2651 convention = QuantLib::ext::make_shared<CommodityFutureConvention>();
2652 }
else if (type ==
"FxOption") {
2653 convention = QuantLib::ext::make_shared<FxOptionConvention>();
2654 }
else if (type ==
"ZeroInflationIndex") {
2655 convention = QuantLib::ext::make_shared<ZeroInflationIndexConvention>();
2656 }
else if (type ==
"BondYield") {
2657 convention = QuantLib::ext::make_shared<BondYieldConvention>();
2659 QL_FAIL(
"Convention '" <<
id <<
"' has unknown type '" + type +
"' not recognized.");
2663 DLOG(
"Building Convention " <<
id);
2664 convention->fromXMLString(unparsed);
2667 }
catch (exception& e) {
2668 WLOG(
"Convention '" <<
id <<
"' could not be built: " << e.what());
2669 QL_FAIL(
"Convention '" <<
id <<
"' could not be built: " << e.what());
2676 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
2677 for (
auto c :
data_) {
2678 auto fxCon = QuantLib::ext::dynamic_pointer_cast<FXConvention>(c.second);
2680 string source = fxCon->sourceCurrency().code();
2681 string target = fxCon->targetCurrency().code();
2682 if ((source == ccy1 && target == ccy2) || (target == ccy1 && source == ccy2)) {
2683 used_.insert(c.first);
2688 QL_FAIL(
"FX convention for ccys '" << ccy1 <<
"' and '" << ccy2 <<
"' not found.");
2694 if (c->type() == type) {
2696 return std::make_pair(
true, c);
2698 }
catch (
const std::exception& e) {
2700 return make_pair(
false,
nullptr);
2704 std::set<QuantLib::ext::shared_ptr<Convention>> result;
2705 std::set<std::string> unparsedIds;
2708 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
2709 for (
auto const& d :
data_) {
2710 if (d.second->type() == type) {
2711 used_.insert(d.first);
2712 result.insert(d.second);
2716 if (u.second.first == typeStr)
2717 unparsedIds.insert(u.first);
2720 for (
auto const&
id : unparsedIds) {
2721 result.insert(
get(
id));
2729 }
catch (
const std::exception& e) {
2732 boost::shared_lock<boost::shared_mutex> lock(
mutex_);
2738 return get(
id, type).first;
2742 boost::unique_lock<boost::shared_mutex> lock(
mutex_);
2743 const string&
id = convention->id();
2744 QL_REQUIRE(
data_.find(
id) ==
data_.end(),
"Convention already exists for id " <<
id);
2745 data_[id] = convention;
2751 return out <<
"Zero";
2753 return out <<
"Deposit";
2755 return out <<
"Future";
2757 return out <<
"FRA";
2759 return out <<
"OIS";
2761 return out <<
"Swap";
2763 return out <<
"AverageOIS";
2765 return out <<
"TenorBasisSwap";
2767 return out <<
"TenorBasisTwoSwap";
2769 return out <<
"BMABasisSwap";
2773 return out <<
"CrossCcyBasis";
2775 return out <<
"CrossCcyFixFloat";
2777 return out <<
"CDS";
2779 return out <<
"IborIndex";
2781 return out <<
"OvernightIndex";
2783 return out <<
"SwapIndex";
2785 return out <<
"ZeroInflationIndex";
2787 return out <<
"InflationSwap";
2789 return out <<
"SecuritySpread";
2791 return out <<
"CMSSpreadOption";
2793 return out <<
"CommodityForward";
2795 return out <<
"CommodityFuture";
2797 return out <<
"FxOption";
2799 return out <<
"BondYield";
2801 return out <<
"unknown convention type (" <<
static_cast<int>(type) <<
")";
BusinessDayConvention fixedConvention_
string strFixedDayCounter_
AverageOisConvention()
Default constructor.
DayCounter fixedDayCounter_
string strFixedConvention_
virtual void fromXML(XMLNode *node) override
string strFixedPaymentConvention_
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
Frequency fixedFrequency_
string strFixedFrequency_
QuantLib::ext::shared_ptr< OvernightIndex > index() const
BusinessDayConvention fixedPaymentConvention_
BMABasisSwapConvention()
Default constructor.
QuantLib::ext::shared_ptr< QuantExt::BMAIndexWrapper > bmaIndex() const
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
QuantLib::ext::shared_ptr< IborIndex > liborIndex() const
std::string frequencyName_
BondYieldConvention()
Constructor.
std::string compoundingName_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::Size maxEvaluations_
QuantLib::Bond::Price::Type priceType_
std::string priceTypeName_
string strSettlesAccrual_
virtual void fromXML(XMLNode *node0) override
string strSettlementDays_
string strUpfrontSettlementDays_
virtual XMLNode * toXML(XMLDocument &doc) const override
DateGeneration::Rule rule_
string strPaymentConvention_
virtual void build() override
string strLastPeriodDayCounter_
BusinessDayConvention paymentConvention_
DayCounter lastPeriodDayCounter_
Natural upfrontSettlementDays_
CdsConvention()
Default constructor.
string strPaysAtDefaultTime_
string strRollConvention_
CmsSpreadOptionConvention()
Default constructor.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
BusinessDayConvention rollConvention_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
CommodityForwardConvention()
Default constructor.
virtual void build() override
BusinessDayConvention bdc_
string strAdvanceCalendar_
Calendar advanceCalendar_
QuantLib::Natural futureMonthOffset() const
QuantLib::Natural deliveryRollDays() const
const std::string & commodityName() const
bool useBusinessDays() const
AveragingData()
Default constructor.
CalculationPeriod period() const
const QuantLib::Calendar & pricingCalendar() const
bool empty() const
Returns true if the data has not been populated.
void build()
Populate members.
void fromXML(XMLNode *node) override
Serialisation.
CalculationPeriod
Indicate location of calculation period relative to the future expiry date.
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::Natural dailyExpiryOffset() const
const std::string & conventionsId() const
Class to store conventions for creating an off peak power index.
OffPeakPowerIndexData()
Constructor.
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
Class to hold prohibited expiry information.
QuantLib::BusinessDayConvention optionBdc() const
void fromXML(XMLNode *node) override
QuantLib::BusinessDayConvention futureBdc() const
XMLNode * toXML(XMLDocument &doc) const override
const QuantLib::Date & expiry() const
std::string strOptionWeekday_
std::string strDayOfMonth_
std::string strOptionBdc_
std::string strExpiryCalendar_
boost::optional< OffPeakPowerIndexData > offPeakPowerIndexData_
OptionAnchorType optionAnchorType_
std::string optionUnderlyingFutureConvention_
Option Underlying Future convention.
QuantLib::BusinessDayConvention optionBdc_
QuantLib::Size expiryMonthLag_
QuantLib::Integer businessDaysAfter_
std::string strOneContractMonth_
QuantLib::Natural optionExpiryDay_
std::string strOptionNth_
std::string strCalendarDaysBefore_
std::string strOptionContractFrequency_
std::map< QuantLib::Natural, QuantLib::Natural > futureContinuationMappings_
QuantLib::Natural optionNth_
std::string strBusinessDaysAfter_
std::string strOptionExpiryDay_
Frequency parseAndValidateFrequency(const std::string &strFrequency)
Populate and check frequency.
QuantLib::Natural calendarDaysBefore_
AveragingData averagingData_
QuantLib::Size optionExpiryMonthLag_
void fromXML(XMLNode *node) override
Serialisation.
std::string strOffsetDays_
QuantLib::Natural hoursPerDay_
QuantLib::Weekday optionWeekday_
std::set< ProhibitedExpiry > prohibitedExpiries_
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::Integer offsetDays_
std::string balanceOfTheMonthPricingCalendarStr_
std::string strContractFrequency_
std::string strOptionExpiryOffset_
void build() override
Implementation.
QuantLib::Calendar calendar_
QuantLib::Month oneContractMonth_
QuantLib::Natural dayOfMonth_
QuantLib::Weekday weekday_
QuantLib::Frequency contractFrequency_
std::map< QuantLib::Natural, QuantLib::Natural > optionContinuationMappings_
std::set< QuantLib::Month > validContractMonths_
QuantLib::Calendar expiryCalendar_
QuantLib::BusinessDayConvention bdc_
Calendar balanceOfTheMonthPricingCalendar_
QuantLib::Frequency optionContractFrequency_
QuantLib::Natural optionExpiryOffset_
CommodityFutureConvention()
Default constructor.
bool validateBdc(const ProhibitedExpiry &pe) const
Validate the business day conventions in the ProhibitedExpiry.
Abstract base class for convention objects.
Type
Supported convention types.
Repository for currency dependent market conventions.
bool has(const std::string &id) const
Checks if we have a convention with the given id.
QuantLib::ext::shared_ptr< Convention > get(const string &id) const
map< string, QuantLib::ext::shared_ptr< Convention > > data_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
map< string, std::pair< string, string > > unparsed_
boost::shared_mutex mutex_
QuantLib::ext::shared_ptr< Convention > getFxConvention(const string &ccy1, const string &ccy2) const
void add(const QuantLib::ext::shared_ptr< Convention > &convention) const
string strFlatIndexIsResettable_
boost::optional< bool > flatIncludeSpread_
string strRollConvention_
string strFlatIncludeSpread_
QuantLib::ext::shared_ptr< IborIndex > spreadIndex() const
boost::optional< QuantLib::Size > fixingDays_
string strFlatPaymentLag_
QuantLib::ext::shared_ptr< IborIndex > flatIndex() const
string strSettlementDays_
boost::optional< QuantLib::Size > flatFixingDays_
boost::optional< QuantLib::Period > lookback_
boost::optional< bool > isAveraged_
CrossCcyBasisSwapConvention()
Default constructor.
boost::optional< Size > flatRateCutoff_
QuantLib::Size flatPaymentLag_
boost::optional< Size > rateCutoff_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
Calendar settlementCalendar_
string strFlatRateCutoff_
QuantLib::Period flatTenor_
virtual void build() override
boost::optional< QuantLib::Period > flatLookback_
QuantLib::Size paymentLag_
BusinessDayConvention rollConvention_
bool flatIndexIsResettable_
boost::optional< bool > includeSpread_
string strFlatIsAveraged_
boost::optional< bool > flatIsAveraged_
string strSettlementCalendar_
QuantLib::Period spreadTenor_
string strFlatFixingDays_
QuantLib::Calendar settlementCalendar_
QuantLib::Frequency fixedFrequency_
std::string strFixedCurrency_
std::string strFixedDayCounter_
bool floatIndexIsResettable_
std::string strSettlementConvention_
void fromXML(XMLNode *node) override
QuantLib::Currency fixedCurrency_
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::Natural settlementDays_
std::string strFloatIndexIsResettable_
QuantLib::ext::shared_ptr< QuantLib::IborIndex > index() const
QuantLib::DayCounter fixedDayCounter_
QuantLib::BusinessDayConvention settlementConvention_
QuantLib::BusinessDayConvention fixedConvention_
std::string strSettlementDays_
std::string strIsResettable_
CrossCcyFixFloatSwapConvention()
Default constructor.
std::string strFixedFrequency_
std::string strSettlementCalendar_
std::string strFixedConvention_
string strSettlementDays_
DepositConvention()
Default constructor.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
BusinessDayConvention convention_
virtual void build() override
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
BusinessDayConvention convention_
virtual void build() override
string strTargetCurrency_
string strAdvanceCalendar_
Calendar advanceCalendar_
FXConvention()
Default constructor.
string strSourceCurrency_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
QuantLib::ext::shared_ptr< IborIndex > index() const
FraConvention()
Default constructor.
Container for storing Money Market Futures conventions.
QuantLib::RateAveraging::Type overnightIndexFutureNettingType_
FutureConvention()
Default constructor.
virtual void fromXML(XMLNode *node) override
Serialisation.
virtual XMLNode * toXML(XMLDocument &doc) const override
DateGenerationRule dateGenerationRule_
QuantLib::ext::shared_ptr< IborIndex > index() const
bool butterflyIsBrokerStyle_
DeltaVolQuote::AtmType atmType_
string strButterflyStyle_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
string strLongTermDeltaType_
string strRiskReversalInFavorOf_
DeltaVolQuote::AtmType longTermAtmType_
DeltaVolQuote::DeltaType deltaType_
DeltaVolQuote::DeltaType longTermDeltaType_
QuantLib::Option::Type riskReversalInFavorOf_
string strLongTermAtmType_
BusinessDayConvention fixedConvention_
string strFixedDayCounter_
DayCounter fixedDayCounter_
IRSwapConvention()
Default constructor.
string strFixedConvention_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
Frequency fixedFrequency_
string strFixedFrequency_
string strFloatFrequency_
string strSubPeriodsCouponType_
QuantLib::ext::shared_ptr< IborIndex > index() const
Frequency floatFrequency_
SubPeriodsCoupon1::Type subPeriodsCouponType_
string strFixingCalendar_
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
string strBusinessDayConvention_
QuantLib::ext::shared_ptr< ScheduleData > publicationScheduleData_
BusinessDayConvention infConvention_
string strAdjustInfObsDates_
QuantLib::ext::shared_ptr< ZeroInflationIndex > index() const
string strObservationLag_
virtual void fromXML(XMLNode *node) override
PublicationRoll publicationRoll_
QuantLib::ext::shared_ptr< ZeroInflationIndex > index_
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
PublicationRoll
Rule for determining when inflation swaps roll to observing latest inflation index release.
BusinessDayConvention fixConvention_
Schedule publicationSchedule_
InflationSwapConvention()
Serializable Cross Currency Swap contract.
const QuantLib::ext::shared_ptr< ore::data::Conventions > & conventions(QuantLib::Date d=QuantLib::Date()) const
std::size_t numberOfEmittedWarnings_
std::map< QuantLib::Date, QuantLib::ext::shared_ptr< ore::data::Conventions > > conventions_
boost::shared_mutex mutex_
void setConventions(const QuantLib::ext::shared_ptr< ore::data::Conventions > &conventions, QuantLib::Date d=QuantLib::Date())
BusinessDayConvention fixedConvention_
string strFixedDayCounter_
std::string strPaymentCal_
DayCounter fixedDayCounter_
string strFixedConvention_
virtual void fromXML(XMLNode *node) override
string strFixedPaymentConvention_
virtual XMLNode * toXML(XMLDocument &doc) const override
DateGeneration::Rule rule_
virtual void build() override
Frequency fixedFrequency_
string strFixedFrequency_
QuantLib::Calendar paymentCal_
QuantLib::ext::shared_ptr< OvernightIndex > index() const
OisConvention()
Default constructor.
BusinessDayConvention fixedPaymentConvention_
string strFixingCalendar_
virtual void fromXML(XMLNode *node) override
OvernightIndexConvention()
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
string strRollConvention_
SecuritySpreadConvention()
Default constructor.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
Frequency compoundingFrequency_
BusinessDayConvention rollConvention_
string strCompoundingFrequency_
Serializable Swap, Single and Cross Currency.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
QuantLib::ext::shared_ptr< IborIndex > receiveIndex() const
virtual void build() override
QuantLib::ext::shared_ptr< IborIndex > payIndex() const
string strReceiveFrequency_
string strSubPeriodsCouponType_
TenorBasisSwapConvention()
Default constructor.
SubPeriodsCoupon1::Type subPeriodsCouponType_
DayCounter longFixedDayCounter_
BusinessDayConvention longFixedConvention_
string strShortFixedConvention_
string strShortFixedFrequency_
virtual void fromXML(XMLNode *node) override
BusinessDayConvention shortFixedConvention_
virtual XMLNode * toXML(XMLDocument &doc) const override
TenorBasisTwoSwapConvention()
Default constructor.
string strLongMinusShort_
DayCounter shortFixedDayCounter_
virtual void build() override
QuantLib::ext::shared_ptr< IborIndex > shortIndex() const
QuantLib::ext::shared_ptr< IborIndex > longIndex() const
Frequency shortFixedFrequency_
string strLongFixedFrequency_
string strShortFixedDayCounter_
string strLongFixedConvention_
string strLongFixedDayCounter_
Frequency longFixedFrequency_
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addAttribute(XMLDocument &doc, XMLNode *node, const string &attrName, const string &attrValue)
static void addChildren(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
static string getAttribute(XMLNode *node, const string &attrName)
static void checkNode(XMLNode *n, const string &expectedName)
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getNodeName(XMLNode *n)
Get and set a node's name.
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static string getNodeValue(XMLNode *node)
Get a node's value.
static int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
static void setNodeName(XMLDocument &doc, XMLNode *node, const string &name)
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static string toString(XMLNode *node)
Write a node out as a string.
static void appendNode(XMLNode *parent, XMLNode *child)
std::string strFrequency_
QuantLib::Currency currency_
std::string strAvailabilityLag_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::Region region() const
ZeroInflationIndexConvention()
Constructor.
QuantLib::Period availabilityLag_
QuantLib::Frequency frequency_
string strRollConvention_
virtual void fromXML(XMLNode *node) override
ZeroRateConvention()
Default constructor.
virtual XMLNode * toXML(XMLDocument &doc) const override
virtual void build() override
Frequency compoundingFrequency_
BusinessDayConvention rollConvention_
string strCompoundingFrequency_
Currency and instrument specific conventions/defaults.
QuantLib::ext::shared_ptr< ZeroInflationIndex > parseZeroInflationIndex(const string &s, const Handle< ZeroInflationTermStructure > &h)
Convert std::string to QuantLib::ZeroInflationIndex.
DateGeneration::Rule parseDateGenerationRule(const string &s)
Convert text to QuantLib::DateGeneration::Rule.
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Month parseMonth(const string &s)
QuantLib::ext::shared_ptr< IborIndex > parseIborIndex(const string &s, const Handle< YieldTermStructure > &h)
Convert std::string to QuantLib::IborIndex.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Frequency parseFrequency(const string &s)
Convert text to QuantLib::Frequency.
bool parseBool(const string &s)
Convert text to bool.
QuantLib::Bond::Price::Type parseBondPriceType(const string &s)
Convert text to QuantLib::Bond::Price::Type.
Compounding parseCompounding(const string &s)
Convert text to QuantLib::Compounding;.
Weekday parseWeekday(const string &s)
DeltaVolQuote::AtmType parseAtmType(const std::string &s)
Convert text to QuantLib::DeltaVolQuote::AtmType.
Real parseReal(const string &s)
Convert text to Real.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Option::Type parseOptionType(const std::string &s)
Convert text to QuantLib::Option::Type.
DeltaVolQuote::DeltaType parseDeltaType(const std::string &s)
Convert text to QuantLib::DeltaVolQuote::DeltaType.
Map text representations to QuantLib/QuantExt types.
Classes and functions for log message handling.
#define DLOG(text)
Logging Macro (Level = Debug)
#define ALOG(text)
Logging Macro (Level = Alert)
#define WLOG(text)
Logging Macro (Level = Warning)
bool operator<(const Dividend &d1, const Dividend &d2)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
ADCP parseAveragingDataPeriod(const string &s)
Convert text to CommodityFutureConvention::AveragingData::CalculationPeriod.
FutureConvention::DateGenerationRule parseFutureDateGenerationRule(const std::string &s)
Convert text to FutureConvention::DateGeneration.
std::string to_string(const LocationInfo &l)
InflationSwapConvention::PublicationRoll parseInflationSwapPublicationRoll(const string &s)
Convert text to InflationSwapConvention::PublicationRoll.
QuantLib::RateAveraging::Type parseOvernightIndexFutureNettingType(const std::string &s)
Convert text to QuantLib::RateAveraging::Type.
Schedule makeSchedule(const ScheduleDates &data)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
Classes to differentiate constructors below.
string conversion utilities