QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
issuer.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) 2008, 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 issuer.hpp
22 \brief Classes for credit-name handling.
23*/
24
25#ifndef quantlib_issuer_hpp
26#define quantlib_issuer_hpp
27
31#include <set>
32#include <vector>
33
34namespace QuantLib {
35
36 typedef std::set<ext::shared_ptr<DefaultEvent>,
37 earlier_than<ext::shared_ptr<DefaultEvent> > >
39
40 class Issuer {
41 public:
42 typedef std::pair<DefaultProbKey,
45 /*! The first argument represents the probability of an issuer
46 of having any of its bonds with the given seniority,
47 currency incurring in that particular event. The second
48 argument represents the history of past events. Theres no
49 check on whether the event list makes sense, events can
50 occur several times and several of them can take place on
51 the same date.
52
53 To do: add settlement event access
54 */
55 Issuer(std::vector<key_curve_pair> probabilities = std::vector<key_curve_pair>(),
57
58 Issuer(const std::vector<std::vector<ext::shared_ptr<DefaultType> > >& eventTypes,
59 const std::vector<Currency>& currencies,
60 const std::vector<Seniority>& seniorities,
61 const std::vector<Handle<DefaultProbabilityTermStructure> >& curves,
63
64 //! \name Inspectors
65 //@{
67 defaultProbability(const DefaultProbKey& key) const;
68
69 //@}
70
71 //! \name Utilities
72 //@{
73 //! If a default event with the required seniority and
74 // restructuring type is found, it is returned for
75 // inspection; otherwise, the method returns an empty pointer.
76 ext::shared_ptr<DefaultEvent>
77 defaultedBetween(const Date& start,
78 const Date& end,
79 const DefaultProbKey& key,
80 bool includeRefDate = false
81 ) const;
82
83 //@}
84 std::vector<ext::shared_ptr<DefaultEvent> >
85 defaultsBetween(const Date& start,
86 const Date& end,
87 const DefaultProbKey& contractKey,
88 bool includeRefDate
89 ) const ;
90 private:
91 //! probabilities of events for each bond collection
92 // vector of pairs preferred over maps for performance
93 std::vector<std::pair<DefaultProbKey,
95 //! History of past events affecting this issuer. Notice it is possible
96 // for the same event to occur on the same bond several times along
97 // time.
99 };
100
101}
102
103#endif
Concrete date class.
Definition: date.hpp:125
Shared handle to an observable.
Definition: handle.hpp:41
ext::shared_ptr< DefaultEvent > defaultedBetween(const Date &start, const Date &end, const DefaultProbKey &key, bool includeRefDate=false) const
If a default event with the required seniority and.
Definition: issuer.cpp:68
std::pair< DefaultProbKey, Handle< DefaultProbabilityTermStructure > > key_curve_pair
Definition: issuer.hpp:44
DefaultEventSet events_
History of past events affecting this issuer. Notice it is possible.
Definition: issuer.hpp:98
const Handle< DefaultProbabilityTermStructure > & defaultProbability(const DefaultProbKey &key) const
Definition: issuer.cpp:60
std::vector< std::pair< DefaultProbKey, Handle< DefaultProbabilityTermStructure > > > probabilities_
probabilities of events for each bond collection
Definition: issuer.hpp:94
std::vector< ext::shared_ptr< DefaultEvent > > defaultsBetween(const Date &start, const Date &end, const DefaultProbKey &contractKey, bool includeRefDate) const
Definition: issuer.cpp:84
Issuer(std::vector< key_curve_pair > probabilities=std::vector< key_curve_pair >(), DefaultEventSet events=DefaultEventSet())
Classes for default-event description.
Classes for default-event description.
default-probability term structure
Definition: any.hpp:35
std::set< ext::shared_ptr< DefaultEvent >, earlier_than< ext::shared_ptr< DefaultEvent > > > DefaultEventSet
Definition: issuer.hpp:38