Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
bondoption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/instruments/bondoption.hpp
20\brief bond option class
21\ingroup instruments
22*/
23
24#pragma once
25
26#include <ql/instruments/bond.hpp>
27#include <ql/instruments/callabilityschedule.hpp>
28#include <ql/pricingengine.hpp>
29
30namespace QuantExt {
31using namespace QuantLib;
32
33//! Bond option class
34class BondOption : public QuantLib::Instrument {
35public:
36 BondOption(const QuantLib::ext::shared_ptr<QuantLib::Bond>& underlying, const CallabilitySchedule& putCallSchedule,
37 const bool knocksOutOnDefault = false)
38 : underlying_(underlying), putCallSchedule_(putCallSchedule), knocksOutOnDefault_(knocksOutOnDefault) {}
39
40 bool isExpired() const override;
41 void deepUpdate() override {
42 underlying_->update();
43 this->update();
44 }
45
46 const CallabilitySchedule& callability() const { return putCallSchedule_; }
47
48 class arguments;
49 class results;
50 class engine;
51
52private:
53 void setupArguments(PricingEngine::arguments*) const override;
54 const QuantLib::ext::shared_ptr<QuantLib::Bond> underlying_;
55 const CallabilitySchedule putCallSchedule_;
57};
58
60public:
61 QuantLib::ext::shared_ptr<QuantLib::Bond> underlying;
62 CallabilitySchedule putCallSchedule;
64 void validate() const override;
65};
66
68
69class BondOption::engine : public GenericEngine<BondOption::arguments, BondOption::results> {};
70
71} // namespace QuantExt
QuantLib::ext::shared_ptr< QuantLib::Bond > underlying
Definition: bondoption.hpp:61
void validate() const override
Definition: bondoption.cpp:33
CallabilitySchedule putCallSchedule
Definition: bondoption.hpp:62
Bond option class.
Definition: bondoption.hpp:34
const CallabilitySchedule putCallSchedule_
Definition: bondoption.hpp:55
void setupArguments(PricingEngine::arguments *) const override
Definition: bondoption.cpp:25
bool isExpired() const override
Definition: bondoption.cpp:23
void deepUpdate() override
Definition: bondoption.hpp:41
const CallabilitySchedule & callability() const
Definition: bondoption.hpp:46
const bool knocksOutOnDefault_
Definition: bondoption.hpp:56
BondOption(const QuantLib::ext::shared_ptr< QuantLib::Bond > &underlying, const CallabilitySchedule &putCallSchedule, const bool knocksOutOnDefault=false)
Definition: bondoption.hpp:36
const QuantLib::ext::shared_ptr< QuantLib::Bond > underlying_
Definition: bondoption.hpp:54