Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedsurvivalprobabilitytermstructure.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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 spreadedsurvivalprobabilitytermstructure.hpp
20 \brief spreaded default term structure
21 \ingroup termstructures
22*/
23
24#pragma once
25
26#include <ql/math/interpolations/loginterpolation.hpp>
27#include <ql/patterns/lazyobject.hpp>
28#include <ql/quote.hpp>
29#include <ql/termstructures/credit/survivalprobabilitystructure.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34//! Spreaded Default Term Structure, the spread is given in terms of loglinearly interpolated survival probabilities.
36public:
38 //! times should be consistent with reference ts day counter
39 SpreadedSurvivalProbabilityTermStructure(const Handle<DefaultProbabilityTermStructure>& referenceCurve,
40 const std::vector<Time>& times, const std::vector<Handle<Quote>>& spreads,
41 const Extrapolation extrapolation = Extrapolation::flatFwd);
42 //@}
43 //! \name TermStructure interface
44 //@{
45 DayCounter dayCounter() const override;
46 Date maxDate() const override;
47 Time maxTime() const override;
48 const Date& referenceDate() const override;
49 Calendar calendar() const override;
50 Natural settlementDays() const override;
51 std::vector<Time> times();
52 Handle<DefaultProbabilityTermStructure> referenceCurve() const;
53 //@}
54private:
55 void performCalculations() const override;
56 Probability survivalProbabilityImpl(Time) const override;
57 void update() override;
58
59 Handle<DefaultProbabilityTermStructure> referenceCurve_;
60 std::vector<Time> times_;
61 std::vector<Handle<Quote>> spreads_;
62 mutable std::vector<Real> data_;
63 QuantLib::ext::shared_ptr<Interpolation> interpolation_;
65};
66
67} // namespace QuantExt
Spreaded Default Term Structure, the spread is given in terms of loglinearly interpolated survival pr...
Handle< DefaultProbabilityTermStructure > referenceCurve() const