/src/quantlib/ql/quotes/deltavolquote.cpp
Line | Count | Source |
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 | | <https://www.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 | | #include <ql/quotes/deltavolquote.hpp> |
21 | | #include <utility> |
22 | | |
23 | | namespace QuantLib { |
24 | | |
25 | | DeltaVolQuote::DeltaVolQuote(Real delta, Handle<Quote> vol, Time maturity, DeltaType deltaType) |
26 | 0 | : delta_(delta), vol_(std::move(vol)), deltaType_(deltaType), maturity_(maturity), |
27 | 0 | atmType_(DeltaVolQuote::AtmNull) { |
28 | |
|
29 | 0 | registerWith(vol_); // observe vol |
30 | 0 | } Unexecuted instantiation: QuantLib::DeltaVolQuote::DeltaVolQuote(double, QuantLib::Handle<QuantLib::Quote>, double, QuantLib::DeltaVolQuote::DeltaType) Unexecuted instantiation: QuantLib::DeltaVolQuote::DeltaVolQuote(double, QuantLib::Handle<QuantLib::Quote>, double, QuantLib::DeltaVolQuote::DeltaType) |
31 | | |
32 | | DeltaVolQuote::DeltaVolQuote(Handle<Quote> vol, |
33 | | DeltaType deltaType, |
34 | | Time maturity, |
35 | | AtmType atmType) |
36 | 0 | : vol_(std::move(vol)), deltaType_(deltaType), maturity_(maturity), atmType_(atmType) { |
37 | |
|
38 | 0 | registerWith(vol_); |
39 | 0 | } Unexecuted instantiation: QuantLib::DeltaVolQuote::DeltaVolQuote(QuantLib::Handle<QuantLib::Quote>, QuantLib::DeltaVolQuote::DeltaType, double, QuantLib::DeltaVolQuote::AtmType) Unexecuted instantiation: QuantLib::DeltaVolQuote::DeltaVolQuote(QuantLib::Handle<QuantLib::Quote>, QuantLib::DeltaVolQuote::DeltaType, double, QuantLib::DeltaVolQuote::AtmType) |
40 | | |
41 | 0 | Real DeltaVolQuote::value() const { |
42 | 0 | return vol_->value(); |
43 | 0 | } |
44 | | |
45 | 0 | Real DeltaVolQuote::delta() const { |
46 | 0 | return delta_; |
47 | 0 | } |
48 | | |
49 | 0 | Time DeltaVolQuote::maturity() const { |
50 | 0 | return maturity_; |
51 | 0 | } |
52 | | |
53 | 0 | bool DeltaVolQuote::isValid() const { |
54 | 0 | return !vol_.empty() && vol_->isValid(); |
55 | 0 | } |
56 | | |
57 | 0 | void DeltaVolQuote::update() { |
58 | 0 | notifyObservers(); // let observers know, that something has changed |
59 | 0 | } |
60 | | |
61 | 0 | DeltaVolQuote::AtmType DeltaVolQuote::atmType() const { |
62 | 0 | return atmType_; |
63 | 0 | } |
64 | | |
65 | 0 | DeltaVolQuote::DeltaType DeltaVolQuote::deltaType() const { |
66 | 0 | return deltaType_; |
67 | 0 | } |
68 | | |
69 | | } |