Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossccybasisswaphelper.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 crossccybasisswaphelper.hpp
20 \brief Cross currency basis swap helper
21 \ingroup termstructures
22*/
23
24#ifndef quantext_cross_ccy_basis_swap_helper_hpp
25#define quantext_cross_ccy_basis_swap_helper_hpp
26
27#include <ql/termstructures/yield/ratehelpers.hpp>
28
30
31namespace QuantExt {
32
33//! Cross Ccy Basis Swap Rate Helper
34/*! Rate helper for bootstrapping over cross currency basis swap spreads
35
36 Assumes that you have, at a minimum, either:
37 - flatIndex with attached YieldTermStructure and flatDiscountCurve
38 - spreadIndex with attached YieldTermStructure and spreadDiscountCurve
39
40 The other leg is then solved for i.e. index curve (if no
41 YieldTermStructure is attached to its index) or discount curve (if
42 its Handle is empty) or both.
43
44 The currencies are deduced from the ibor indexes. The spotFx
45 to be quoted with either of these currencies, this is determined
46 by the flatIsDomestic flag. The settlement date of the spot is
47 assumed to be equal to the settlement date of the swap itself.
48
49 \ingroup termstructures
50*/
52public:
54 const Handle<Quote>& spreadQuote, const Handle<Quote>& spotFX, Natural settlementDays,
55 const Calendar& settlementCalendar, const Period& swapTenor, BusinessDayConvention rollConvention,
56 const QuantLib::ext::shared_ptr<QuantLib::IborIndex>& flatIndex,
57 const QuantLib::ext::shared_ptr<QuantLib::IborIndex>& spreadIndex, const Handle<YieldTermStructure>& flatDiscountCurve,
58 const Handle<YieldTermStructure>& spreadDiscountCurve, bool eom = false, bool flatIsDomestic = true,
59 boost::optional<QuantLib::Period> flatTenor = boost::none,
60 boost::optional<QuantLib::Period> spreadTenor = boost::none, Real spreadOnFlatLeg = 0.0, Real flatGearing = 1.0,
61 Real spreadGearing = 1.0, const Calendar& flatCalendar = Calendar(),
62 const Calendar& spreadCalendar = Calendar(),
63 const std::vector<Natural>& spotFXSettleDaysVec = std::vector<Natural>(),
64 const std::vector<Calendar>& spotFXSettleCalendar = std::vector<Calendar>(), Size paymentLag = 0,
65 Size flatPaymentLag = 0, boost::optional<bool> includeSpread = boost::none,
66 boost::optional<Period> lookback = boost::none, boost::optional<Size> fixingDays = boost::none,
67 boost::optional<Size> rateCutoff = boost::none, boost::optional<bool> isAveraged = boost::none,
68 boost::optional<bool> flatIncludeSpread = boost::none, boost::optional<Period> flatLookback = boost::none,
69 boost::optional<Size> flatFixingDays = boost::none, boost::optional<Size> flatRateCutoff = boost::none,
70 boost::optional<bool> flatIsAveraged = boost::none, const bool telescopicValueDates = false);
71 //! \name RateHelper interface
72 //@{
73 Real impliedQuote() const override;
74 void setTermStructure(YieldTermStructure*) override;
75 //@}
76 //! \name inspectors
77 //@{
78 QuantLib::ext::shared_ptr<CrossCcyBasisSwap> swap() const { return swap_; }
79 //@}
80 //! \name Visitability
81 //@{
82 void accept(AcyclicVisitor&) override;
83 //@}
84
85protected:
86 void initializeDates() override;
87
88 Handle<Quote> spotFX_;
91 Period swapTenor_;
92 BusinessDayConvention rollConvention_;
93 QuantLib::ext::shared_ptr<QuantLib::IborIndex> flatIndex_;
94 QuantLib::ext::shared_ptr<QuantLib::IborIndex> spreadIndex_;
95 Handle<YieldTermStructure> flatDiscountCurve_;
96 Handle<YieldTermStructure> spreadDiscountCurve_;
97 bool eom_;
99 QuantLib::Period flatTenor_;
100 QuantLib::Period spreadTenor_;
106 std::vector<Natural> spotFXSettleDaysVec_;
107 std::vector<Calendar> spotFXSettleCalendarVec_;
108
111 // OIS only
112 boost::optional<bool> includeSpread_;
113 boost::optional<QuantLib::Period> lookback_;
114 boost::optional<QuantLib::Size> fixingDays_;
115 boost::optional<Size> rateCutoff_;
116 boost::optional<bool> isAveraged_;
117 boost::optional<bool> flatIncludeSpread_;
118 boost::optional<QuantLib::Period> flatLookback_;
119 boost::optional<QuantLib::Size> flatFixingDays_;
120 boost::optional<Size> flatRateCutoff_;
121 boost::optional<bool> flatIsAveraged_;
122
125 QuantLib::ext::shared_ptr<CrossCcyBasisSwap> swap_;
126
127 RelinkableHandle<YieldTermStructure> termStructureHandle_;
128 RelinkableHandle<YieldTermStructure> flatDiscountRLH_;
129 RelinkableHandle<YieldTermStructure> spreadDiscountRLH_;
130
132};
133} // namespace QuantExt
134
135#endif
Cross Ccy Basis Swap Rate Helper.
RelinkableHandle< YieldTermStructure > spreadDiscountRLH_
void setTermStructure(YieldTermStructure *) override
RelinkableHandle< YieldTermStructure > termStructureHandle_
boost::optional< QuantLib::Size > fixingDays_
boost::optional< QuantLib::Size > flatFixingDays_
boost::optional< QuantLib::Period > lookback_
RelinkableHandle< YieldTermStructure > flatDiscountRLH_
void accept(AcyclicVisitor &) override
QuantLib::ext::shared_ptr< QuantLib::IborIndex > spreadIndex_
Handle< YieldTermStructure > spreadDiscountCurve_
QuantLib::ext::shared_ptr< CrossCcyBasisSwap > swap_
boost::optional< QuantLib::Period > flatLookback_
QuantLib::ext::shared_ptr< QuantLib::IborIndex > flatIndex_
Handle< YieldTermStructure > flatDiscountCurve_
QuantLib::ext::shared_ptr< CrossCcyBasisSwap > swap() const
std::vector< Calendar > spotFXSettleCalendarVec_
Cross currency basis swap instrument.