Coverage Report

Created: 2025-08-05 06:45

/src/quantlib/ql/quotes/lastfixingquote.hpp
Line
Count
Source (jump to first uncovered line)
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>
29
#include <ql/patterns/observable.hpp>
30
31
namespace 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
0
        void update() override { notifyObservers(); }
46
        //@}
47
        //! \name LastFixingQuote interface
48
        //@{
49
0
        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