QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
deltavolquote.cpp
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) 2010 Dimitri Reiswich
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
21#include <utility>
22
23namespace QuantLib {
24
26 : delta_(delta), vol_(std::move(vol)), deltaType_(deltaType), maturity_(maturity),
27 atmType_(DeltaVolQuote::AtmNull) {
28
29 registerWith(vol_); // observe vol
30 }
31
33 DeltaType deltaType,
34 Time maturity,
35 AtmType atmType)
36 : vol_(std::move(vol)), deltaType_(deltaType), maturity_(maturity), atmType_(atmType) {
37
39 }
40
42 return vol_->value();
43 }
44
46 return delta_;
47 }
48
50 return maturity_;
51 }
52
54 return !vol_.empty() && vol_->isValid();
55 }
56
58 notifyObservers(); // let observers know, that something has changed
59 }
60
62 return atmType_;
63 }
64
66 return deltaType_;
67 }
68
69}
ext::shared_ptr< SimpleQuote > vol_
Definition: cdsoption.cpp:62
Class for the quotation of delta vs vol.
void update() override
DeltaType deltaType() const
AtmType atmType() const
Real value() const override
returns the current value
DeltaVolQuote(Real delta, Handle< Quote > vol, Time maturity, DeltaType deltaType)
bool isValid() const override
returns true if the Quote holds a valid value
Shared handle to an observable.
Definition: handle.hpp:41
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Class for the quotation of delta vs vol.
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
STL namespace.