QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
swaptionhelper.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2001, 2002, 2003 Sadruddin Rejeb
5 Copyright (C) 2015 Peter Caspers
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_swaption_calibration_helper_hpp
26#define quantlib_swaption_calibration_helper_hpp
27
28#include <ql/models/calibrationhelper.hpp>
29#include <ql/instruments/swaption.hpp>
30#include <ql/termstructures/volatility/volatilitytype.hpp>
31
32namespace QuantLib {
33
35
37 public:
38 SwaptionHelper(const Period& maturity,
39 const Period& length,
41 ext::shared_ptr<IborIndex> index,
42 const Period& fixedLegTenor,
43 DayCounter fixedLegDayCounter,
44 DayCounter floatingLegDayCounter,
45 Handle<YieldTermStructure> termStructure,
48 Real strike = Null<Real>(),
49 Real nominal = 1.0,
51 Real shift = 0.0);
52
53 SwaptionHelper(const Date& exerciseDate,
54 const Period& length,
56 ext::shared_ptr<IborIndex> index,
57 const Period& fixedLegTenor,
58 DayCounter fixedLegDayCounter,
59 DayCounter floatingLegDayCounter,
60 Handle<YieldTermStructure> termStructure,
63 Real strike = Null<Real>(),
64 Real nominal = 1.0,
66 Real shift = 0.0);
67
68 SwaptionHelper(const Date& exerciseDate,
69 const Date& endDate,
71 ext::shared_ptr<IborIndex> index,
72 const Period& fixedLegTenor,
73 DayCounter fixedLegDayCounter,
74 DayCounter floatingLegDayCounter,
75 Handle<YieldTermStructure> termStructure,
78 Real strike = Null<Real>(),
79 Real nominal = 1.0,
81 Real shift = 0.0);
82
83 void addTimesTo(std::list<Time>& times) const override;
84 Real modelValue() const override;
85 Real blackPrice(Volatility volatility) const override;
86
87 ext::shared_ptr<VanillaSwap> underlyingSwap() const { calculate(); return swap_; }
88 ext::shared_ptr<Swaption> swaption() const { calculate(); return swaption_; }
89
90 private:
91 void performCalculations() const override;
94 const ext::shared_ptr<IborIndex> index_;
99 mutable ext::shared_ptr<VanillaSwap> swap_;
100 mutable ext::shared_ptr<Swaption> swaption_;
101 };
102
103}
104
105#endif
liquid Black76 market instrument used during calibration
Handle< Quote > volatility() const
returns the volatility Handle
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
virtual void calculate() const
Definition: lazyobject.hpp:253
template class providing a null value for a given type.
Definition: null.hpp:76
calibration helper for ATM swaption
ext::shared_ptr< Swaption > swaption_
void performCalculations() const override
ext::shared_ptr< VanillaSwap > underlyingSwap() const
ext::shared_ptr< VanillaSwap > swap_
const ext::shared_ptr< IborIndex > index_
Real blackPrice(Volatility volatility) const override
Black or Bachelier price given a volatility.
ext::shared_ptr< Swaption > swaption() const
Real modelValue() const override
returns the price of the instrument according to the model
void addTimesTo(std::list< Time > &times) const override
const DayCounter floatingLegDayCounter_
const Handle< YieldTermStructure > termStructure_
const DayCounter fixedLegDayCounter_
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35