QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
exercise.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2001, 2002, 2003 Sadruddin Rejeb
5 Copyright (C) 2003 Ferdinando Ametrano
6 Copyright (C) 2006 StatPro Italia srl
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
26#ifndef quantlib_exercise_type_h
27#define quantlib_exercise_type_h
28
29#include <ql/time/date.hpp>
30#include <vector>
31
32namespace QuantLib {
33
35 class Exercise {
36 public:
37 enum Type {
39 };
40 // constructor
41 explicit Exercise(Type type) : type_(type) {}
42 virtual ~Exercise() = default;
43 // inspectors
44 Type type() const { return type_; }
45 Date date(Size index) const { return dates_[index]; }
46 Date dateAt(Size index) const { return dates_.at(index); }
48 const std::vector<Date>& dates() const { return dates_; }
49 Date lastDate() const;
50 protected:
51 std::vector<Date> dates_;
53 };
54
56
57 class EarlyExercise : public Exercise {
58 public:
60 bool payoffAtExpiry = false)
62 bool payoffAtExpiry() const { return payoffAtExpiry_; }
63 private:
65 };
66
68
76 public:
77 AmericanExercise(const Date& earliestDate,
78 const Date& latestDate,
79 bool payoffAtExpiry = false);
80 AmericanExercise(const Date& latestDate,
81 bool payoffAtExpiry = false);
82 };
83
85
88 public:
89 BermudanExercise(const std::vector<Date>& dates,
90 bool payoffAtExpiry = false);
91 };
92
94
96 class EuropeanExercise : public Exercise {
97 public:
99 };
100
101}
102
103
104#endif
American exercise.
Definition: exercise.hpp:75
Bermudan exercise.
Definition: exercise.hpp:87
Concrete date class.
Definition: date.hpp:125
Early-exercise base class.
Definition: exercise.hpp:57
bool payoffAtExpiry() const
Definition: exercise.hpp:62
EarlyExercise(Type type, bool payoffAtExpiry=false)
Definition: exercise.hpp:59
European exercise.
Definition: exercise.hpp:96
Base exercise class.
Definition: exercise.hpp:35
std::vector< Date > dates_
Definition: exercise.hpp:51
Date date(Size index) const
Definition: exercise.hpp:45
const std::vector< Date > & dates() const
Returns all exercise dates.
Definition: exercise.hpp:48
Date dateAt(Size index) const
Definition: exercise.hpp:46
virtual ~Exercise()=default
Date lastDate() const
Definition: exercise.cpp:28
Type type() const
Definition: exercise.hpp:44
Exercise(Type type)
Definition: exercise.hpp:41
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35