Coverage Report

Created: 2025-09-04 07:11

/src/quantlib/ql/experimental/commodities/energybasisswap.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
 <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 energybasisswap.hpp
21
    \brief Energy basis swap
22
*/
23
24
#ifndef quantlib_energy_basis_swap_hpp
25
#define quantlib_energy_basis_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
    //! Energy basis swap
34
    class EnergyBasisSwap : public EnergySwap {
35
      public:
36
        EnergyBasisSwap(const Calendar& calendar,
37
                        ext::shared_ptr<CommodityIndex> spreadIndex,
38
                        ext::shared_ptr<CommodityIndex> payIndex,
39
                        ext::shared_ptr<CommodityIndex> receiveIndex,
40
                        bool spreadToPayLeg,
41
                        const Currency& payCurrency,
42
                        const Currency& receiveCurrency,
43
                        const PricingPeriods& pricingPeriods,
44
                        CommodityUnitCost basis,
45
                        const CommodityType& commodityType,
46
                        const ext::shared_ptr<SecondaryCosts>& secondaryCosts,
47
                        Handle<YieldTermStructure> payLegTermStructure,
48
                        Handle<YieldTermStructure> receiveLegTermStructure,
49
                        Handle<YieldTermStructure> discountTermStructure);
50
51
0
        const ext::shared_ptr<CommodityIndex>& payIndex() const {
52
0
            return payIndex_;
53
0
        }
54
0
        const ext::shared_ptr<CommodityIndex>& receiveIndex() const {
55
0
            return receiveIndex_;
56
0
        }
57
0
        const CommodityUnitCost& basis() const { return basis_; }
58
59
      protected:
60
        void performCalculations() const override;
61
62
        ext::shared_ptr<CommodityIndex> spreadIndex_;
63
        ext::shared_ptr<CommodityIndex> payIndex_;
64
        ext::shared_ptr<CommodityIndex> receiveIndex_;
65
        bool spreadToPayLeg_;
66
        CommodityUnitCost basis_;
67
        Handle<YieldTermStructure> payLegTermStructure_;
68
        Handle<YieldTermStructure> receiveLegTermStructure_;
69
        Handle<YieldTermStructure> discountTermStructure_;
70
    };
71
72
}
73
74
#endif