Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
convertiblebond.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2005, 2006 Theo Boafo
3 Copyright (C) 2006, 2007 StatPro Italia srl
4
5 Copyright (C) 2020 Quaternion Risk Managment Ltd
6
7 This file is part of ORE, a free-software/open-source library
8 for transparent pricing and risk analysis - http://opensourcerisk.org
9
10 ORE is free software: you can redistribute it and/or modify it
11 under the terms of the Modified BSD License. You should have received a
12 copy of the license along with this program.
13 The license is also available online at <http://opensourcerisk.org>
14
15 This program is distributed on the basis that it will form a useful
16 contribution to risk analytics and model standardisation, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file qle/instruments/convertiblebond.hpp
22 \brief convertible bond class
23*/
24
25#pragma once
26
27#include <ql/instruments/bond.hpp>
28#include <ql/instruments/callabilityschedule.hpp>
29#include <ql/instruments/dividendschedule.hpp>
30#include <ql/instruments/oneassetoption.hpp>
31#include <ql/quote.hpp>
32#include <ql/time/daycounter.hpp>
33#include <ql/time/schedule.hpp>
34
35namespace QuantLib {
36class IborIndex;
37class PricingEngine;
38} // namespace QuantLib
39
40namespace QuantExt {
41
42using namespace QuantLib;
43
44//! %callability leaving to the holder the possibility to convert
46public:
47 SoftCallability(const Bond::Price& price, const Date& date, Real trigger)
48 : Callability(price, Callability::Call, date), trigger_(trigger) {}
49 Real trigger() const { return trigger_; }
50
51private:
53};
54
55//! convertible bond
56class ConvertibleBond : public Bond {
57public:
58 class option;
59 //! similar to bond ctor, coupons should not contain redemption flows
60 ConvertibleBond(Natural settlementDays, const Calendar& calendar, const Date& issueDate, const Leg& coupons,
61 const QuantLib::ext::shared_ptr<Exercise>& exercise, const Real conversionRatio,
62 const DividendSchedule& dividends, const CallabilitySchedule& callability);
63 QuantLib::ext::shared_ptr<Exercise> exercise() const { return exercise_; }
64 Real conversionRatio() const { return conversionRatio_; }
65 const DividendSchedule& dividends() const { return dividends_; }
66 const CallabilitySchedule& callability() const { return callability_; }
67
68protected:
69 void performCalculations() const override;
70
71 QuantLib::ext::shared_ptr<Exercise> exercise_;
73 DividendSchedule dividends_;
74 CallabilitySchedule callability_;
75
76 QuantLib::ext::shared_ptr<option> option_;
77};
78
80public:
81 class arguments;
82 class engine;
83 option(const ConvertibleBond* bond);
84
85 void setupArguments(PricingEngine::arguments*) const override;
86
87 bool isExpired() const override;
88
89private:
91};
92
93class ConvertibleBond::option::arguments : public OneAssetOption::arguments {
94public:
95 arguments() : conversionRatio(Null<Real>()), settlementDays(Null<Natural>()) {}
96
98 DividendSchedule dividends;
99 std::vector<Date> dividendDates;
100 std::vector<Date> callabilityDates;
101 std::vector<Callability::Type> callabilityTypes;
102 std::vector<Real> callabilityPrices;
103 std::vector<Real> callabilityTriggers;
104 std::vector<Date> cashflowDates;
105 std::vector<Real> cashflowAmounts;
106 std::vector<Date> notionalDates;
107 std::vector<Real> notionals;
112
113 void validate() const override;
114};
115
117 : public GenericEngine<ConvertibleBond::option::arguments, ConvertibleBond::option::results> {};
118
119} // namespace QuantExt
std::vector< Callability::Type > callabilityTypes
void setupArguments(PricingEngine::arguments *) const override
void performCalculations() const override
QuantLib::ext::shared_ptr< Exercise > exercise_
const CallabilitySchedule & callability() const
QuantLib::ext::shared_ptr< option > option_
const DividendSchedule & dividends() const
QuantLib::ext::shared_ptr< Exercise > exercise() const
CallabilitySchedule callability_
callability leaving to the holder the possibility to convert
SoftCallability(const Bond::Price &price, const Date &date, Real trigger)