QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
rebatedexercise.cpp
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) 2013 Peter Caspers
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
21#include <utility>
22
23namespace QuantLib {
24
26 const Real rebate,
27 const Natural rebateSettlementDays,
28 Calendar rebatePaymentCalendar,
29 const BusinessDayConvention rebatePaymentConvention)
30 : Exercise(exercise), rebates_(std::vector<Real>(dates().size(), rebate)),
31 rebateSettlementDays_(rebateSettlementDays),
32 rebatePaymentCalendar_(std::move(rebatePaymentCalendar)),
33 rebatePaymentConvention_(rebatePaymentConvention) {}
34
36 const std::vector<Real>& rebates,
37 const Natural rebateSettlementDays,
38 Calendar rebatePaymentCalendar,
39 const BusinessDayConvention rebatePaymentConvention)
40 : Exercise(exercise), rebates_(rebates), rebateSettlementDays_(rebateSettlementDays),
41 rebatePaymentCalendar_(std::move(rebatePaymentCalendar)),
42 rebatePaymentConvention_(rebatePaymentConvention) {
43
45 type_ == Bermudan,
46 "a rebate vector is allowed only for a bermudan style exercise");
47
48 QL_REQUIRE(rebates.size() == dates().size(),
49 "the number of rebates ("
50 << rebates.size()
51 << ") must be equal to the number of exercise dates ("
52 << dates().size());
53 }
54}
calendar class
Definition: calendar.hpp:61
Base exercise class.
Definition: exercise.hpp:35
const std::vector< Date > & dates() const
Returns all exercise dates.
Definition: exercise.hpp:48
const std::vector< Real > & rebates() const
RebatedExercise(const Exercise &exercise, Real rebate=0.0, Natural rebateSettlementDays=0, Calendar rebatePaymentCalendar=NullCalendar(), BusinessDayConvention rebatePaymentConvention=Following)
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
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.
Option exercise with rebate payments.