| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2006 Ferdinando Ametrano |
| 5 | Copyright (C) 2006 Mario Pucci |
| 6 | Copyright (C) 2006 StatPro Italia srl |
| 7 | Copyright (C) 2015 Peter Caspers |
| 8 | Copyright (C) 2019 Klaus Spanderen |
| 9 | |
| 10 | This file is part of QuantLib, a free-software/open-source library |
| 11 | for financial quantitative analysts and developers - http://quantlib.org/ |
| 12 | |
| 13 | QuantLib is free software: you can redistribute it and/or modify it |
| 14 | under the terms of the QuantLib license. You should have received a |
| 15 | copy of the license along with this program; if not, please email |
| 16 | <quantlib-dev@lists.sf.net>. The license is also available online at |
| 17 | <http://quantlib.org/license.shtml>. |
| 18 | |
| 19 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 20 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 21 | FOR A PARTICULAR PURPOSE. See the license for more details. |
| 22 | */ |
| 23 | |
| 24 | /*! \file sabr.hpp |
| 25 | \brief SABR functions |
| 26 | */ |
| 27 | |
| 28 | #ifndef quantlib_sabr_hpp |
| 29 | #define quantlib_sabr_hpp |
| 30 | |
| 31 | #include <ql/types.hpp> |
| 32 | #include <ql/termstructures/volatility/volatilitytype.hpp> |
| 33 | |
| 34 | namespace QuantLib { |
| 35 | |
| 36 | Real unsafeSabrLogNormalVolatility(Rate strike, |
| 37 | Rate forward, |
| 38 | Time expiryTime, |
| 39 | Real alpha, |
| 40 | Real beta, |
| 41 | Real nu, |
| 42 | Real rho); |
| 43 | |
| 44 | Real unsafeShiftedSabrVolatility(Rate strike, |
| 45 | Rate forward, |
| 46 | Time expiryTime, |
| 47 | Real alpha, |
| 48 | Real beta, |
| 49 | Real nu, |
| 50 | Real rho, |
| 51 | Real shift, |
| 52 | VolatilityType volatilityType = VolatilityType::ShiftedLognormal); |
| 53 | |
| 54 | /* Normal SABR implemented according to |
| 55 | https://www2.deloitte.com/content/dam/Deloitte/global/Documents/Financial-Services/be-aers-fsi-sabr-sensitivities.pdf |
| 56 | */ |
| 57 | Real unsafeSabrNormalVolatility(Rate strike, |
| 58 | Rate forward, |
| 59 | Time expiryTime, |
| 60 | Real alpha, |
| 61 | Real beta, |
| 62 | Real nu, |
| 63 | Real rho); |
| 64 | |
| 65 | Real unsafeSabrVolatility(Rate strike, |
| 66 | Rate forward, |
| 67 | Time expiryTime, |
| 68 | Real alpha, |
| 69 | Real beta, |
| 70 | Real nu, |
| 71 | Real rho, |
| 72 | VolatilityType volatilityType = VolatilityType::ShiftedLognormal); |
| 73 | |
| 74 | Real sabrVolatility(Rate strike, |
| 75 | Rate forward, |
| 76 | Time expiryTime, |
| 77 | Real alpha, |
| 78 | Real beta, |
| 79 | Real nu, |
| 80 | Real rho, |
| 81 | VolatilityType volatilityType = VolatilityType::ShiftedLognormal); |
| 82 | |
| 83 | Real shiftedSabrVolatility(Rate strike, |
| 84 | Rate forward, |
| 85 | Time expiryTime, |
| 86 | Real alpha, |
| 87 | Real beta, |
| 88 | Real nu, |
| 89 | Real rho, |
| 90 | Real shift, |
| 91 | VolatilityType volatilityType = VolatilityType::ShiftedLognormal); |
| 92 | |
| 93 | Real sabrFlochKennedyVolatility(Rate strike, |
| 94 | Rate forward, |
| 95 | Time expiryTime, |
| 96 | Real alpha, |
| 97 | Real beta, |
| 98 | Real nu, |
| 99 | Real rho); |
| 100 | |
| 101 | void validateSabrParameters(Real alpha, |
| 102 | Real beta, |
| 103 | Real nu, |
| 104 | Real rho); |
| 105 | } |
| 106 | |
| 107 | #endif |
| 108 | |