QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
isdacdsengine.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2014 Jose Aparicio
5 Copyright (C) 2014 Peter Caspers
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file isdacdsengine.hpp
22 \brief ISDA engine for credit default swaps
23*/
24
25#ifndef quantlib_isda_cds_engine_hpp
26#define quantlib_isda_cds_engine_hpp
27
31#include <ql/optional.hpp>
32
33namespace QuantLib {
34
35 /*! References:
36
37 [1] The Pricing and Risk Management of Credit Default Swaps, with a
38 Focus on the ISDA Model,
39 OpenGamma Quantitative Research, Version as of 15-Oct-2013
40
41 [2] ISDA CDS Standard Model Proposed Numerical Fix \ Thursday,
42 November 15, 2012, Markit
43
44 [3] Markit Interest Rate Curve XML Specifications,
45 Version 1.16, Tuesday, 15 October 2013
46
47 */
48
50
51 public:
52 /*! According to [1] the settings for the flags
53 AccrualBias / ForwardsInCouponPeriod corresponding
54 to the standard model implementation C code are
55
56 prior 1.8.2 HalfDayBias / Flat
57 1.8.2 NoBias / Flat
58
59 The theoretical correct setting would be NoBias / Piecewise
60
61 Todo: Clarify in which version of the standard model
62 implementation C code the numerical problem of zero denominators
63 is solved and how exactly.
64 */
65
67 None, // as in [1] footnote 26 (i.e. 10^{-50} is added to
68 // denominators $f_i+h_i$$)
69 Taylor // as in [2] i.e. for $f_i+h_i < 10^{-4}$ a Taylor expansion
70 // is used to avoid zero denominators
71 };
72
74 HalfDayBias, // as in [1] formula (50), second (error) term is
75 // included
76 NoBias // as in [1], but second term in formula (50) is not included
77 };
78
80 Flat, // as in [1], formula (52), second (error) term is included
81 Piecewise // as in [1], but second term in formula (52) is not
82 // included
83 };
84
85 /*! Constructor where the client code is responsible for providing a
86 default curve and an interest rate curve compliant with the ISDA
87 specifications.
88
89 To be precisely consistent with the ISDA specification
90 bool IborCoupon::Settings::usingAtParCoupons();
91 must be true. This is not checked in order not to
92 kill the engine completely in this case.
93
94 Furthermore, the ibor index in the swap rate helpers should not
95 provide the evaluation date's fixing.
96 */
97
99 Real recoveryRate,
100 Handle<YieldTermStructure> discountCurve,
101 const ext::optional<bool>& includeSettlementDateFlows = ext::nullopt,
102 NumericalFix numericalFix = Taylor,
103 AccrualBias accrualBias = HalfDayBias,
104 ForwardsInCouponPeriod forwardsInCouponPeriod = Piecewise);
105
108
109 void calculate() const override;
110
111 private:
115 const ext::optional<bool> includeSettlementDateFlows_;
119 };
120}
121
122#endif
Shared handle to an observable.
Definition: handle.hpp:41
const ext::optional< bool > includeSettlementDateFlows_
Handle< YieldTermStructure > discountCurve_
Handle< YieldTermStructure > isdaRateCurve() const
Handle< DefaultProbabilityTermStructure > isdaCreditCurve() const
Handle< DefaultProbabilityTermStructure > probability_
void calculate() const override
const ForwardsInCouponPeriod forwardsInCouponPeriod_
const NumericalFix numericalFix_
const AccrualBias accrualBias_
Credit default swap.
default-probability term structure
QL_REAL Real
real number
Definition: types.hpp:50
const boost::none_t & nullopt
Definition: optional.cpp:27
Definition: any.hpp:35
Maps optional to either the boost or std implementation.
Interest-rate term structure.