/src/quantlib/ql/termstructures/volatility/sabrsmilesection.hpp
Line | Count | Source |
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 | | <https://www.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 | | |
32 | | namespace 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 | | |
49 | 0 | Real minStrike() const override { return -shift_; } |
50 | 0 | Real maxStrike() const override { return QL_MAX_REAL; } |
51 | 0 | Real atmLevel() const override { return forward_; } |
52 | 0 | Real alpha() const { return alpha_; } |
53 | 0 | Real beta() const { return beta_; } |
54 | 0 | Real nu() const { return nu_; } |
55 | 0 | Real rho() const { return rho_; } |
56 | | protected: |
57 | | Real varianceImpl(Rate strike) const override; |
58 | | Volatility volatilityImpl(Rate strike) const override; |
59 | | |
60 | | private: |
61 | | Real alpha_, beta_, nu_, rho_, forward_, shift_; |
62 | | void initialise(const std::vector<Real>& sabrParameters); |
63 | | }; |
64 | | |
65 | | |
66 | | } |
67 | | |
68 | | #endif |