QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lognormalcmsspreadpricer.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) 2014, 2015, 2018 Peter Caspers
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
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */
19
20/*! \file lognormalcmsspreadpricer.hpp
21 \brief cms spread coupon pricer as in Brigo, Mercurio, 13.6.2, with
22 extensions for shifted lognormal and normal dynamics as
23 described in http://ssrn.com/abstract=2686998
24*/
25
26#ifndef quantlib_lognormal_cmsspread_pricer_hpp
27#define quantlib_lognormal_cmsspread_pricer_hpp
28
34#include <ql/optional.hpp>
35
36namespace QuantLib {
37
38 class CmsSpreadCoupon;
39 class YieldTermStructure;
40
41 //! CMS spread - coupon pricer
42 /*! The swap rate adjustments are computed using the given
43 volatility structures for the underlyings in every case
44 (w.r.t. volatility type and shift).
45
46 For the bivariate spread model, the volatility type and
47 the shifts can be inherited (default), or explicitly
48 specified. In the latter case the type, and (if lognormal)
49 the shifts must be given (or are defaulted to zero, if not
50 given).
51
52 References:
53
54 Brigo, Mercurio: Interst Rate Models - Theory and Practice,
55 2nd Edition, Springer, 2006, chapter 13.6.2
56
57 http://ssrn.com/abstract=2686998
58 */
59
61
62 public:
64 const ext::shared_ptr<CmsCouponPricer>& cmsPricer,
67 Size IntegrationPoints = 16,
68 const ext::optional<VolatilityType>& volatilityType = ext::nullopt,
69 Real shift1 = Null<Real>(),
70 Real shift2 = Null<Real>());
71
72 /* */
73 Real swapletPrice() const override;
74 Rate swapletRate() const override;
75 Real capletPrice(Rate effectiveCap) const override;
76 Rate capletRate(Rate effectiveCap) const override;
77 Real floorletPrice(Rate effectiveFloor) const override;
78 Rate floorletRate(Rate effectiveFloor) const override;
79
80 private:
81 void initialize(const FloatingRateCoupon& coupon) override;
82 Real optionletPrice(Option::Type optionType, Real strike) const;
83
84 Real integrand(Real) const;
86
87 class integrand_f;
88
89 ext::shared_ptr<CmsCouponPricer> cmsPricer_;
90
92
94
96
98
102
103 ext::shared_ptr<SwapSpreadIndex> index_;
104
105 ext::shared_ptr<CumulativeNormalDistribution> cnd_;
106 ext::shared_ptr<GaussianQuadrature> integrator_;
107
113
117
118 mutable Real phi_, a_, b_, s1_, s2_, m1_, m2_, v1_, v2_, k_;
119 mutable Real alpha_, psi_;
121
122 ext::shared_ptr<CmsCoupon> c1_, c2_;
123 };
124}
125
126#endif
CMS spread coupon class.
base pricer for vanilla CMS spread coupons
Handle< Quote > correlation() const
Concrete date class.
Definition: date.hpp:125
base floating-rate coupon class
Shared handle to an observable.
Definition: handle.hpp:41
Real capletPrice(Rate effectiveCap) const override
Rate floorletRate(Rate effectiveFloor) const override
void initialize(const FloatingRateCoupon &coupon) override
ext::shared_ptr< GaussianQuadrature > integrator_
ext::shared_ptr< CmsCouponPricer > cmsPricer_
ext::shared_ptr< CumulativeNormalDistribution > cnd_
Handle< YieldTermStructure > couponDiscountCurve_
Real floorletPrice(Rate effectiveFloor) const override
ext::shared_ptr< SwapSpreadIndex > index_
Real optionletPrice(Option::Type optionType, Real strike) const
Rate capletRate(Rate effectiveCap) const override
template class providing a null value for a given type.
Definition: null.hpp:76
CMS coupon.
CMS spread coupon.
Integral of a 1-dimensional function using the Gauss quadratures.
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
const boost::none_t & nullopt
Definition: optional.cpp:27
Definition: any.hpp:35
normal, cumulative and inverse cumulative distributions
Maps optional to either the boost or std implementation.
swap-rate spread indexes