/src/quantlib/ql/experimental/credit/defaultprobabilitykey.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2009 StatPro Italia srl |
5 | | Copyright (C) 2009 Jose Aparicio |
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 defaultprobabilitykey.hpp |
22 | | \brief Classes for default-event description. |
23 | | */ |
24 | | |
25 | | #ifndef quantlib_default_probability_key_hpp |
26 | | #define quantlib_default_probability_key_hpp |
27 | | |
28 | | #include <ql/experimental/credit/defaulttype.hpp> |
29 | | #include <ql/currency.hpp> |
30 | | #include <vector> |
31 | | |
32 | | namespace QuantLib { |
33 | | |
34 | | /*! Used to index market implied credit curve probabilities. It is |
35 | | a proxy to the defaultable bond or class of bonds which |
36 | | determines the credit contract conditions. It aggregates the |
37 | | atomic default types in a group defining the contract |
38 | | conditions and which serves to index the probability curves |
39 | | calibrated to the market. |
40 | | */ |
41 | | class DefaultProbKey { |
42 | | protected: |
43 | | //! aggregation of event types for which the contract is sensitive. |
44 | | std::vector<ext::shared_ptr<DefaultType> > eventTypes_; |
45 | | //! Currency of the bond and protection leg payment. |
46 | | Currency obligationCurrency_; |
47 | | //! Reference bonds seniority. |
48 | | Seniority seniority_ = NoSeniority; |
49 | | |
50 | | public: |
51 | | DefaultProbKey(); |
52 | | |
53 | | DefaultProbKey(std::vector<ext::shared_ptr<DefaultType> > eventTypes, |
54 | | Currency cur, |
55 | | Seniority sen); |
56 | | |
57 | 0 | const Currency& currency() const {return obligationCurrency_;} |
58 | 0 | Seniority seniority() const {return seniority_;} |
59 | | const std::vector<ext::shared_ptr<DefaultType> >& |
60 | 0 | eventTypes() const { |
61 | 0 | return eventTypes_; |
62 | 0 | } |
63 | 0 | Size size() const {return eventTypes_.size();} |
64 | | }; |
65 | | |
66 | | bool operator==(const DefaultProbKey& lhs, const DefaultProbKey& rhs); |
67 | | |
68 | | |
69 | | //! ISDA standard default contractual key for corporate US debt. |
70 | | // Restructuring here can be set to NoRestructuring. |
71 | | class NorthAmericaCorpDefaultKey : public DefaultProbKey { |
72 | | public: |
73 | | // with only one restructuring type |
74 | | NorthAmericaCorpDefaultKey(const Currency& currency, |
75 | | Seniority sen, |
76 | | Period graceFailureToPay = |
77 | | Period(30, Days), |
78 | | Real amountFailure = 1.e6, |
79 | | Restructuring::Type resType = |
80 | | Restructuring::CR); |
81 | | }; |
82 | | |
83 | | } |
84 | | |
85 | | #endif |