1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Ferdinando Ametrano
5 Copyright (C) 2007 François du Vignaud
6 Copyright (C) 2007 Giorgio Facchinetti
7 Copyright (C) 2015 Peter Caspers
8
9 This file is part of QuantLib, a free-software/open-source library
10 for financial quantitative analysts and developers - http://quantlib.org/
11
12 QuantLib is free software: you can redistribute it and/or modify it
13 under the terms of the QuantLib license. You should have received a
14 copy of the license along with this program; if not, please email
15 <quantlib-dev@lists.sf.net>. The license is also available online at
16 <http://quantlib.org/license.shtml>.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the license for more details.
21*/
22
23/*! \file flatsmilesection.hpp
24 \brief Flat SmileSection
25*/
26
27#ifndef quantlib_flat_smile_section_hpp
28#define quantlib_flat_smile_section_hpp
29
30#include <ql/termstructures/volatility/smilesection.hpp>
31
32namespace QuantLib {
33
34 class FlatSmileSection : public SmileSection {
35 public:
36 FlatSmileSection(const Date& d,
37 Volatility vol,
38 const DayCounter& dc,
39 const Date& referenceDate = Date(),
40 Real atmLevel = Null<Rate>(),
41 VolatilityType type = ShiftedLognormal,
42 Real shift = 0.0);
43 FlatSmileSection(Time exerciseTime,
44 Volatility vol,
45 const DayCounter& dc,
46 Real atmLevel = Null<Rate>(),
47 VolatilityType type = ShiftedLognormal,
48 Real shift = 0.0);
49 //@{
50 Real minStrike() const override;
51 Real maxStrike() const override;
52 Real atmLevel() const override;
53 //@}
54 protected:
55 Volatility volatilityImpl(Rate) const override;
56
57 private:
58 Volatility vol_;
59 Real atmLevel_;
60 };
61
62 inline Real FlatSmileSection::minStrike () const {
63 return QL_MIN_REAL - shift();
64 }
65
66 inline Real FlatSmileSection::maxStrike () const {
67 return QL_MAX_REAL;
68 }
69
70 inline Real FlatSmileSection::atmLevel() const {
71 return atmLevel_;
72 }
73
74 inline Volatility FlatSmileSection::volatilityImpl(Rate) const {
75 return vol_;
76 }
77
78}
79
80#endif
81

source code of quantlib/ql/termstructures/volatility/flatsmilesection.hpp