Coverage Report

Created: 2026-03-11 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/experimental/commodities/energyvanillaswap.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 energyvanillaswap.hpp
21
    \brief Vanilla energy swap
22
*/
23
24
#ifndef quantlib_energy_vanilla_swap_hpp
25
#define quantlib_energy_vanilla_swap_hpp
26
27
#include <ql/experimental/commodities/energyswap.hpp>
28
#include <ql/experimental/commodities/commodityindex.hpp>
29
#include <ql/termstructures/yieldtermstructure.hpp>
30
31
namespace QuantLib {
32
33
    //! Vanilla energy swap
34
    class EnergyVanillaSwap : public EnergySwap {
35
      public:
36
        EnergyVanillaSwap(bool payer,
37
                          const Calendar& calendar,
38
                          Money fixedPrice,
39
                          UnitOfMeasure fixedPriceUnitOfMeasure,
40
                          ext::shared_ptr<CommodityIndex> index,
41
                          const Currency& payCurrency,
42
                          const Currency& receiveCurrency,
43
                          const PricingPeriods& pricingPeriods,
44
                          const CommodityType& commodityType,
45
                          const ext::shared_ptr<SecondaryCosts>& secondaryCosts,
46
                          Handle<YieldTermStructure> payLegTermStructure,
47
                          Handle<YieldTermStructure> receiveLegTermStructure,
48
                          Handle<YieldTermStructure> discountTermStructure);
49
50
        bool isExpired() const override;
51
0
        Integer payReceive() const { return payReceive_; }
52
0
        const Money& fixedPrice() const { return fixedPrice_; }
53
0
        const UnitOfMeasure& fixedPriceUnitOfMeasure() const {
54
0
            return fixedPriceUnitOfMeasure_;
55
0
        }
56
0
        const ext::shared_ptr<CommodityIndex>& index() const {
57
0
            return index_;
58
0
        }
59
60
      protected:
61
        void performCalculations() const override;
62
63
        Integer payReceive_;
64
        Money fixedPrice_;
65
        UnitOfMeasure fixedPriceUnitOfMeasure_;
66
        ext::shared_ptr<CommodityIndex> index_;
67
        Handle<YieldTermStructure> payLegTermStructure_;
68
        Handle<YieldTermStructure> receiveLegTermStructure_;
69
        Handle<YieldTermStructure> discountTermStructure_;
70
    };
71
72
}
73
74
75
#endif