QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
makeois.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Ferdinando Ametrano
5 Copyright (C) 2017 Joseph Jeisman
6 Copyright (C) 2017 Fabrice Lecuyer
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22/*! \file makeois.hpp
23 \brief Helper class to instantiate overnight indexed swaps.
24*/
25
26#ifndef quantlib_makeois_hpp
27#define quantlib_makeois_hpp
28
32
33namespace QuantLib {
34
35 //! helper class
36 /*! This class provides a more comfortable way
37 to instantiate overnight indexed swaps.
38 */
39 class MakeOIS {
40 public:
41 MakeOIS(const Period& swapTenor,
42 const ext::shared_ptr<OvernightIndex>& overnightIndex,
43 Rate fixedRate = Null<Rate>(),
44 const Period& fwdStart = 0*Days);
45
46 operator OvernightIndexedSwap() const;
47 operator ext::shared_ptr<OvernightIndexedSwap>() const ;
48
49 MakeOIS& receiveFixed(bool flag = true);
52
53 MakeOIS& withSettlementDays(Natural settlementDays);
59
66 MakeOIS& withCalendar(const Calendar& cal);
69
76 MakeOIS& withEndOfMonth(bool flag = true);
77 MakeOIS& withFixedLegEndOfMonth(bool flag = true);
78 MakeOIS& withOvernightLegEndOfMonth(bool flag = true);
79
81
83
85 const Handle<YieldTermStructure>& discountingTermStructure);
86
87 MakeOIS &withTelescopicValueDates(bool telescopicValueDates);
88
90
91 MakeOIS& withLookbackDays(Natural lookbackDays);
92 MakeOIS& withLockoutDays(Natural lockoutDays);
93 MakeOIS& withObservationShift(bool applyObservationShift = true);
94
96 const ext::shared_ptr<PricingEngine>& engine);
97 private:
99 ext::shared_ptr<OvernightIndex> overnightIndex_;
102
106
112
120
123
126
127 ext::shared_ptr<PricingEngine> engine_;
128
134 };
135
136}
137
138#endif
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
helper class
Definition: makeois.hpp:39
Period swapTenor_
Definition: makeois.hpp:98
ext::shared_ptr< OvernightIndex > overnightIndex_
Definition: makeois.hpp:99
BusinessDayConvention paymentAdjustment_
Definition: makeois.hpp:110
BusinessDayConvention fixedConvention_
Definition: makeois.hpp:113
MakeOIS & withFixedLegRule(DateGeneration::Rule r)
Definition: makeois.cpp:247
bool telescopicValueDates_
Definition: makeois.hpp:129
MakeOIS & withPaymentAdjustment(BusinessDayConvention convention)
Definition: makeois.cpp:214
MakeOIS & withTerminationDateConvention(BusinessDayConvention bdc)
Definition: makeois.cpp:290
MakeOIS & withPaymentLag(Integer lag)
Definition: makeois.cpp:219
MakeOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountingTermStructure)
Definition: makeois.cpp:257
Natural lookbackDays_
Definition: makeois.hpp:131
MakeOIS & withLockoutDays(Natural lockoutDays)
Definition: makeois.cpp:341
MakeOIS & withType(Swap::Type type)
Definition: makeois.cpp:172
MakeOIS & withSettlementDays(Natural settlementDays)
Definition: makeois.cpp:182
Calendar paymentCalendar_
Definition: makeois.hpp:109
DateGeneration::Rule overnightRule_
Definition: makeois.hpp:118
DayCounter fixedDayCount_
Definition: makeois.hpp:125
MakeOIS & receiveFixed(bool flag=true)
Definition: makeois.cpp:167
Period forwardStart_
Definition: makeois.hpp:101
MakeOIS & withPaymentFrequency(Frequency f)
Definition: makeois.cpp:200
bool overnightEndOfMonth_
Definition: makeois.hpp:119
MakeOIS & withFixedLegDayCount(const DayCounter &dc)
Definition: makeois.cpp:271
Integer paymentLag_
Definition: makeois.hpp:111
MakeOIS & withRule(DateGeneration::Rule r)
Definition: makeois.cpp:243
MakeOIS & withCalendar(const Calendar &cal)
Definition: makeois.cpp:229
MakeOIS & withPricingEngine(const ext::shared_ptr< PricingEngine > &engine)
Definition: makeois.cpp:265
MakeOIS & withFixedLegEndOfMonth(bool flag=true)
Definition: makeois.cpp:309
MakeOIS & withLookbackDays(Natural lookbackDays)
Definition: makeois.cpp:336
MakeOIS & withOvernightLegRule(DateGeneration::Rule r)
Definition: makeois.cpp:252
MakeOIS & withFixedLegConvention(BusinessDayConvention bdc)
Definition: makeois.cpp:280
BusinessDayConvention overnightConvention_
Definition: makeois.hpp:115
bool applyObservationShift_
Definition: makeois.hpp:133
Frequency fixedPaymentFrequency_
Definition: makeois.hpp:107
MakeOIS & withOvernightLegTerminationDateConvention(BusinessDayConvention bdc)
Definition: makeois.cpp:300
MakeOIS & withFixedLegTerminationDateConvention(BusinessDayConvention bdc)
Definition: makeois.cpp:295
Frequency overnightPaymentFrequency_
Definition: makeois.hpp:108
Natural settlementDays_
Definition: makeois.hpp:103
RateAveraging::Type averagingMethod_
Definition: makeois.hpp:130
BusinessDayConvention overnightTerminationDateConvention_
Definition: makeois.hpp:116
MakeOIS & withFixedLegCalendar(const Calendar &cal)
Definition: makeois.cpp:233
MakeOIS & withPaymentCalendar(const Calendar &cal)
Definition: makeois.cpp:224
DateGeneration::Rule fixedRule_
Definition: makeois.hpp:117
MakeOIS & withTerminationDate(const Date &)
Definition: makeois.cpp:193
MakeOIS & withEffectiveDate(const Date &)
Definition: makeois.cpp:188
MakeOIS & withOvernightLegSpread(Spread sp)
Definition: makeois.cpp:321
ext::shared_ptr< PricingEngine > engine_
Definition: makeois.hpp:127
Calendar overnightCalendar_
Definition: makeois.hpp:105
Swap::Type type_
Definition: makeois.hpp:121
MakeOIS & withEndOfMonth(bool flag=true)
Definition: makeois.cpp:305
MakeOIS & withOvernightLegPaymentFrequency(Frequency f)
Definition: makeois.cpp:209
MakeOIS & withFixedLegPaymentFrequency(Frequency f)
Definition: makeois.cpp:204
BusinessDayConvention fixedTerminationDateConvention_
Definition: makeois.hpp:114
MakeOIS & withNominal(Real n)
Definition: makeois.cpp:177
MakeOIS & withAveragingMethod(RateAveraging::Type averagingMethod)
Definition: makeois.cpp:331
Natural lockoutDays_
Definition: makeois.hpp:132
MakeOIS & withTelescopicValueDates(bool telescopicValueDates)
Definition: makeois.cpp:326
MakeOIS & withConvention(BusinessDayConvention bdc)
Definition: makeois.cpp:276
MakeOIS & withOvernightLegConvention(BusinessDayConvention bdc)
Definition: makeois.cpp:285
Spread overnightSpread_
Definition: makeois.hpp:124
Calendar fixedCalendar_
Definition: makeois.hpp:105
MakeOIS & withObservationShift(bool applyObservationShift=true)
Definition: makeois.cpp:346
MakeOIS & withOvernightLegCalendar(const Calendar &cal)
Definition: makeois.cpp:238
MakeOIS & withOvernightLegEndOfMonth(bool flag=true)
Definition: makeois.cpp:315
template class providing a null value for a given type.
Definition: null.hpp:59
Overnight indexed swap: fix vs compounded overnight rate.
date generation rule
Frequency
Frequency of events.
Definition: frequency.hpp:37
BusinessDayConvention
Business Day conventions.
@ Annual
once a year
Definition: frequency.hpp:39
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Real Spread
spreads on interest rates
Definition: types.hpp:74
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:37
Overnight index swap paying compounded overnight vs. fixed.
ext::shared_ptr< YieldTermStructure > r
Interest-rate term structure.