Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
rebatedexercise.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 rebatedexercise.hpp
20 \brief more flexible version of ql class
21*/
22
23#pragma once
24
25#include <ql/errors.hpp>
26#include <ql/exercise.hpp>
27#include <ql/time/calendars/nullcalendar.hpp>
28
29#include <boost/optional.hpp>
30
31namespace QuantExt {
32
33using namespace QuantLib;
34
35//! Rebated exercise with exercise dates != notification dates and arbitrary period
36class RebatedExercise : public QuantLib::Exercise {
37public:
38 //! as ql ctor
39 RebatedExercise(const Exercise& exercise, const Real rebate = 0.0, const Natural rebateSettlementDays = 0,
40 const Calendar& rebatePaymentCalendar = NullCalendar(),
41 const BusinessDayConvention rebatePaymentConvention = Following);
42 //! same, but takes settl period instead of days
43 RebatedExercise(const Exercise& exercise, const Real rebate, const Period& rebateSettlementPeriod,
44 const Calendar& rebatePaymentCalendar, const BusinessDayConvention rebatePaymentConvention);
45 //! as ql ctor
46 RebatedExercise(const Exercise& exercise, const std::vector<Real>& rebates, const Natural rebateSettlementDays = 0,
47 const Calendar& rebatePaymentCalendar = NullCalendar(),
48 const BusinessDayConvention rebatePaymentConvention = Following);
49 //! same, but takes settl period instead of days
50 RebatedExercise(const Exercise& exercise, const std::vector<Real>& rebates, const Period& rebateSettlementPeriod,
51 const Calendar& rebatePaymentCalendar, const BusinessDayConvention rebatePaymentConvention);
52 //! ctor that takes exercise dates != notification dates and a rebate settlement period
53 RebatedExercise(const Exercise& exercise, const std::vector<Date>& exerciseDates, const std::vector<Real>& rebates,
54 const Period& rebateSettlementPeriod, const Calendar& rebatePaymentCalendar = NullCalendar(),
55 const BusinessDayConvention rebatePaymentConvention = Following);
56 Real rebate(Size index) const;
57 Date rebatePaymentDate(Size index) const;
58 Date rebatePaymentDate(const Date& exerciseDate) const;
59 const std::vector<Real>& rebates() const { return rebates_; }
60
61private:
62 std::vector<Date> exerciseDates_;
63 std::vector<Real> rebates_;
66 BusinessDayConvention rebatePaymentConvention_;
67};
68
69inline Real RebatedExercise::rebate(Size index) const {
70 QL_REQUIRE(index < rebates_.size(),
71 "rebate with index " << index << " does not exist (0..." << (rebates_.size() - 1) << ")");
72 return rebates_[index];
73}
74
75inline Date RebatedExercise::rebatePaymentDate(Size index) const {
76 QL_REQUIRE(type_ == European || type_ == Bermudan, "for american style exercises the rebate payment date "
77 << "has to be calculted in the client code");
79}
80
81inline Date RebatedExercise::rebatePaymentDate(const Date& exerciseDate) const {
83}
84
85} // namespace QuantExt
Rebated exercise with exercise dates != notification dates and arbitrary period.
const std::vector< Real > & rebates() const
Real rebate(Size index) const
std::vector< Date > exerciseDates_
BusinessDayConvention rebatePaymentConvention_
Date rebatePaymentDate(Size index) const
std::vector< Real > rebates_