Coverage Report

Created: 2025-10-14 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/experimental/commodities/energyfuture.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2008 J. Erik Radmall
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
/*! \file energyfuture.hpp
21
    \brief Energy future
22
*/
23
24
#ifndef quantlib_energy_future_hpp
25
#define quantlib_energy_future_hpp
26
27
#include <ql/experimental/commodities/energycommodity.hpp>
28
#include <ql/experimental/commodities/commodityindex.hpp>
29
30
namespace QuantLib {
31
32
    //! Energy future
33
    /*! \ingroup instruments */
34
    class EnergyFuture : public EnergyCommodity {
35
      public:
36
        EnergyFuture(Integer buySell,
37
                     Quantity quantity,
38
                     CommodityUnitCost tradePrice,
39
                     ext::shared_ptr<CommodityIndex> index,
40
                     const CommodityType& commodityType,
41
                     const ext::shared_ptr<SecondaryCosts>& secondaryCosts);
42
        bool isExpired() const override;
43
        //Integer buySell{} const { return buySell_; }
44
0
        Quantity quantity() const override { return quantity_; }
45
0
        const CommodityUnitCost& tradePrice() const { return tradePrice_; }
46
0
        ext::shared_ptr<CommodityIndex> index() const { return index_; }
47
48
      protected:
49
        void performCalculations() const override;
50
        Integer buySell_;
51
        Quantity quantity_;
52
        CommodityUnitCost tradePrice_;
53
        ext::shared_ptr<CommodityIndex> index_;
54
    };
55
56
}
57
58
#endif