Coverage Report

Created: 2025-08-11 06:28

/src/quantlib/ql/experimental/commodities/energyswap.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 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
 <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 energyswap.hpp
21
    \brief Energy swap
22
*/
23
24
#ifndef quantlib_energy_swap_hpp
25
#define quantlib_energy_swap_hpp
26
27
#include <ql/experimental/commodities/energycommodity.hpp>
28
#include <ql/experimental/commodities/pricingperiod.hpp>
29
#include <ql/experimental/commodities/commoditycashflow.hpp>
30
#include <ql/time/calendar.hpp>
31
32
namespace QuantLib {
33
34
    class EnergySwap : public EnergyCommodity {
35
      public:
36
        EnergySwap(Calendar calendar,
37
                   Currency payCurrency,
38
                   Currency receiveCurrency,
39
                   PricingPeriods pricingPeriods,
40
                   const CommodityType& commodityType,
41
                   const ext::shared_ptr<SecondaryCosts>& secondaryCosts);
42
43
        bool isExpired() const override;
44
0
        const Calendar& calendar() const { return calendar_; }
45
0
        const Currency& payCurrency() const { return payCurrency_; }
46
0
        const Currency& receiveCurrency() const { return receiveCurrency_; }
47
0
        const PricingPeriods& pricingPeriods() const { return pricingPeriods_; }
48
0
        const EnergyDailyPositions& dailyPositions() const {
49
0
            return dailyPositions_;
50
0
        }
51
0
        const CommodityCashFlows& paymentCashFlows() const {
52
0
            return paymentCashFlows_;
53
0
        }
54
55
        const CommodityType& commodityType() const;
56
        Quantity quantity() const override;
57
58
      protected:
59
        Calendar calendar_;
60
        Currency payCurrency_;
61
        Currency receiveCurrency_;
62
        PricingPeriods pricingPeriods_;
63
        mutable EnergyDailyPositions dailyPositions_;
64
        mutable CommodityCashFlows paymentCashFlows_;
65
    };
66
67
}
68
69
#endif