31 const ext::shared_ptr<OvernightIndex>& overnightIndex,
33 const Period& forwardStart)
34 : swapTenor_(swapTenor), overnightIndex_(overnightIndex), fixedRate_(fixedRate),
35 forwardStart_(forwardStart),
36 fixedCalendar_(overnightIndex->fixingCalendar()),
37 overnightCalendar_(overnightIndex->fixingCalendar()),
38 fixedDayCount_(overnightIndex->dayCounter()) {}
41 ext::shared_ptr<OvernightIndexedSwap> ois = *
this;
45 MakeOIS::operator ext::shared_ptr<OvernightIndexedSwap>()
const {
48 if (effectiveDate_ !=
Date())
49 startDate = effectiveDate_;
54 refDate = overnightCalendar_.adjust(refDate);
56 settlementDays_*
Days);
57 startDate = spotDate+forwardStart_;
58 if (forwardStart_.length()<0)
59 startDate = overnightCalendar_.adjust(startDate,
Preceding);
61 startDate = overnightCalendar_.adjust(startDate,
Following);
65 bool fixedEndOfMonth, overnightEndOfMonth;
67 fixedEndOfMonth = overnightEndOfMonth = overnightCalendar_.isEndOfMonth(startDate);
69 fixedEndOfMonth = fixedEndOfMonth_;
70 overnightEndOfMonth = overnightEndOfMonth_;
73 Date endDate = terminationDate_;
74 if (endDate ==
Date()) {
75 if (overnightEndOfMonth)
76 endDate = overnightCalendar_.
advance(startDate,
81 endDate = startDate + swapTenor_;
84 Frequency fixedPaymentFrequency, overnightPaymentFrequency;
87 fixedPaymentFrequency =
Once;
90 fixedPaymentFrequency = fixedPaymentFrequency_;
91 fixedRule = fixedRule_;
94 overnightPaymentFrequency =
Once;
97 overnightPaymentFrequency = overnightPaymentFrequency_;
98 overnightRule = overnightRule_;
101 Schedule fixedSchedule(startDate, endDate,
102 Period(fixedPaymentFrequency),
105 fixedTerminationDateConvention_,
109 Schedule overnightSchedule(startDate, endDate,
110 Period(overnightPaymentFrequency),
112 overnightConvention_,
113 overnightTerminationDateConvention_,
115 overnightEndOfMonth);
117 Rate usedFixedRate = fixedRate_;
124 overnightIndex_, overnightSpread_,
125 paymentLag_, paymentAdjustment_,
126 paymentCalendar_, telescopicValueDates_);
129 overnightIndex_->forwardingTermStructure();
131 "null term structure set to this instance of " <<
132 overnightIndex_->name());
133 bool includeSettlementDateFlows =
false;
134 ext::shared_ptr<PricingEngine> engine(
new
143 ext::shared_ptr<OvernightIndexedSwap> ois(
new
146 usedFixedRate, fixedDayCount_,
148 overnightIndex_, overnightSpread_,
149 paymentLag_, paymentAdjustment_,
150 paymentCalendar_, telescopicValueDates_,
155 overnightIndex_->forwardingTermStructure();
156 bool includeSettlementDateFlows =
false;
157 ext::shared_ptr<PricingEngine> engine(
new
159 ois->setPricingEngine(engine);
161 ois->setPricingEngine(
engine_);
257 bool includeSettlementDateFlows =
false;
258 engine_ = ext::shared_ptr<PricingEngine>(
new
264 const ext::shared_ptr<PricingEngine>& engine) {
ext::shared_ptr< PricingEngine > engine_
static Date advance(const Date &d, Integer units, TimeUnit)
Discounting engine for swaps.
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
void setPricingEngine(const ext::shared_ptr< PricingEngine > &)
set the pricing engine to be used.
BusinessDayConvention paymentAdjustment_
BusinessDayConvention fixedConvention_
MakeOIS & withFixedLegRule(DateGeneration::Rule r)
bool telescopicValueDates_
MakeOIS & withPaymentAdjustment(BusinessDayConvention convention)
MakeOIS & withTerminationDateConvention(BusinessDayConvention bdc)
MakeOIS & withPaymentLag(Integer lag)
MakeOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountingTermStructure)
MakeOIS & withType(Swap::Type type)
MakeOIS(const Period &swapTenor, const ext::shared_ptr< OvernightIndex > &overnightIndex, Rate fixedRate=Null< Rate >(), const Period &fwdStart=0 *Days)
MakeOIS & withSettlementDays(Natural settlementDays)
Calendar paymentCalendar_
DateGeneration::Rule overnightRule_
DayCounter fixedDayCount_
MakeOIS & receiveFixed(bool flag=true)
MakeOIS & withPaymentFrequency(Frequency f)
bool overnightEndOfMonth_
MakeOIS & withFixedLegDayCount(const DayCounter &dc)
MakeOIS & withRule(DateGeneration::Rule r)
MakeOIS & withCalendar(const Calendar &cal)
MakeOIS & withPricingEngine(const ext::shared_ptr< PricingEngine > &engine)
MakeOIS & withFixedLegEndOfMonth(bool flag=true)
MakeOIS & withOvernightLegRule(DateGeneration::Rule r)
MakeOIS & withFixedLegConvention(BusinessDayConvention bdc)
BusinessDayConvention overnightConvention_
Frequency fixedPaymentFrequency_
MakeOIS & withOvernightLegTerminationDateConvention(BusinessDayConvention bdc)
MakeOIS & withFixedLegTerminationDateConvention(BusinessDayConvention bdc)
Frequency overnightPaymentFrequency_
RateAveraging::Type averagingMethod_
BusinessDayConvention overnightTerminationDateConvention_
MakeOIS & withFixedLegCalendar(const Calendar &cal)
MakeOIS & withPaymentCalendar(const Calendar &cal)
DateGeneration::Rule fixedRule_
MakeOIS & withTerminationDate(const Date &)
MakeOIS & withEffectiveDate(const Date &)
MakeOIS & withOvernightLegSpread(Spread sp)
ext::shared_ptr< PricingEngine > engine_
Calendar overnightCalendar_
MakeOIS & withEndOfMonth(bool flag=true)
MakeOIS & withOvernightLegPaymentFrequency(Frequency f)
MakeOIS & withFixedLegPaymentFrequency(Frequency f)
BusinessDayConvention fixedTerminationDateConvention_
MakeOIS & withNominal(Real n)
MakeOIS & withAveragingMethod(RateAveraging::Type averagingMethod)
MakeOIS & withTelescopicValueDates(bool telescopicValueDates)
MakeOIS & withConvention(BusinessDayConvention bdc)
MakeOIS & withOvernightLegConvention(BusinessDayConvention bdc)
MakeOIS & withOvernightLegCalendar(const Calendar &cal)
MakeOIS & withOvernightLegEndOfMonth(bool flag=true)
template class providing a null value for a given type.
Overnight indexed swap: fix vs compounded overnight rate.
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Frequency
Frequency of events.
BusinessDayConvention
Business Day conventions.
@ Once
only once, e.g., a zero-coupon
unsigned QL_INTEGER Natural
positive integer
QL_INTEGER Integer
integer number
Real Spread
spreads on interest rates
base class for Inter-Bank-Offered-Rate indexes
Helper class to instantiate overnight indexed swaps.
ext::shared_ptr< YieldTermStructure > r