QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
catbond.hpp
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
24#ifndef quantlib_catbond_hpp
25#define quantlib_catbond_hpp
26
27#include <ql/experimental/catbonds/catrisk.hpp>
28#include <ql/experimental/catbonds/riskynotional.hpp>
29#include <ql/indexes/iborindex.hpp>
30#include <ql/instruments/bond.hpp>
31#include <ql/time/dategenerationrule.hpp>
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
75 public:
79 };
80
83 : public GenericEngine<CatBond::arguments,
84 CatBond::results> {};
85
86
88
93 class FloatingCatBond : public CatBond {
94 public:
96 Real faceAmount,
97 const 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
Base bond class.
Definition: bond.hpp:59
Natural settlementDays() const
Definition: bond.hpp:318
const Calendar & calendar() const
Definition: bond.hpp:322
Date startDate() const
Definition: bond.cpp:146
Date issueDate() const
Definition: bond.hpp:338
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
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
Definition: any.hpp:35
STL namespace.