1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 /*
4  Copyright (C) 2014 Bernd Lewerenz
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 
20 /*! \file continuousarithmeticasianvecerengine.hpp
21     \brief Vecer engine for continuous arithmetic Asian options
22 */
23 
24 #ifndef quantlib_continuous_arithmetic_asian_vecer_engine_hpp
25 #define quantlib_continuous_arithmetic_asian_vecer_engine_hpp
26 
27 #include <ql/instruments/asianoption.hpp>
28 #include <ql/processes/blackscholesprocess.hpp>
29 
30 namespace QuantLib {
31 
32     //! Vecer engine for continuous-avaeraging Asian options
33     /*! See <http://www.stat.columbia.edu/~vecer/asian-vecer.pdf> */
34     class ContinuousArithmeticAsianVecerEngine
35         : public ContinuousAveragingAsianOption::engine {
36       public:
37         ContinuousArithmeticAsianVecerEngine(
38             const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
39             const Handle<Quote>& currentAverage,
40             Date startDate,
41             Size timeSteps = 100,
42             Size assetSteps = 100,
43             Real z_min = -1.0,
44             Real z_max = 1.0);
45         void calculate() const;
46       protected:
47         // Replication of average by holding this amount in assets
48         Real cont_strategy(Time t, Time T1,Time T2,Real v, Real r) const;
49       private:
50         ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
51         Handle<Quote> currentAverage_ ;
52         Date startDate_;
53         Real z_min_;
54         Real z_max_;
55         Size timeSteps_;
56         Size assetSteps_;
57     };
58 
59 }
60 
61 
62 #endif
63