25#ifndef quantext_discounting_swap_engine_deltagamma_hpp
26#define quantext_discounting_swap_engine_deltagamma_hpp
28#include <ql/cashflows/cashflows.hpp>
29#include <ql/cashflows/fixedratecoupon.hpp>
30#include <ql/cashflows/iborcoupon.hpp>
31#include <ql/cashflows/simplecashflow.hpp>
32#include <ql/handle.hpp>
33#include <ql/instruments/swap.hpp>
34#include <ql/math/matrix.hpp>
35#include <ql/patterns/visitor.hpp>
36#include <ql/termstructures/yieldtermstructure.hpp>
73 const std::vector<Time>& bucketTimes = std::vector<Time>(),
74 const bool computeDelta =
false,
const bool computeGamma =
false,
75 const bool computeBPS =
false,
const bool linearInZero =
true);
88 public Visitor<CashFlow>,
89 public Visitor<SimpleCashFlow>,
90 public Visitor<FixedRateCoupon>,
91 public Visitor<IborCoupon>,
92 public Visitor<QuantExt::OvernightIndexedCoupon>,
93 public Visitor<FloatingRateFXLinkedNotionalCoupon>,
94 public Visitor<FXLinkedCashFlow> {
99 const bool computeDelta,
const bool computeGamma,
const bool computeBPS,
100 std::map<Date, Real>& deltaDiscount, std::map<Date, Real>& deltaForward,
101 std::map<Date, Real>& deltaBPS, std::map<Date, Real>& gammaDiscount,
102 std::map<std::pair<Date, Date>, Real>& gammaForward,
103 std::map<std::pair<Date, Date>, Real>& gammaDscFwd, std::map<Date, Real>& gammaBPS,
104 Real& fxLinkedForeignNpv,
const bool excludeSimpleCashFlowsFromSensis,
105 Real& simpleCashFlowNpv);
106 void visit(CashFlow& c)
override;
107 void visit(SimpleCashFlow& c)
override;
108 void visit(FixedRateCoupon& c)
override;
109 void visit(IborCoupon& c)
override;
129std::vector<Real>
rebucketDeltas(
const std::vector<Time>& deltaTimes,
const std::map<Date, Real>& deltaRaw,
130 const Date& referenceDate,
const DayCounter& dc,
const bool linearInZero);
132Matrix
rebucketGammas(
const std::vector<Time>& gammaTimes,
const std::map<Date, Real>& gammaDscRaw,
133 std::map<std::pair<Date, Date>, Real>& gammaForward,
134 std::map<std::pair<Date, Date>, Real>& gammaDscFwd,
const bool forceFullMatrix,
135 const Date& referenceDate,
const DayCounter& dc,
const bool linearInZero);
Discounting swap engine providing analytical deltas and gammas.
const std::vector< Real > bucketTimes_
Handle< YieldTermStructure > discountCurve_
Handle< YieldTermStructure > discountCurve() const
void calculate() const override
Handle< YieldTermStructure > discountCurve_
std::map< Date, Real > & deltaBPS_
std::map< Date, Real > & deltaDiscount_
std::map< Date, Real > & deltaForward_
std::map< std::pair< Date, Date >, Real > & gammaDscFwd_
std::map< Date, Real > & gammaBPS_
const bool excludeSimpleCashFlowsFromSensis_
std::map< std::pair< Date, Date >, Real > & gammaForward_
void visit(CashFlow &c) override
Real & fxLinkedForeignNpv_
void processIborCoupon(FloatingRateCoupon &c)
std::map< Date, Real > & gammaDiscount_
Real & simpleCashFlowNpv_
Coupon paying a Libor-type index but with an FX linked notional.
Matrix rebucketGammas(const std::vector< Time > &gammaTimes, const std::map< Date, Real > &gammaDscRaw, std::map< std::pair< Date, Date >, Real > &gammaForward, std::map< std::pair< Date, Date >, Real > &gammaDscFwd, const bool forceFullMatrix, const Date &referenceDate, const DayCounter &dc, const bool linearInZero)
std::vector< Real > rebucketDeltas(const std::vector< Time > &deltaTimes, const std::map< Date, Real > &deltaRaw, const Date &referenceDate, const DayCounter &dc, const bool linearInZero)
coupon paying the compounded daily overnight rate, copy of QL class, added includeSpread flag