QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
catbond.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) 2012, 2013 Grzegorz Andruszkiewicz
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file catbond.hpp
21 \brief cat bond class
22*/
23
24#ifndef quantlib_catbond_hpp
25#define quantlib_catbond_hpp
26
32#include <ql/time/schedule.hpp>
33#include <utility>
34
35namespace QuantLib {
36
37 class CatBond : public Bond
38 {
39 public:
40 class arguments;
41 class results;
42 class engine;
43
45 const Calendar& calendar,
46 const Date& issueDate,
47 ext::shared_ptr<NotionalRisk> notionalRisk)
48 : Bond(settlementDays, calendar, issueDate), notionalRisk_(std::move(notionalRisk)) {}
49 ~CatBond() override = default;
50
51 void setupArguments(PricingEngine::arguments*) const override;
52 void fetchResults(const PricingEngine::results*) const override;
53
55 Real expectedLoss() const { return expectedLoss_; }
57
58 protected:
59 ext::shared_ptr<NotionalRisk> notionalRisk_;
60
64 };
65
67 public:
69 ext::shared_ptr<NotionalRisk> notionalRisk;
70 void validate() const override;
71 };
72
73 //! results for a cat bond calculation
75 public:
79 };
80
81 //! base class for cat bond engine
83 : public GenericEngine<CatBond::arguments,
84 CatBond::results> {};
85
86
87 //! floating-rate cat bond (possibly capped and/or floored)
88 /*! \ingroup instruments
89
90 \test calculations are tested by checking results against
91 cached values.
92 */
93 class FloatingCatBond : public CatBond {
94 public:
96 Real faceAmount,
97 Schedule schedule,
98 const ext::shared_ptr<IborIndex>& iborIndex,
99 const DayCounter& accrualDayCounter,
100 const ext::shared_ptr<NotionalRisk>& notionalRisk,
101 BusinessDayConvention paymentConvention = Following,
102 Natural fixingDays = Null<Natural>(),
103 const std::vector<Real>& gearings = std::vector<Real>(1, 1.0),
104 const std::vector<Spread>& spreads = std::vector<Spread>(1, 0.0),
105 const std::vector<Rate>& caps = std::vector<Rate>(),
106 const std::vector<Rate>& floors = std::vector<Rate>(),
107 bool inArrears = false,
108 Real redemption = 100.0,
109 const Date& issueDate = Date());
110
112 Real faceAmount,
113 const Date& startDate,
114 const Date& maturityDate,
115 Frequency couponFrequency,
116 const Calendar& calendar,
117 const ext::shared_ptr<IborIndex>& iborIndex,
118 const DayCounter& accrualDayCounter,
119 const ext::shared_ptr<NotionalRisk>& notionalRisk,
120 BusinessDayConvention accrualConvention = Following,
121 BusinessDayConvention paymentConvention = Following,
122 Natural fixingDays = Null<Natural>(),
123 const std::vector<Real>& gearings = std::vector<Real>(1, 1.0),
124 const std::vector<Spread>& spreads = std::vector<Spread>(1, 0.0),
125 const std::vector<Rate>& caps = std::vector<Rate>(),
126 const std::vector<Rate>& floors = std::vector<Rate>(),
127 bool inArrears = false,
128 Real redemption = 100.0,
129 const Date& issueDate = Date(),
130 const Date& stubDate = Date(),
132 bool endOfMonth = false);
133 };
134
135}
136
137#endif
concrete bond class
classes that encapsulate catastrophe risk
Base bond class.
Definition: bond.hpp:59
Natural settlementDays() const
Definition: bond.hpp:332
const Calendar & calendar() const
Definition: bond.hpp:336
Date startDate() const
Definition: bond.cpp:146
Date issueDate() const
Definition: bond.hpp:352
const ext::shared_ptr< CashFlow > & redemption() const
Definition: bond.cpp:140
Date maturityDate() const
Definition: bond.cpp:150
calendar class
Definition: calendar.hpp:61
ext::shared_ptr< NotionalRisk > notionalRisk
Definition: catbond.hpp:69
void validate() const override
Definition: catbond.cpp:33
base class for cat bond engine
Definition: catbond.hpp:84
results for a cat bond calculation
Definition: catbond.hpp:74
~CatBond() override=default
Real lossProbability() const
Definition: catbond.hpp:54
void setupArguments(PricingEngine::arguments *) const override
Definition: catbond.cpp:38
CatBond(Natural settlementDays, const Calendar &calendar, const Date &issueDate, ext::shared_ptr< NotionalRisk > notionalRisk)
Definition: catbond.hpp:44
Real exhaustionProbability() const
Definition: catbond.hpp:56
ext::shared_ptr< NotionalRisk > notionalRisk_
Definition: catbond.hpp:59
Real exhaustionProbability_
Definition: catbond.hpp:62
Real lossProbability_
Definition: catbond.hpp:61
void fetchResults(const PricingEngine::results *) const override
Definition: catbond.cpp:49
Real expectedLoss() const
Definition: catbond.hpp:55
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
floating-rate cat bond (possibly capped and/or floored)
Definition: catbond.hpp:93
template base class for option pricing engines
template class providing a null value for a given type.
Definition: null.hpp:76
Payment schedule.
Definition: schedule.hpp:40
date generation rule
Frequency
Frequency of events.
Definition: frequency.hpp:37
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
base class for Inter-Bank-Offered-Rate indexes
Definition: any.hpp:35
STL namespace.
classes to track the notional of a cat bond
date schedule