QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
makecms.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) 2006, 2007 Ferdinando Ametrano
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file makecms.hpp
21 \brief Helper class to instantiate standard market CMS.
22*/
23
24#ifndef quantlib_makecms_hpp
25#define quantlib_makecms_hpp
26
29#include <ql/pricingengine.hpp>
30
31namespace QuantLib {
32
33 class Swap;
34 class IborIndex;
35
36 //! helper class for instantiating CMS
37 /*! This class provides a more comfortable way
38 to instantiate standard market constant maturity swap.
39 */
40 class MakeCms {
41 public:
42 MakeCms(const Period& swapTenor,
43 const ext::shared_ptr<SwapIndex>& swapIndex,
44 const ext::shared_ptr<IborIndex>& iborIndex,
45 Spread iborSpread = 0.0,
46 const Period& forwardStart = 0*Days);
47
48 MakeCms(const Period& swapTenor,
49 const ext::shared_ptr<SwapIndex>& swapIndex,
50 Spread iborSpread = 0.0,
51 const Period& forwardStart = 0*Days);
52
53 operator Swap() const;
54 operator ext::shared_ptr<Swap>() const ;
55
56 MakeCms& receiveCms(bool flag = true);
59
65 MakeCms& withCmsLegEndOfMonth(bool flag = true);
69
76 MakeCms& withFloatingLegEndOfMonth(bool flag = true);
80
81 MakeCms& withAtmSpread(bool flag = true);
82
84 const Handle<YieldTermStructure>& discountingTermStructure);
86 const ext::shared_ptr<CmsCouponPricer>& couponPricer);
87
88 private:
90 ext::shared_ptr<SwapIndex> swapIndex_;
91 ext::shared_ptr<IborIndex> iborIndex_;
95
99
102
113
114 ext::shared_ptr<PricingEngine> engine_;
115 ext::shared_ptr<CmsCouponPricer> couponPricer_;
116 };
117
118}
119
120#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 for instantiating CMS
Definition: makecms.hpp:40
Period swapTenor_
Definition: makecms.hpp:89
Spread iborSpread_
Definition: makecms.hpp:92
MakeCms & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountingTermStructure)
Definition: makecms.cpp:188
BusinessDayConvention cmsTerminationDateConvention_
Definition: makecms.hpp:106
MakeCms & withNominal(Real n)
Definition: makecms.cpp:177
MakeCms & withCmsLegEndOfMonth(bool flag=true)
Definition: makecms.cpp:228
ext::shared_ptr< CmsCouponPricer > couponPricer_
Definition: makecms.hpp:115
Date floatNextToLastDate_
Definition: makecms.hpp:111
MakeCms & withCmsLegNextToLastDate(const Date &d)
Definition: makecms.cpp:239
Period floatTenor_
Definition: makecms.hpp:105
DateGeneration::Rule floatRule_
Definition: makecms.hpp:108
MakeCms & withFloatingLegDayCount(const DayCounter &dc)
Definition: makecms.cpp:296
Period forwardStart_
Definition: makecms.hpp:94
DayCounter floatDayCount_
Definition: makecms.hpp:112
MakeCms & withCmsLegRule(DateGeneration::Rule r)
Definition: makecms.cpp:223
ext::shared_ptr< IborIndex > iborIndex_
Definition: makecms.hpp:91
MakeCms & withFloatingLegConvention(BusinessDayConvention bdc)
Definition: makecms.cpp:262
Spread cmsSpread_
Definition: makecms.hpp:96
MakeCms & withFloatingLegRule(DateGeneration::Rule r)
Definition: makecms.cpp:273
ext::shared_ptr< SwapIndex > swapIndex_
Definition: makecms.hpp:90
MakeCms & withCmsLegConvention(BusinessDayConvention bdc)
Definition: makecms.cpp:212
BusinessDayConvention floatTerminationDateConvention_
Definition: makecms.hpp:107
MakeCms & withCmsLegCalendar(const Calendar &cal)
Definition: makecms.cpp:206
MakeCms & withCmsLegDayCount(const DayCounter &dc)
Definition: makecms.cpp:245
MakeCms & withFloatingLegTenor(const Period &t)
Definition: makecms.cpp:250
MakeCms & withEffectiveDate(const Date &)
Definition: makecms.cpp:183
DayCounter cmsDayCount_
Definition: makecms.hpp:112
ext::shared_ptr< PricingEngine > engine_
Definition: makecms.hpp:114
MakeCms & receiveCms(bool flag=true)
Definition: makecms.cpp:172
MakeCms & withCmsLegTerminationDateConvention(BusinessDayConvention)
Definition: makecms.cpp:218
MakeCms & withFloatingLegNextToLastDate(const Date &d)
Definition: makecms.cpp:290
MakeCms & withCmsLegFirstDate(const Date &d)
Definition: makecms.cpp:233
Calendar cmsCalendar_
Definition: makecms.hpp:101
MakeCms & withFloatingLegFirstDate(const Date &d)
Definition: makecms.cpp:284
Calendar floatCalendar_
Definition: makecms.hpp:101
Date cmsNextToLastDate_
Definition: makecms.hpp:110
BusinessDayConvention floatConvention_
Definition: makecms.hpp:107
MakeCms & withCmsCouponPricer(const ext::shared_ptr< CmsCouponPricer > &couponPricer)
Definition: makecms.cpp:194
MakeCms & withAtmSpread(bool flag=true)
Definition: makecms.cpp:301
MakeCms & withFloatingLegTerminationDateConvention(BusinessDayConvention bdc)
Definition: makecms.cpp:268
MakeCms & withCmsLegTenor(const Period &t)
Definition: makecms.cpp:200
DateGeneration::Rule cmsRule_
Definition: makecms.hpp:108
BusinessDayConvention cmsConvention_
Definition: makecms.hpp:106
MakeCms & withFloatingLegEndOfMonth(bool flag=true)
Definition: makecms.cpp:278
MakeCms & withFloatingLegCalendar(const Calendar &cal)
Definition: makecms.cpp:256
Interest rate swap.
Definition: swap.hpp:41
CMS coupon.
Coupon pricers.
const DefaultType & t
Date d
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
Real Spread
spreads on interest rates
Definition: types.hpp:74
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
ext::shared_ptr< YieldTermStructure > r
Base class for pricing engines.