Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
discountingfxforwardenginedeltagamma.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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/discountingfxforwardenginedeltagamma.hpp
20 \brief Engine to value an FX Forward off two yield curves
21
22 \ingroup engines
23*/
24
25#ifndef quantext_discounting_fxforward_engine_delta_gamma_hpp
26#define quantext_discounting_fxforward_engine_delta_gamma_hpp
27
28#include <ql/math/matrix.hpp>
29#include <ql/termstructures/yieldtermstructure.hpp>
30
32
33namespace QuantExt {
34
35//! Discounting FX Forward Engine providing analytical deltas and gammas
36
37/*! This class generalises QuantExt's DiscountingFxForwardEngine, in analogy to the
38 DiscountingCurrencySwapEngineDeltaGamma. Additional results are
39
40 deltaDiscount (map<Currency, vector<Real>> ): Delta on discount curve, rebucketed, values are in currency
41 deltaFxSpot (map<Currency, Real> ): Delta on FX Spot (for ccy != npvCcy)
42
43 gamma (map<Currency, Matrix> ): Gamma matrix per currency between discount curve tenor points
44
45 Note that the second derivatives including the FX Spot are zero for the pure second derivative w.r.t. the FX Spot or
46 given by the in currency delta values provided as the additional result deltaDiscount to be
47 reinterpreted as values in domestic currency)
48
49 fxSpot (map<Currency, Real> ): FX Spot used for conversion to npvCurrency (for ccy != npvCcy)
50 bucketTimes (vector<Real> ): Bucketing grid for deltas and gammas
51
52 npvDom, npvFor : NPV of domestic flow resp. foreign flow (in dom resp. for ccy)
53
54 \ingroup engines
55*/
57public:
58 /*! \param domCcy, domCurve
59 Currency 1 and its discount curve.
60 \param forCcy, forCurve
61 Currency 2 and its discount curve.
62 \param spotFx
63 The market spot rate quote, given as units of domCcy
64 for one unit of forCcy. The spot rate must be given
65 w.r.t. a settlement equal to the npv date.
66 \param bucketTimes
67 Bucketing grid for deltas and gammas
68 \param computeDelta, computeGamma
69 Switch to enable/disable delta and gamma calculation
70 \param linearInZero
71 Interpolation used in the delta/gamma rebucketing to the desired time grid
72 \param includeSettlementDateFlows, settlementDate
73 If includeSettlementDateFlows is true (false), cashflows
74 on the settlementDate are (not) included in the NPV.
75 If not given the settlement date is set to the npv date.
76 \param npvDate
77 The date w.r.t. which the npv should be computed.
78 \param applySimmExemptions
79 If true, physically settled flows are ignored in sensi calculation, i.e. in he additional results
80 above, including npvDom and npvFor
81 */
82 DiscountingFxForwardEngineDeltaGamma(const Currency& domCcy, const Handle<YieldTermStructure>& domCurve,
83 const Currency& forCcy, const Handle<YieldTermStructure>& forCurve,
84 const Handle<Quote>& spotFx,
85 const std::vector<Time>& bucketTimes = std::vector<Time>(),
86 const bool computeDelta = false, const bool computeGamma = false,
87 const bool linearInZero = true,
88 boost::optional<bool> includeSettlementDateFlows = boost::none,
89 const Date& settlementDate = Date(), const Date& npvDate = Date(),
90 const bool applySimmExemptions = false);
91
92 void calculate() const override;
93
94 const Handle<YieldTermStructure>& domCurve() const { return domCurve_; }
95
96 const Handle<YieldTermStructure>& forCurve() const { return forCurve_; }
97
98 const Currency& domCcy() const { return domCcy_; }
99 const Currency& forCcy() const { return forCcy_; }
100
101 const Handle<Quote>& spotFx() const { return spotFx_; }
102
103private:
104 Currency domCcy_, forCcy_;
105 Handle<YieldTermStructure> domCurve_, forCurve_;
106 Handle<Quote> spotFx_;
107 const std::vector<Time> bucketTimes_;
109 boost::optional<bool> includeSettlementDateFlows_;
113};
114} // namespace QuantExt
115
116#endif
Discounting FX Forward Engine providing analytical deltas and gammas.
defaultable fxforward instrument