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 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( 37 bool payer, 38 const Calendar& calendar, 39 const Money& fixedPrice, 40 const UnitOfMeasure& fixedPriceUnitOfMeasure, 41 const ext::shared_ptr<CommodityIndex>& index, 42 const Currency& payCurrency, 43 const Currency& receiveCurrency, 44 const PricingPeriods& pricingPeriods, 45 const CommodityType& commodityType, 46 const ext::shared_ptr<SecondaryCosts>& secondaryCosts, 47 const Handle<YieldTermStructure>& payLegTermStructure, 48 const Handle<YieldTermStructure>& receiveLegTermStructure, 49 const Handle<YieldTermStructure>& discountTermStructure); 50 51 bool isExpired() const; payReceive() const52 Integer payReceive() const { return payReceive_; } fixedPrice() const53 const Money& fixedPrice() const { return fixedPrice_; } fixedPriceUnitOfMeasure() const54 const UnitOfMeasure& fixedPriceUnitOfMeasure() const { 55 return fixedPriceUnitOfMeasure_; 56 } index() const57 const ext::shared_ptr<CommodityIndex>& index() const { 58 return index_; 59 } 60 61 protected: 62 void performCalculations() const; 63 64 Integer payReceive_; 65 Money fixedPrice_; 66 UnitOfMeasure fixedPriceUnitOfMeasure_; 67 ext::shared_ptr<CommodityIndex> index_; 68 Handle<YieldTermStructure> payLegTermStructure_; 69 Handle<YieldTermStructure> receiveLegTermStructure_; 70 Handle<YieldTermStructure> discountTermStructure_; 71 }; 72 73 } 74 75 76 #endif 77