19#include <ql/event.hpp>
29 boost::optional<bool> includeSettlementDateFlows,
31 : discountCurve_(discountCurve), includeSettlementDateFlows_(includeSettlementDateFlows),
41 if (npvDate == Null<Date>()) {
42 const auto& priceCurve = index->priceCurve();
43 QL_REQUIRE(!priceCurve.empty(),
"DiscountingCommodityForwardEngine: need a non-empty price curve.");
44 npvDate = priceCurve->referenceDate();
47 const Date& maturity =
arguments_.maturityDate;
48 Date paymentDate = maturity;
56 Real buySell =
arguments_.position == Position::Long ? 1.0 : -1.0;
57 Real forwardPrice = index->fixing(maturity);
59 auto value =
arguments_.quantity * buySell * (forwardPrice -
arguments_.strike) * discountPaymentDate /
66 results_.additionalResults[
"fxRate"] = fxRate;
69 results_.additionalResults[
"forwardPrice"] = forwardPrice;
71 results_.additionalResults[
"discountPaymentDate"] = discountPaymentDate;
const Instrument::results * results_
DiscountingCommodityForwardEngine(const QuantLib::Handle< QuantLib::YieldTermStructure > &discountCurve, boost::optional< bool > includeSettlementDateFlows=boost::none, const QuantLib::Date &npvDate=QuantLib::Date())
boost::optional< bool > includeSettlementDateFlows_
void calculate() const override
QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve_
Engine to value a commodity forward contract.
Swap::arguments * arguments_