Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
indexcdsoptionbaseengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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/pricingengines/indexcdsoptionbaseengine.hpp
20 \brief Base class for index cds option pricing engines.
21*/
22
23#pragma once
24
25#include <ql/termstructures/yieldtermstructure.hpp>
28
29namespace QuantExt {
30
32public:
33 //! Constructor taking a default probability term structure bootstrapped from the index spreads.
34 IndexCdsOptionBaseEngine(const QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>& probability,
35 QuantLib::Real recovery, const Handle<YieldTermStructure>& discountSwapCurrency,
36 const Handle<YieldTermStructure>& discountTradeCollateral,
37 const QuantLib::Handle<QuantExt::CreditVolCurve>& volatility);
38
39 /*! Constructor taking a vector of default probability term structures bootstrapped from the index constituent
40 spread curves and a vector of associated recovery rates.
41 */
43 const std::vector<QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>>& probabilities,
44 const std::vector<QuantLib::Real>& recoveries, const Handle<YieldTermStructure>& discountSwapCurrency,
45 const Handle<YieldTermStructure>& discountTradeCollateral,
46 const QuantLib::Handle<QuantExt::CreditVolCurve>& volatility,
47 QuantLib::Real indexRecovery = QuantLib::Null<QuantLib::Real>());
48
49 //! \name Inspectors
50 //@{
51 const std::vector<QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>>& probabilities() const;
52 const std::vector<QuantLib::Real>& recoveries() const;
53 const QuantLib::Handle<QuantLib::YieldTermStructure> discountSwapCurrency() const;
54 const QuantLib::Handle<QuantLib::YieldTermStructure> discountTradeCollateral() const;
55 const QuantLib::Handle<QuantExt::CreditVolCurve> volatility() const;
56 //@}
57
58 //! \name Instrument interface
59 //@{
60 void calculate() const override;
61 //@}
62
63protected:
64 //! Engine specific calculation
65 virtual void doCalc() const = 0;
66
67 //! Register with market data
68 void registerWithMarket();
69
70 //! Calculate the discounted value of the front end protection.
71 QuantLib::Real fep() const;
72
73 //! Store inputs
74 std::vector<QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>> probabilities_;
75 std::vector<QuantLib::Real> recoveries_;
76 QuantLib::Handle<QuantLib::YieldTermStructure> discountSwapCurrency_;
77 QuantLib::Handle<QuantLib::YieldTermStructure> discountTradeCollateral_;
78 QuantLib::Handle<QuantExt::CreditVolCurve> volatility_;
79
80 //! Assumed index recovery used in the flat strike spread curve calculation if provided.
81 QuantLib::Real indexRecovery_;
82
83 //! Store the underlying index CDS notional(s) during calculation.
84 mutable std::vector<QuantLib::Real> notionals_;
85};
86
87} // namespace QuantExt
Base class for index CDS option engines.
std::vector< QuantLib::Real > recoveries_
virtual void doCalc() const =0
Engine specific calculation.
IndexCdsOptionBaseEngine(const std::vector< QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > > &probabilities, const std::vector< QuantLib::Real > &recoveries, const Handle< YieldTermStructure > &discountSwapCurrency, const Handle< YieldTermStructure > &discountTradeCollateral, const QuantLib::Handle< QuantExt::CreditVolCurve > &volatility, QuantLib::Real indexRecovery=QuantLib::Null< QuantLib::Real >())
const std::vector< QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > > & probabilities() const
std::vector< QuantLib::Real > notionals_
Store the underlying index CDS notional(s) during calculation.
QuantLib::Handle< QuantLib::YieldTermStructure > discountTradeCollateral_
QuantLib::Real fep() const
Calculate the discounted value of the front end protection.
const std::vector< QuantLib::Real > & recoveries() const
const QuantLib::Handle< QuantLib::YieldTermStructure > discountTradeCollateral() const
const QuantLib::Handle< QuantExt::CreditVolCurve > volatility() const
QuantLib::Real indexRecovery_
Assumed index recovery used in the flat strike spread curve calculation if provided.
QuantLib::Handle< QuantLib::YieldTermStructure > discountSwapCurrency_
QuantLib::Handle< QuantExt::CreditVolCurve > volatility_
IndexCdsOptionBaseEngine(const QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > &probability, QuantLib::Real recovery, const Handle< YieldTermStructure > &discountSwapCurrency, const Handle< YieldTermStructure > &discountTradeCollateral, const QuantLib::Handle< QuantExt::CreditVolCurve > &volatility)
Constructor taking a default probability term structure bootstrapped from the index spreads.
const QuantLib::Handle< QuantLib::YieldTermStructure > discountSwapCurrency() const
void registerWithMarket()
Register with market data.
std::vector< QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > > probabilities_
Store inputs.
credit vol curve
Index CDS option instrument.