Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
creditcurve.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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/termstructures/creditcurve.hpp
20 \brief wrapper for default curves, adding (index) reference data
21*/
22
23#pragma once
24
25#include <ql/termstructures/defaulttermstructure.hpp>
26#include <ql/termstructures/yieldtermstructure.hpp>
27#include <ql/time/calendars/weekendsonly.hpp>
28#include <ql/time/dategenerationrule.hpp>
29#include <ql/time/daycounters/actual360.hpp>
30
31namespace QuantExt {
32
33class CreditCurve : public QuantLib::Observer, public QuantLib::Observable {
34public:
35 struct RefData {
37 QuantLib::Date startDate = QuantLib::Null<QuantLib::Date>();
38 QuantLib::Period indexTerm = 0 * QuantLib::Days;
39 QuantLib::Period tenor = 3 * QuantLib::Months;
40 QuantLib::Calendar calendar = QuantLib::WeekendsOnly();
41 QuantLib::BusinessDayConvention convention = QuantLib::Following;
42 QuantLib::BusinessDayConvention termConvention = QuantLib::Following;
43 QuantLib::DateGeneration::Rule rule = QuantLib::DateGeneration::CDS2015;
44 bool endOfMonth = false;
45 QuantLib::Real runningSpread = QuantLib::Null<QuantLib::Real>();
46 QuantLib::BusinessDayConvention payConvention = QuantLib::Following;
47 QuantLib::DayCounter dayCounter = QuantLib::Actual360(false);
48 QuantLib::DayCounter lastPeriodDayCounter = QuantLib::Actual360(true);
49 QuantLib::Natural cashSettlementDays = 3;
50 };
51
52 explicit CreditCurve(const QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>& curve,
53 const QuantLib::Handle<QuantLib::YieldTermStructure>& rateCurve =
54 QuantLib::Handle<QuantLib::YieldTermStructure>(),
55 const QuantLib::Handle<QuantLib::Quote>& recovery = QuantLib::Handle<QuantLib::Quote>(),
56 const RefData& refData = RefData());
57
58 const RefData& refData() const;
59 const QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure>& curve() const;
60 const QuantLib::Handle<QuantLib::YieldTermStructure>& rateCurve() const;
61 const QuantLib::Handle<QuantLib::Quote>& recovery() const;
62
63protected:
64 QuantLib::Handle<QuantLib::DefaultProbabilityTermStructure> curve_;
65 QuantLib::Handle<QuantLib::YieldTermStructure> rateCurve_;
66 QuantLib::Handle<QuantLib::Quote> recovery_;
68 void update() override;
69};
70
71} // namespace QuantExt
QuantLib::Handle< QuantLib::Quote > recovery_
Definition: creditcurve.hpp:66
QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > curve_
Definition: creditcurve.hpp:64
void update() override
Definition: creditcurve.cpp:33
const QuantLib::Handle< QuantLib::YieldTermStructure > & rateCurve() const
Definition: creditcurve.cpp:35
const QuantLib::Handle< QuantLib::Quote > & recovery() const
Definition: creditcurve.cpp:36
QuantLib::Handle< QuantLib::YieldTermStructure > rateCurve_
Definition: creditcurve.hpp:65
const RefData & refData() const
Definition: creditcurve.cpp:37
const QuantLib::Handle< QuantLib::DefaultProbabilityTermStructure > & curve() const
Definition: creditcurve.cpp:34
QuantLib::DayCounter lastPeriodDayCounter
Definition: creditcurve.hpp:48
QuantLib::DateGeneration::Rule rule
Definition: creditcurve.hpp:43
QuantLib::DayCounter dayCounter
Definition: creditcurve.hpp:47
QuantLib::Natural cashSettlementDays
Definition: creditcurve.hpp:49
QuantLib::BusinessDayConvention termConvention
Definition: creditcurve.hpp:42
QuantLib::Calendar calendar
Definition: creditcurve.hpp:40
QuantLib::BusinessDayConvention payConvention
Definition: creditcurve.hpp:46
QuantLib::BusinessDayConvention convention
Definition: creditcurve.hpp:41