Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
representativeswaption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/models/representativeswaption.hpp
20 \brief representative swaption matcher
21 \ingroup models
22*/
23
24#pragma once
25
26#include <qle/models/lgm.hpp>
28
29#include <ql/cashflows/floatingratecoupon.hpp>
30#include <ql/indexes/swapindex.hpp>
31#include <ql/instruments/swaption.hpp>
32
33namespace QuantExt {
34
35using namespace QuantLib;
36
37/*! Given an exotic underlying find a standard swap matching the underlying using the representative swaption method in
38 a LGM model.
39
40 The swaption that is returned does not have a pricing engine attached, the underlying swap has a
41 discounting swap engine attached (using the given discount curve) though and the ibor index of the underlying swap is
42 using the forwarding curve from the given swap index.
43
44 The LGM model uses to find the representative swaption
45 - uses a constant volatility and reversion as specified in the ctor
46 - if flatRate is null, uses the given dicount curve and forwarding curves from the underlying's ibor indices
47 - if flatRate is not null, uses flat discount and forwarding curves using the rate level given by flatRate
48
49 For the methodology, see Andersen, Piterbarg, Interest Rate Modelling, ch. 19.4.
50
51 The underlying may only contain simple cahsflows, fixed coupons and standard ibor coupons (i.e. without cap/floor or
52 in arrears fixings). */
53
55public:
57 RepresentativeSwaptionMatcher(const std::vector<Leg>& underlying, const std::vector<bool>& isPayer,
58 const QuantLib::ext::shared_ptr<SwapIndex>& standardSwapIndexBase,
59 const bool useUnderlyingIborIndex, const Handle<YieldTermStructure>& discountCurve,
60 const Real reversion, const Real volatility = 0.0050,
61 const Real flatRate = Null<Real>());
62
63 /*! find representative swaption for all specified underlying cashflows
64 a null pointer is returned if there are no live cashflows found */
65 QuantLib::ext::shared_ptr<Swaption>
66 representativeSwaption(Date exerciseDate,
68
69private:
70 QuantLib::Date valueDate(const QuantLib::Date& fixingDate, const QuantLib::ext::shared_ptr<QuantLib::FloatingRateCoupon>& cpn) const;
71
72 const std::vector<Leg> underlying_;
73 const std::vector<bool> isPayer_;
74 const QuantLib::ext::shared_ptr<SwapIndex> swapIndexBase_;
76 const Handle<YieldTermStructure> discountCurve_;
78 //
79 QuantLib::ext::shared_ptr<LGM> model_;
82
83 std::map<std::string, QuantLib::ext::shared_ptr<LgmImpliedYtsFwdFwdCorrected>> modelForwardCurves_;
84 QuantLib::ext::shared_ptr<LgmImpliedYtsFwdFwdCorrected> modelDiscountCurve_, modelSwapIndexForwardCurve_,
86 QuantLib::ext::shared_ptr<SwapIndex> swapIndexBaseFinal_, modelSwapIndexBase_;
87};
88
89} // namespace QuantExt
QuantLib::ext::shared_ptr< SwapIndex > modelSwapIndexBase_
const Handle< YieldTermStructure > discountCurve_
QuantLib::ext::shared_ptr< Swaption > representativeSwaption(Date exerciseDate, const InclusionCriterion criterion=InclusionCriterion::AccrualStartGeqExercise)
QuantLib::ext::shared_ptr< SwapIndex > swapIndexBaseFinal_
QuantLib::ext::shared_ptr< LgmImpliedYtsFwdFwdCorrected > modelSwapIndexDiscountCurve_
QuantLib::ext::shared_ptr< LgmImpliedYtsFwdFwdCorrected > modelDiscountCurve_
QuantLib::ext::shared_ptr< LGM > model_
std::map< std::string, QuantLib::ext::shared_ptr< LgmImpliedYtsFwdFwdCorrected > > modelForwardCurves_
const QuantLib::ext::shared_ptr< SwapIndex > swapIndexBase_
QuantLib::ext::shared_ptr< LgmImpliedYtsFwdFwdCorrected > modelSwapIndexForwardCurve_
QuantLib::Date valueDate(const QuantLib::Date &fixingDate, const QuantLib::ext::shared_ptr< QuantLib::FloatingRateCoupon > &cpn) const
lgm model class
yield term structure implied by a LGM model