QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
makevanillaswap.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, 2010 Ferdinando Ametrano
5 Copyright (C) 2006 Katiuscia Manzoni
6 Copyright (C) 2006 StatPro Italia srl
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 makevanillaswap.hpp
23 \brief Helper class to instantiate standard market swaps.
24*/
25
26#ifndef quantlib_makevanillaswap_hpp
27#define quantlib_makevanillaswap_hpp
28
32
33namespace QuantLib {
34
35 //! helper class
36 /*! This class provides a more comfortable way
37 to instantiate standard market swap.
38 */
40 public:
41 MakeVanillaSwap(const Period& swapTenor,
42 const ext::shared_ptr<IborIndex>& iborIndex,
43 Rate fixedRate = Null<Rate>(),
44 const Period& forwardStart = 0*Days);
45
46 operator VanillaSwap() const;
47 operator ext::shared_ptr<VanillaSwap>() const;
48
49 MakeVanillaSwap& receiveFixed(bool flag = true);
52
58
65 MakeVanillaSwap& withFixedLegEndOfMonth(bool flag = true);
69
81
83 const Handle<YieldTermStructure>& discountCurve);
85 const ext::shared_ptr<PricingEngine>& engine);
86 MakeVanillaSwap& withIndexedCoupons(const ext::optional<bool>& b = true);
88 private:
90 ext::shared_ptr<IborIndex> iborIndex_;
93
97
106 bool fixedEndOfMonth_ = false, floatEndOfMonth_ = false;
111 ext::optional<bool> useIndexedCoupons_;
112 ext::optional<BusinessDayConvention> paymentConvention_;
113
114 ext::shared_ptr<PricingEngine> engine_;
115 };
116
117}
118
119#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
MakeVanillaSwap & receiveFixed(bool flag=true)
MakeVanillaSwap & withFixedLegFirstDate(const Date &d)
MakeVanillaSwap & withEffectiveDate(const Date &)
MakeVanillaSwap & withFixedLegConvention(BusinessDayConvention bdc)
BusinessDayConvention fixedConvention_
MakeVanillaSwap & withFixedLegTerminationDateConvention(BusinessDayConvention bdc)
MakeVanillaSwap & withFloatingLegFirstDate(const Date &d)
MakeVanillaSwap & withFixedLegCalendar(const Calendar &cal)
MakeVanillaSwap & withFloatingLegTerminationDateConvention(BusinessDayConvention bdc)
MakeVanillaSwap & withTerminationDate(const Date &)
MakeVanillaSwap & withAtParCoupons(bool b=true)
MakeVanillaSwap & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountCurve)
DateGeneration::Rule floatRule_
MakeVanillaSwap & withIndexedCoupons(const ext::optional< bool > &b=true)
MakeVanillaSwap & withPricingEngine(const ext::shared_ptr< PricingEngine > &engine)
MakeVanillaSwap & withSettlementDays(Natural settlementDays)
MakeVanillaSwap & withFixedLegDayCount(const DayCounter &dc)
MakeVanillaSwap & withFixedLegEndOfMonth(bool flag=true)
ext::shared_ptr< IborIndex > iborIndex_
MakeVanillaSwap & withFloatingLegDayCount(const DayCounter &dc)
ext::optional< bool > useIndexedCoupons_
BusinessDayConvention floatTerminationDateConvention_
MakeVanillaSwap & withRule(DateGeneration::Rule r)
MakeVanillaSwap & withFloatingLegSpread(Spread sp)
MakeVanillaSwap & withNominal(Real n)
MakeVanillaSwap & withFloatingLegCalendar(const Calendar &cal)
DateGeneration::Rule fixedRule_
ext::shared_ptr< PricingEngine > engine_
ext::optional< BusinessDayConvention > paymentConvention_
BusinessDayConvention fixedTerminationDateConvention_
MakeVanillaSwap & withFloatingLegRule(DateGeneration::Rule r)
MakeVanillaSwap & withFloatingLegTenor(const Period &t)
MakeVanillaSwap & withFixedLegRule(DateGeneration::Rule r)
MakeVanillaSwap & withType(Swap::Type type)
MakeVanillaSwap & withFloatingLegNextToLastDate(const Date &d)
MakeVanillaSwap & withFloatingLegEndOfMonth(bool flag=true)
MakeVanillaSwap & withFloatingLegConvention(BusinessDayConvention bdc)
BusinessDayConvention floatConvention_
MakeVanillaSwap & withPaymentConvention(BusinessDayConvention bdc)
MakeVanillaSwap & withFixedLegNextToLastDate(const Date &d)
MakeVanillaSwap & withFixedLegTenor(const Period &t)
template class providing a null value for a given type.
Definition: null.hpp:76
Plain-vanilla swap: fix vs ibor leg.
Definition: vanillaswap.hpp:65
date generation rule
const DefaultType & t
Date d
ext::function< Real(Real)> b
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
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
Simple fixed-rate vs Libor swap.
Interest-rate term structure.