Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
discountingcommodityforwardengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/pricingengines/discountingcommodityforwardengine.hpp
20 \brief Engine to value a commodity forward contract
21
22 \ingroup engines
23*/
24
25#ifndef quantext_discounting_commodity_forward_engine_hpp
26#define quantext_discounting_commodity_forward_engine_hpp
27
28#include <ql/termstructures/yieldtermstructure.hpp>
29
32
33namespace QuantExt {
34
35//! Discounting commodity forward engine
36
37/*! This class implements pricing of a commodity forward by discounting the future
38 nominal cash flows using the respective yield curve.
39
40 \ingroup engines
41*/
43public:
44 //! \name Constructors
45 //@{
46 /*! \param discountCurve The discount curve to discount the forward cashflow.
47 \param includeSettlementDateFlows If true (false), cashflows on the forward maturity
48 are (are not) included in the NPV.
49 \param npvDate Discount to this date. If not given, is set to the evaluation date
50 */
51 DiscountingCommodityForwardEngine(const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve,
52 boost::optional<bool> includeSettlementDateFlows = boost::none,
53 const QuantLib::Date& npvDate = QuantLib::Date());
54 //@}
55
56 //! \name PricingEngine interface
57 //@{
58 void calculate() const override;
59 //@}
60
61 //! \name Inspectors
62 //@{
63 const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve() const { return discountCurve_; }
64 //@}
65
66private:
67 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve_;
68 boost::optional<bool> includeSettlementDateFlows_;
69 QuantLib::Date npvDate_;
70};
71} // namespace QuantExt
72
73#endif
QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve_
const QuantLib::Handle< QuantLib::YieldTermStructure > & discountCurve() const
Instrument representing a commodity forward contract.
Term structure of prices.