1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4Copyright (C) 2010 Adrian O' Neill
5
6This file is part of QuantLib, a free-software/open-source library
7for financial quantitative analysts and developers - http://quantlib.org/
8
9QuantLib is free software: you can redistribute it and/or modify it
10under the terms of the QuantLib license. You should have received a
11copy 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
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file fftvanillaengine.hpp
21 \brief FFT engine for vanilla options under a Black Scholes process
22*/
23
24#ifndef quantlib_fft_vanilla_engine_hpp
25#define quantlib_fft_vanilla_engine_hpp
26
27#include <ql/experimental/variancegamma/fftengine.hpp>
28#include <ql/processes/blackscholesprocess.hpp>
29#include <complex>
30
31namespace QuantLib {
32
33 //! FFT Pricing engine vanilla options under a Black Scholes process
34 /*! \ingroup vanillaengines
35
36 \test the correctness of the returned values is tested by
37 comparison with Black Scholes pricing.
38 */
39 class FFTVanillaEngine : public FFTEngine {
40 public:
41 explicit FFTVanillaEngine(
42 const ext::shared_ptr<GeneralizedBlackScholesProcess>&process,
43 Real logStrikeSpacing = 0.001);
44 std::unique_ptr<FFTEngine> clone() const override;
45 protected:
46 void precalculateExpiry(Date d) override;
47 std::complex<Real> complexFourierTransform(std::complex<Real> u) const override;
48 Real discountFactor(Date d) const override;
49 Real dividendYield(Date d) const override;
50
51 private:
52 DiscountFactor dividendDiscount_;
53 DiscountFactor riskFreeDiscount_;
54 Time t_;
55 Real var_;
56 };
57
58}
59
60
61#endif
62
63

source code of quantlib/ql/experimental/variancegamma/fftvanillaengine.hpp