Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MakeAverageOIS Class Reference

helper class More...

#include <qle/instruments/makeaverageois.hpp>

+ Collaboration diagram for MakeAverageOIS:

Public Member Functions

 MakeAverageOIS (const Period &swapTenor, const QuantLib::ext::shared_ptr< OvernightIndex > &overnightIndex, const Period &onTenor, Rate fixedRate, const Period &fixedTenor, const DayCounter &fixedDayCounter, const Period &spotLagTenor=2 *Days, const Period &forwardStart=0 *Days)
 
 operator AverageOIS () const
 
 operator QuantLib::ext::shared_ptr< AverageOIS > () const
 
MakeAverageOISreceiveFixed (bool receiveFixed=true)
 
MakeAverageOISwithType (AverageOIS::Type type)
 
MakeAverageOISwithNominal (Real nominal)
 
MakeAverageOISwithEffectiveDate (const Date &effectiveDate)
 
MakeAverageOISwithTerminationDate (const Date &terminationDate)
 
MakeAverageOISwithRule (DateGeneration::Rule rule)
 
MakeAverageOISwithSpotLagCalendar (const Calendar &spotLagCalendar)
 
MakeAverageOISwithFixedCalendar (const Calendar &fixedCalendar)
 
MakeAverageOISwithFixedConvention (BusinessDayConvention fixedConvention)
 
MakeAverageOISwithFixedTerminationDateConvention (BusinessDayConvention fixedTerminationDateConvention)
 
MakeAverageOISwithFixedRule (DateGeneration::Rule fixedRule)
 
MakeAverageOISwithFixedEndOfMonth (bool fixedEndOfMonth=false)
 
MakeAverageOISwithFixedFirstDate (const Date &fixedFirstDate)
 
MakeAverageOISwithFixedNextToLastDate (const Date &fixedNextToLastDate)
 
MakeAverageOISwithFixedPaymentAdjustment (BusinessDayConvention fixedPaymentAdjustment)
 
MakeAverageOISwithFixedPaymentCalendar (const Calendar &fixedPaymentCalendar)
 
MakeAverageOISwithONCalendar (const Calendar &onCalendar)
 
MakeAverageOISwithONConvention (BusinessDayConvention onConvention)
 
MakeAverageOISwithONTerminationDateConvention (BusinessDayConvention onTerminationDateConvention)
 
MakeAverageOISwithONRule (DateGeneration::Rule onRule)
 
MakeAverageOISwithONEndOfMonth (bool onEndOfMonth=false)
 
MakeAverageOISwithONFirstDate (const Date &onFirstDate)
 
MakeAverageOISwithONNextToLastDate (const Date &onNextToLastDate)
 
MakeAverageOISwithRateCutoff (Natural rateCutoff)
 
MakeAverageOISwithONSpread (Spread onSpread)
 
MakeAverageOISwithONGearing (Real onGearing)
 
MakeAverageOISwithONDayCounter (const DayCounter &onDayCounter)
 
MakeAverageOISwithONPaymentAdjustment (BusinessDayConvention onPaymentAdjustment)
 
MakeAverageOISwithONPaymentCalendar (const Calendar &onPaymentCalendar)
 
MakeAverageOISwithTelescopicValueDates (bool telescopicValueDates)
 
MakeAverageOISwithONCouponPricer (const QuantLib::ext::shared_ptr< AverageONIndexedCouponPricer > &onCouponPricer)
 
MakeAverageOISwithDiscountingTermStructure (const Handle< YieldTermStructure > &discountCurve)
 
MakeAverageOISwithPricingEngine (const QuantLib::ext::shared_ptr< PricingEngine > &engine)
 

Private Attributes

Period swapTenor_
 
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
 
Period onTenor_
 
Rate fixedRate_
 
Period fixedTenor_
 
DayCounter fixedDayCounter_
 
Period spotLagTenor_
 
Period forwardStart_
 
AverageOIS::Type type_
 
Real nominal_
 
Date effectiveDate_
 
Date terminationDate_
 
Calendar spotLagCalendar_
 
Calendar fixedCalendar_
 
BusinessDayConvention fixedConvention_
 
BusinessDayConvention fixedTerminationDateConvention_
 
DateGeneration::Rule fixedRule_
 
bool fixedEndOfMonth_
 
Date fixedFirstDate_
 
Date fixedNextToLastDate_
 
BusinessDayConvention fixedPaymentAdjustment_
 
Calendar fixedPaymentCalendar_
 
Calendar onCalendar_
 
BusinessDayConvention onConvention_
 
BusinessDayConvention onTerminationDateConvention_
 
DateGeneration::Rule onRule_
 
bool onEndOfMonth_
 
Date onFirstDate_
 
Date onNextToLastDate_
 
Natural rateCutoff_
 
Spread onSpread_
 
Real onGearing_
 
DayCounter onDayCounter_
 
BusinessDayConvention onPaymentAdjustment_
 
Calendar onPaymentCalendar_
 
bool telescopicValueDates_
 
QuantLib::ext::shared_ptr< PricingEngine > engine_
 
QuantLib::ext::shared_ptr< AverageONIndexedCouponPriceronCouponPricer_
 

Detailed Description

helper class

This class provides a more comfortable way to instantiate standard average ON indexed swaps.

    \ingroup instruments

Definition at line 39 of file makeaverageois.hpp.

Constructor & Destructor Documentation

◆ MakeAverageOIS()

MakeAverageOIS ( const Period &  swapTenor,
const QuantLib::ext::shared_ptr< OvernightIndex > &  overnightIndex,
const Period &  onTenor,
Rate  fixedRate,
const Period &  fixedTenor,
const DayCounter &  fixedDayCounter,
const Period &  spotLagTenor = 2 * Days,
const Period &  forwardStart = 0 * Days 
)

Definition at line 26 of file makeaverageois.cpp.

30 : swapTenor_(swapTenor), overnightIndex_(overnightIndex), onTenor_(onTenor), fixedRate_(fixedRate),
31 fixedTenor_(fixedTenor), fixedDayCounter_(fixedDayCounter), spotLagTenor_(spotLagTenor),
32 forwardStart_(forwardStart), type_(AverageOIS::Receiver), nominal_(1.0), effectiveDate_(Date()),
33 spotLagCalendar_(overnightIndex->fixingCalendar()), fixedCalendar_(WeekendsOnly()), fixedConvention_(Unadjusted),
34 fixedTerminationDateConvention_(Unadjusted), fixedRule_(DateGeneration::Backward), fixedEndOfMonth_(false),
36 fixedPaymentAdjustment_(overnightIndex->businessDayConvention()),
37 fixedPaymentCalendar_(overnightIndex->fixingCalendar()), onCalendar_(overnightIndex->fixingCalendar()),
38 onConvention_(overnightIndex->businessDayConvention()),
39 onTerminationDateConvention_(overnightIndex->businessDayConvention()), onRule_(DateGeneration::Backward),
40 onEndOfMonth_(false), onFirstDate_(Date()), onNextToLastDate_(Date()), rateCutoff_(0), onSpread_(0.0),
41 onGearing_(1.0), onDayCounter_(overnightIndex->dayCounter()),
42 onPaymentAdjustment_(overnightIndex->businessDayConvention()),
43 onPaymentCalendar_(overnightIndex->fixingCalendar()), telescopicValueDates_(false),
44 onCouponPricer_(QuantLib::ext::make_shared<AverageONIndexedCouponPricer>()) {}
BusinessDayConvention fixedConvention_
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
BusinessDayConvention fixedPaymentAdjustment_
BusinessDayConvention onPaymentAdjustment_
QuantLib::ext::shared_ptr< AverageONIndexedCouponPricer > onCouponPricer_
BusinessDayConvention onTerminationDateConvention_
DateGeneration::Rule fixedRule_
DateGeneration::Rule onRule_
BusinessDayConvention onConvention_
BusinessDayConvention fixedTerminationDateConvention_

Member Function Documentation

◆ operator AverageOIS()

operator AverageOIS ( ) const

Definition at line 46 of file makeaverageois.cpp.

46 {
47 QuantLib::ext::shared_ptr<AverageOIS> swap = *this;
48 return *swap;
49}

◆ operator QuantLib::ext::shared_ptr< AverageOIS >()

operator QuantLib::ext::shared_ptr< AverageOIS > ( ) const

Definition at line 51 of file makeaverageois.cpp.

51 {
52
53 // Deduce the effective date if it is not given.
54 Date effectiveDate;
55 if (effectiveDate_ != Date()) {
56 effectiveDate = effectiveDate_;
57 } else {
58 Date valuationDate = Settings::instance().evaluationDate();
59 // if the evaluation date is not a business day
60 // then move to the next business day
61 valuationDate = spotLagCalendar_.adjust(valuationDate);
62 Date spotDate = spotLagCalendar_.advance(valuationDate, spotLagTenor_);
63 effectiveDate = spotDate + forwardStart_;
64 }
65
66 // Deduce the termination date if it is not given.
67 Date terminationDate;
68 if (terminationDate_ != Date()) {
69 terminationDate = terminationDate_;
70 } else {
71 terminationDate = effectiveDate + swapTenor_;
72 }
73
74 Schedule fixedSchedule(effectiveDate, terminationDate, fixedTenor_, fixedCalendar_, fixedConvention_,
77
78 Schedule onSchedule(effectiveDate, terminationDate, onTenor_, onCalendar_, onConvention_,
80
81 QuantLib::ext::shared_ptr<AverageOIS> swap(
82 new AverageOIS(type_, nominal_, fixedSchedule, fixedRate_, fixedDayCounter_, fixedPaymentAdjustment_,
85
86 swap->setPricingEngine(engine_);
87 return swap;
88}
QuantLib::ext::shared_ptr< PricingEngine > engine_

◆ receiveFixed()

MakeAverageOIS & receiveFixed ( bool  receiveFixed = true)

Definition at line 90 of file makeaverageois.cpp.

90 {
92 return *this;
93}
MakeAverageOIS & receiveFixed(bool receiveFixed=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withType()

MakeAverageOIS & withType ( AverageOIS::Type  type)

Definition at line 95 of file makeaverageois.cpp.

95 {
96 type_ = type;
97 return *this;
98}

◆ withNominal()

MakeAverageOIS & withNominal ( Real  nominal)

Definition at line 100 of file makeaverageois.cpp.

100 {
101 nominal_ = nominal;
102 return *this;
103}

◆ withEffectiveDate()

MakeAverageOIS & withEffectiveDate ( const Date &  effectiveDate)

Definition at line 105 of file makeaverageois.cpp.

105 {
106 effectiveDate_ = effectiveDate;
107 return *this;
108}

◆ withTerminationDate()

MakeAverageOIS & withTerminationDate ( const Date &  terminationDate)

Definition at line 110 of file makeaverageois.cpp.

110 {
111 terminationDate_ = terminationDate;
112 swapTenor_ = Period();
113 return *this;
114}

◆ withRule()

MakeAverageOIS & withRule ( DateGeneration::Rule  rule)

Definition at line 116 of file makeaverageois.cpp.

116 {
117 fixedRule_ = rule;
118 onRule_ = rule;
119 return *this;
120}

◆ withSpotLagCalendar()

MakeAverageOIS & withSpotLagCalendar ( const Calendar &  spotLagCalendar)

Definition at line 122 of file makeaverageois.cpp.

122 {
123 spotLagCalendar_ = spotLagCalendar;
124 return *this;
125}

◆ withFixedCalendar()

MakeAverageOIS & withFixedCalendar ( const Calendar &  fixedCalendar)

Definition at line 127 of file makeaverageois.cpp.

127 {
128 fixedCalendar_ = fixedCalendar;
129 return *this;
130}
+ Here is the caller graph for this function:

◆ withFixedConvention()

MakeAverageOIS & withFixedConvention ( BusinessDayConvention  fixedConvention)

Definition at line 132 of file makeaverageois.cpp.

132 {
133 fixedConvention_ = fixedConvention;
134 return *this;
135}
+ Here is the caller graph for this function:

◆ withFixedTerminationDateConvention()

MakeAverageOIS & withFixedTerminationDateConvention ( BusinessDayConvention  fixedTerminationDateConvention)

Definition at line 138 of file makeaverageois.cpp.

138 {
139 fixedTerminationDateConvention_ = fixedTerminationDateConvention;
140 return *this;
141}
+ Here is the caller graph for this function:

◆ withFixedRule()

MakeAverageOIS & withFixedRule ( DateGeneration::Rule  fixedRule)

Definition at line 143 of file makeaverageois.cpp.

143 {
144 fixedRule_ = fixedRule;
145 return *this;
146}

◆ withFixedEndOfMonth()

MakeAverageOIS & withFixedEndOfMonth ( bool  fixedEndOfMonth = false)

Definition at line 148 of file makeaverageois.cpp.

148 {
149 fixedEndOfMonth_ = fixedEndOfMonth;
150 return *this;
151}

◆ withFixedFirstDate()

MakeAverageOIS & withFixedFirstDate ( const Date &  fixedFirstDate)

Definition at line 153 of file makeaverageois.cpp.

153 {
154 fixedFirstDate_ = fixedFirstDate;
155 return *this;
156}

◆ withFixedNextToLastDate()

MakeAverageOIS & withFixedNextToLastDate ( const Date &  fixedNextToLastDate)

Definition at line 158 of file makeaverageois.cpp.

158 {
159 fixedNextToLastDate_ = fixedNextToLastDate;
160 return *this;
161}

◆ withFixedPaymentAdjustment()

MakeAverageOIS & withFixedPaymentAdjustment ( BusinessDayConvention  fixedPaymentAdjustment)

Definition at line 163 of file makeaverageois.cpp.

163 {
164 fixedPaymentAdjustment_ = fixedPaymentAdjustment;
165 return *this;
166}
+ Here is the caller graph for this function:

◆ withFixedPaymentCalendar()

MakeAverageOIS & withFixedPaymentCalendar ( const Calendar &  fixedPaymentCalendar)

Definition at line 168 of file makeaverageois.cpp.

168 {
169 fixedPaymentCalendar_ = fixedPaymentCalendar;
170 return *this;
171}

◆ withONCalendar()

MakeAverageOIS & withONCalendar ( const Calendar &  onCalendar)

Definition at line 173 of file makeaverageois.cpp.

173 {
174 onCalendar_ = onCalendar;
175 return *this;
176}

◆ withONConvention()

MakeAverageOIS & withONConvention ( BusinessDayConvention  onConvention)

Definition at line 178 of file makeaverageois.cpp.

178 {
179 onConvention_ = onConvention;
180 return *this;
181}

◆ withONTerminationDateConvention()

MakeAverageOIS & withONTerminationDateConvention ( BusinessDayConvention  onTerminationDateConvention)

Definition at line 183 of file makeaverageois.cpp.

183 {
184 onTerminationDateConvention_ = onTerminationDateConvention;
185 return *this;
186}

◆ withONRule()

MakeAverageOIS & withONRule ( DateGeneration::Rule  onRule)

Definition at line 188 of file makeaverageois.cpp.

188 {
189 onRule_ = onRule;
190 return *this;
191}

◆ withONEndOfMonth()

MakeAverageOIS & withONEndOfMonth ( bool  onEndOfMonth = false)

Definition at line 193 of file makeaverageois.cpp.

193 {
194 onEndOfMonth_ = onEndOfMonth;
195 return *this;
196}

◆ withONFirstDate()

MakeAverageOIS & withONFirstDate ( const Date &  onFirstDate)

Definition at line 198 of file makeaverageois.cpp.

198 {
199 onFirstDate_ = onFirstDate;
200 return *this;
201}

◆ withONNextToLastDate()

MakeAverageOIS & withONNextToLastDate ( const Date &  onNextToLastDate)

Definition at line 203 of file makeaverageois.cpp.

203 {
204 onNextToLastDate_ = onNextToLastDate;
205 return *this;
206}

◆ withRateCutoff()

MakeAverageOIS & withRateCutoff ( Natural  rateCutoff)

Definition at line 208 of file makeaverageois.cpp.

208 {
209 rateCutoff_ = rateCutoff;
210 return *this;
211}
+ Here is the caller graph for this function:

◆ withONSpread()

MakeAverageOIS & withONSpread ( Spread  onSpread)

Definition at line 213 of file makeaverageois.cpp.

213 {
214 onSpread_ = onSpread;
215 return *this;
216}

◆ withONGearing()

MakeAverageOIS & withONGearing ( Real  onGearing)

Definition at line 218 of file makeaverageois.cpp.

218 {
219 onGearing_ = onGearing;
220 return *this;
221}

◆ withONDayCounter()

MakeAverageOIS & withONDayCounter ( const DayCounter &  onDayCounter)

Definition at line 223 of file makeaverageois.cpp.

223 {
224 onDayCounter_ = onDayCounter;
225 return *this;
226}

◆ withONPaymentAdjustment()

MakeAverageOIS & withONPaymentAdjustment ( BusinessDayConvention  onPaymentAdjustment)

Definition at line 228 of file makeaverageois.cpp.

228 {
229 onPaymentAdjustment_ = onPaymentAdjustment;
230 return *this;
231}

◆ withONPaymentCalendar()

MakeAverageOIS & withONPaymentCalendar ( const Calendar &  onPaymentCalendar)

Definition at line 233 of file makeaverageois.cpp.

233 {
234 onPaymentCalendar_ = onPaymentCalendar;
235 return *this;
236}

◆ withTelescopicValueDates()

MakeAverageOIS & withTelescopicValueDates ( bool  telescopicValueDates)

Definition at line 238 of file makeaverageois.cpp.

238 {
239 telescopicValueDates_ = telescopicValueDates;
240 return *this;
241}
+ Here is the caller graph for this function:

◆ withONCouponPricer()

MakeAverageOIS & withONCouponPricer ( const QuantLib::ext::shared_ptr< AverageONIndexedCouponPricer > &  onCouponPricer)

Definition at line 244 of file makeaverageois.cpp.

244 {
245 onCouponPricer_ = onCouponPricer;
246 return *this;
247}

◆ withDiscountingTermStructure()

MakeAverageOIS & withDiscountingTermStructure ( const Handle< YieldTermStructure > &  discountCurve)

Definition at line 249 of file makeaverageois.cpp.

249 {
250 bool includeSettlementDateFlows = false;
251 engine_ = QuantLib::ext::shared_ptr<PricingEngine>(new DiscountingSwapEngine(discountCurve, includeSettlementDateFlows));
252 return *this;
253}
+ Here is the caller graph for this function:

◆ withPricingEngine()

MakeAverageOIS & withPricingEngine ( const QuantLib::ext::shared_ptr< PricingEngine > &  engine)

Definition at line 255 of file makeaverageois.cpp.

255 {
256 engine_ = engine;
257 return *this;
258}

Member Data Documentation

◆ swapTenor_

Period swapTenor_
private

Definition at line 90 of file makeaverageois.hpp.

◆ overnightIndex_

QuantLib::ext::shared_ptr<OvernightIndex> overnightIndex_
private

Definition at line 91 of file makeaverageois.hpp.

◆ onTenor_

Period onTenor_
private

Definition at line 92 of file makeaverageois.hpp.

◆ fixedRate_

Rate fixedRate_
private

Definition at line 93 of file makeaverageois.hpp.

◆ fixedTenor_

Period fixedTenor_
private

Definition at line 94 of file makeaverageois.hpp.

◆ fixedDayCounter_

DayCounter fixedDayCounter_
private

Definition at line 95 of file makeaverageois.hpp.

◆ spotLagTenor_

Period spotLagTenor_
private

Definition at line 96 of file makeaverageois.hpp.

◆ forwardStart_

Period forwardStart_
private

Definition at line 97 of file makeaverageois.hpp.

◆ type_

AverageOIS::Type type_
private

Definition at line 99 of file makeaverageois.hpp.

◆ nominal_

Real nominal_
private

Definition at line 100 of file makeaverageois.hpp.

◆ effectiveDate_

Date effectiveDate_
private

Definition at line 101 of file makeaverageois.hpp.

◆ terminationDate_

Date terminationDate_
private

Definition at line 102 of file makeaverageois.hpp.

◆ spotLagCalendar_

Calendar spotLagCalendar_
private

Definition at line 103 of file makeaverageois.hpp.

◆ fixedCalendar_

Calendar fixedCalendar_
private

Definition at line 105 of file makeaverageois.hpp.

◆ fixedConvention_

BusinessDayConvention fixedConvention_
private

Definition at line 106 of file makeaverageois.hpp.

◆ fixedTerminationDateConvention_

BusinessDayConvention fixedTerminationDateConvention_
private

Definition at line 107 of file makeaverageois.hpp.

◆ fixedRule_

DateGeneration::Rule fixedRule_
private

Definition at line 108 of file makeaverageois.hpp.

◆ fixedEndOfMonth_

bool fixedEndOfMonth_
private

Definition at line 109 of file makeaverageois.hpp.

◆ fixedFirstDate_

Date fixedFirstDate_
private

Definition at line 110 of file makeaverageois.hpp.

◆ fixedNextToLastDate_

Date fixedNextToLastDate_
private

Definition at line 111 of file makeaverageois.hpp.

◆ fixedPaymentAdjustment_

BusinessDayConvention fixedPaymentAdjustment_
private

Definition at line 112 of file makeaverageois.hpp.

◆ fixedPaymentCalendar_

Calendar fixedPaymentCalendar_
private

Definition at line 113 of file makeaverageois.hpp.

◆ onCalendar_

Calendar onCalendar_
private

Definition at line 115 of file makeaverageois.hpp.

◆ onConvention_

BusinessDayConvention onConvention_
private

Definition at line 116 of file makeaverageois.hpp.

◆ onTerminationDateConvention_

BusinessDayConvention onTerminationDateConvention_
private

Definition at line 117 of file makeaverageois.hpp.

◆ onRule_

DateGeneration::Rule onRule_
private

Definition at line 118 of file makeaverageois.hpp.

◆ onEndOfMonth_

bool onEndOfMonth_
private

Definition at line 119 of file makeaverageois.hpp.

◆ onFirstDate_

Date onFirstDate_
private

Definition at line 120 of file makeaverageois.hpp.

◆ onNextToLastDate_

Date onNextToLastDate_
private

Definition at line 121 of file makeaverageois.hpp.

◆ rateCutoff_

Natural rateCutoff_
private

Definition at line 122 of file makeaverageois.hpp.

◆ onSpread_

Spread onSpread_
private

Definition at line 123 of file makeaverageois.hpp.

◆ onGearing_

Real onGearing_
private

Definition at line 124 of file makeaverageois.hpp.

◆ onDayCounter_

DayCounter onDayCounter_
private

Definition at line 125 of file makeaverageois.hpp.

◆ onPaymentAdjustment_

BusinessDayConvention onPaymentAdjustment_
private

Definition at line 126 of file makeaverageois.hpp.

◆ onPaymentCalendar_

Calendar onPaymentCalendar_
private

Definition at line 127 of file makeaverageois.hpp.

◆ telescopicValueDates_

bool telescopicValueDates_
private

Definition at line 128 of file makeaverageois.hpp.

◆ engine_

QuantLib::ext::shared_ptr<PricingEngine> engine_
private

Definition at line 130 of file makeaverageois.hpp.

◆ onCouponPricer_

QuantLib::ext::shared_ptr<AverageONIndexedCouponPricer> onCouponPricer_
private

Definition at line 131 of file makeaverageois.hpp.