QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lastfixingquote.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) 2008 Ferdinando Ametrano
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 lastfixingquote.hpp
21 \brief quote for the last fixing available for a given index
22*/
23
24#ifndef quantlib_last_fixing_quote_hpp
25#define quantlib_last_fixing_quote_hpp
26
27#include <ql/quote.hpp>
28#include <ql/index.hpp>
30
31namespace QuantLib {
32
33 //! Quote adapter for the last fixing available of a given Index
34 class LastFixingQuote : public Quote,
35 public Observer {
36 public:
37 LastFixingQuote(ext::shared_ptr<Index> index);
38 //! \name Quote interface
39 //@{
40 Real value() const override;
41 bool isValid() const override;
42 //@}
43 //! \name Observer interface
44 //@{
45 void update() override { notifyObservers(); }
46 //@}
47 //! \name LastFixingQuote interface
48 //@{
49 const ext::shared_ptr<Index>& index() const { return index_; }
50 Date referenceDate() const;
51 //@}
52 protected:
53 ext::shared_ptr<Index> index_;
54 };
55
56}
57
58#endif
Concrete date class.
Definition: date.hpp:125
Quote adapter for the last fixing available of a given Index.
ext::shared_ptr< Index > index_
const ext::shared_ptr< Index > & index() const
Real value() const override
returns the current value
bool isValid() const override
returns true if the Quote holds a valid value
Object that gets notified when a given observable changes.
Definition: observable.hpp:116
purely virtual base class for market observables
Definition: quote.hpp:37
QL_REAL Real
real number
Definition: types.hpp:50
virtual base class for indexes
Definition: any.hpp:35
observer/observable pattern
purely virtual base class for market observables