QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
sabrvoltermstructure.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2017 Klaus Spanderen
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy 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
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
24#ifndef quantlib_sabr_vol_termstructure_hpp
25#define quantlib_sabr_vol_termstructure_hpp
26
27
28#include <ql/termstructures/volatility/sabr.hpp>
29#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
30#include <ql/time/calendars/nullcalendar.hpp>
31
32namespace QuantLib {
34 public:
36 Real beta,
37 Real gamma,
38 Real rho,
39 Real s0,
40 Real r,
41 const Date& referenceDate,
42 const DayCounter& dc)
44 beta_(beta), gamma_(gamma), rho_(rho), s0_(s0), r_(r) {}
45
46 Date maxDate() const override { return Date::maxDate(); }
47 Rate minStrike() const override { return 0.0; }
48 Rate maxStrike() const override { return QL_MAX_REAL; }
49
50 protected:
51 Volatility blackVolImpl(Time t, Real strike) const override {
52 const Real fwd = s0_*std::exp(r_*t);
53 return sabrVolatility(strike, fwd, t, alpha_, beta_, gamma_, rho_);
54 }
55
56 private:
58 };
59}
60
61#endif
Concrete date class.
Definition: date.hpp:125
static Date maxDate()
latest allowed date
Definition: date.cpp:771
day counter class
Definition: daycounter.hpp:44
Calendar for reproducing theoretical calculations.
Rate maxStrike() const override
the maximum strike for which the term structure can return vols
Rate minStrike() const override
the minimum strike for which the term structure can return vols
SABRVolTermStructure(Real alpha, Real beta, Real gamma, Real rho, Real s0, Real r, const Date &referenceDate, const DayCounter &dc)
Date maxDate() const override
the latest date for which the curve can return values
Volatility blackVolImpl(Time t, Real strike) const override
Black volatility calculation.
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
#define QL_MAX_REAL
Definition: qldefines.hpp:176
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
Real sabrVolatility(Rate strike, Rate forward, Time expiryTime, Real alpha, Real beta, Real nu, Real rho, VolatilityType volatilityType)
Definition: sabr.cpp:159