1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Mario Pucci
5 Copyright (C) 2015 Peter Caspers
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
21/*! \file sabrsmilesection.hpp
22 \brief sabr smile section class
23*/
24
25#ifndef quantlib_sabr_smile_section_hpp
26#define quantlib_sabr_smile_section_hpp
27
28#include <ql/termstructures/volatility/smilesection.hpp>
29#include <ql/time/daycounters/actual365fixed.hpp>
30#include <vector>
31
32namespace QuantLib {
33
34 class SabrSmileSection : public SmileSection {
35 public:
36 SabrSmileSection(Time timeToExpiry,
37 Rate forward,
38 const std::vector<Real>& sabrParameters,
39 Real shift = 0.0,
40 VolatilityType volatilityType = VolatilityType::ShiftedLognormal);
41 SabrSmileSection(const Date& d,
42 Rate forward,
43 const std::vector<Real>& sabrParameters,
44 const Date& referenceDate = Date(),
45 const DayCounter& dc = Actual365Fixed(),
46 Real shift = 0.0,
47 VolatilityType volatilityType = VolatilityType::ShiftedLognormal);
48 /*! \deprecated Use the constructor taking an optional reference date.
49 Deprecated in version 1.28.
50 */
51 QL_DEPRECATED
52 SabrSmileSection(const Date& d,
53 Rate forward,
54 const std::vector<Real>& sabrParameters,
55 const DayCounter& dc,
56 Real shift = 0.0,
57 VolatilityType volatilityType = VolatilityType::ShiftedLognormal);
58
59 Real minStrike() const override { return -shift_; }
60 Real maxStrike() const override { return QL_MAX_REAL; }
61 Real atmLevel() const override { return forward_; }
62 Real alpha() const { return alpha_; }
63 Real beta() const { return beta_; }
64 Real nu() const { return nu_; }
65 Real rho() const { return rho_; }
66 protected:
67 Real varianceImpl(Rate strike) const override;
68 Volatility volatilityImpl(Rate strike) const override;
69
70 private:
71 Real alpha_, beta_, nu_, rho_, forward_, shift_;
72 void initialise(const std::vector<Real>& sabrParameters);
73 };
74
75
76}
77
78#endif
79

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