QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
lognormalcmsspreadpricer.hpp
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
26#ifndef quantlib_lognormal_cmsspread_pricer_hpp
27#define quantlib_lognormal_cmsspread_pricer_hpp
28
29#include <ql/cashflows/cmscoupon.hpp>
30#include <ql/experimental/coupons/cmsspreadcoupon.hpp>
31#include <ql/experimental/coupons/swapspreadindex.hpp>
32#include <ql/math/integrals/gaussianquadratures.hpp>
33#include <ql/math/distributions/normaldistribution.hpp>
34#include <ql/optional.hpp>
35
36namespace QuantLib {
37
38 class CmsSpreadCoupon;
39 class YieldTermStructure;
40
42
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
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