QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
atmadjustedsmilesection.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2013 Peter Caspers
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
20/*! \file atmadjustedsmilesection.hpp
21 \brief smile section that allows for alternate specification of atm level
22 and recentering the source volatility accordingly
23*/
24
25#ifndef quantlib_atm_adjusted_smile_section_hpp
26#define quantlib_atm_adjusted_smile_section_hpp
27
29
30namespace QuantLib {
31
33
34 public:
35 explicit AtmAdjustedSmileSection(const ext::shared_ptr<SmileSection>& source,
36 Real atm = Null<Real>(),
37 bool recenterSmile = false);
38
39 Real minStrike() const override { return source_->minStrike(); }
40 Real maxStrike() const override { return source_->maxStrike(); }
41 Real atmLevel() const override { return f_; }
42 const Date& exerciseDate() const override { return source_->exerciseDate(); }
43 Time exerciseTime() const override { return source_->exerciseTime(); }
44 const DayCounter& dayCounter() const override { return source_->dayCounter(); }
45 const Date& referenceDate() const override { return source_->referenceDate(); }
46 VolatilityType volatilityType() const override { return source_->volatilityType(); }
47 Rate shift() const override { return source_->shift(); }
48
51 Real discount = 1.0) const override {
52 return source_->optionPrice(adjustedStrike(strike), type, discount);
53 }
54
57 Real discount = 1.0,
58 Real gap = 1.0e-5) const override {
59 return source_->digitalOptionPrice(adjustedStrike(strike), type,
60 discount, gap);
61 }
62
63 Real vega(Rate strike, Real discount = 1.0) const override {
64 return source_->vega(adjustedStrike(strike), discount);
65 }
66
67 Real density(Rate strike, Real discount = 1.0, Real gap = 1.0E-4) const override {
68 return source_->density(adjustedStrike(strike), discount, gap);
69 }
70
71 protected:
72 Real varianceImpl(Rate strike) const override;
73 Volatility volatilityImpl(Rate strike) const override;
74
75 private:
76
77 Real adjustedStrike(Real strike) const;
78 ext::shared_ptr<SmileSection> source_;
81 };
82}
83
84#endif
Real density(Rate strike, Real discount=1.0, Real gap=1.0E-4) const override
Real vega(Rate strike, Real discount=1.0) const override
const Date & exerciseDate() const override
const Date & referenceDate() const override
VolatilityType volatilityType() const override
ext::shared_ptr< SmileSection > source_
Real digitalOptionPrice(Rate strike, Option::Type type=Option::Call, Real discount=1.0, Real gap=1.0e-5) const override
Real varianceImpl(Rate strike) const override
const DayCounter & dayCounter() const override
Real optionPrice(Rate strike, Option::Type type=Option::Call, Real discount=1.0) const override
Volatility volatilityImpl(Rate strike) const override
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
template class providing a null value for a given type.
Definition: null.hpp:76
interest rate volatility smile section
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
Smile section base class.