QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
asianoption.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2003, 2004 Ferdinando Ametrano
5 Copyright (C) 2004, 2007 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_asian_option_hpp
26#define quantlib_asian_option_hpp
27
28#include <ql/instruments/oneassetoption.hpp>
29#include <ql/instruments/payoffs.hpp>
30#include <ql/instruments/averagetype.hpp>
31#include <ql/time/date.hpp>
32#include <vector>
33
34namespace QuantLib {
35
37
42 public:
43 class arguments;
44 class engine;
46 Average::Type averageType,
47 const ext::shared_ptr<StrikedTypePayoff>& payoff,
48 const ext::shared_ptr<Exercise>& exercise);
49 void setupArguments(PricingEngine::arguments*) const override;
50
51 protected:
53 };
54
56
58 public:
59 class arguments;
60 class engine;
66 Real runningAccumulator,
67 Size pastFixings,
68 std::vector<Date> fixingDates,
69 const ext::shared_ptr<StrikedTypePayoff>& payoff,
70 const ext::shared_ptr<Exercise>& exercise);
71
80 std::vector<Date> fixingDates,
81 const ext::shared_ptr<StrikedTypePayoff>& payoff,
82 const ext::shared_ptr<Exercise>& exercise,
83 std::vector<Real> allPastFixings = std::vector<Real>());
84
85 void setupArguments(PricingEngine::arguments*) const override;
86
87 protected:
91 std::vector<Date> fixingDates_;
92
93 // For backwards compatibility with the traditional interface, we keep track of
94 // whether this option was initialised using the full array of seasoned fixings
95 // (even if empty) or if a pastFixings and a runningAccumulator was provided
97 std::vector<Real> allPastFixings_;
98 };
99
102 : public OneAssetOption::arguments {
103 public:
106 pastFixings(Null<Size>()) {}
107 void validate() const override;
111 std::vector<Date> fixingDates;
112 };
113
116 : public OneAssetOption::arguments {
117 public:
119 void validate() const override;
121 };
122
125 : public GenericEngine<DiscreteAveragingAsianOption::arguments,
126 DiscreteAveragingAsianOption::results> {};
127
130 : public GenericEngine<ContinuousAveragingAsianOption::arguments,
131 ContinuousAveragingAsianOption::results> {};
132
133}
134
135
136#endif
Extra arguments for single-asset continuous-average Asian option.
Continuous-averaging Asian engine base class.
Continuous-averaging Asian option.
Definition: asianoption.hpp:41
void setupArguments(PricingEngine::arguments *) const override
Extra arguments for single-asset discrete-average Asian option.
Discrete-averaging Asian engine base class.
Discrete-averaging Asian option.
Definition: asianoption.hpp:57
void setupArguments(PricingEngine::arguments *) const override
Definition: asianoption.cpp:64
template base class for option pricing engines
template class providing a null value for a given type.
Definition: null.hpp:76
Base class for options on a single asset.
ext::shared_ptr< Payoff > payoff() const
Definition: option.hpp:45
ext::shared_ptr< Exercise > exercise() const
Definition: option.hpp:46
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Placeholder for enumerated averaging types.
Definition: averagetype.hpp:34