QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
crosscurrencyratehelpers.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2021 Marcin Rybacki
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file crosscurrencyratehelpers.hpp
21 \brief FX and cross currency basis swaps rate helpers
22*/
23
24#ifndef quantlib_crosscurrencyratehelpers_hpp
25#define quantlib_crosscurrencyratehelpers_hpp
26
28
29namespace QuantLib {
30
31 //! Base class for cross-currency basis swap rate helpers
33 public:
34 //! \name RateHelper interface
35 //@{
37 //@}
38 protected:
40 const Period& tenor,
41 Natural fixingDays,
42 Calendar calendar,
43 BusinessDayConvention convention,
44 bool endOfMonth,
45 ext::shared_ptr<IborIndex> baseCurrencyIndex,
46 ext::shared_ptr<IborIndex> quoteCurrencyIndex,
47 Handle<YieldTermStructure> collateralCurve,
48 bool isFxBaseCurrencyCollateralCurrency,
49 bool isBasisOnFxBaseCurrencyLeg);
50
51 void initializeDates() override;
54
60 ext::shared_ptr<IborIndex> baseCcyIdx_;
61 ext::shared_ptr<IborIndex> quoteCcyIdx_;
65
68
70 };
71
72 //! Rate helper for bootstrapping over constant-notional cross-currency basis swaps
73 /*!
74 Unlike marked-to-market cross currency swaps, both notionals
75 expressed in base and quote currency remain constant throughout
76 the lifetime of the swap.
77
78 Note on used conventions. Consider a currency pair EUR-USD.
79 EUR is the base currency, while USD is the quote currency.
80 The quote currency indicates the amount to be paid in that
81 currency for one unit of base currency.
82 Hence, for a cross currency swap we define a base currency
83 leg and a quote currency leg. The parameters of the instrument,
84 e.g. collateral currency, basis, resetting or constant notional
85 legs are defined relative to what base and quote currencies are.
86 For example, in case of EUR-USD basis swaps the collateral is paid
87 in quote currency (USD), the basis is given on the base currency
88 leg (EUR), etc.
89
90 For more details see:
91 N. Moreni, A. Pallavicini (2015)
92 FX Modelling in Collateralized Markets: foreign measures, basis curves
93 and pricing formulae.
94 */
96 public:
98 const Handle<Quote>& basis,
99 const Period& tenor,
100 Natural fixingDays,
101 const Calendar& calendar,
102 BusinessDayConvention convention,
103 bool endOfMonth,
104 const ext::shared_ptr<IborIndex>& baseCurrencyIndex,
105 const ext::shared_ptr<IborIndex>& quoteCurrencyIndex,
106 const Handle<YieldTermStructure>& collateralCurve,
107 bool isFxBaseCurrencyCollateralCurrency,
108 bool isBasisOnFxBaseCurrencyLeg);
109 //! \name RateHelper interface
110 //@{
111 Real impliedQuote() const override;
112 //@}
113 //! \name Visitability
114 //@{
115 void accept(AcyclicVisitor&) override;
116 //@}
117 };
118
119
120 //! Rate helper for bootstrapping over market-to-market cross-currency basis swaps
121 /*!
122 Helper for a cross currency swap with resetting notional.
123 This means that at each interest payment the notional on the MtM
124 leg is being reset to reflect the changes in the FX rate - reducing
125 the counterparty and FX risk of the structure.
126
127 For more details see:
128 N. Moreni, A. Pallavicini (2015)
129 FX Modelling in Collateralized Markets: foreign measures, basis curves
130 and pricing formulae.
131 */
133 public:
135 const Period& tenor,
136 Natural fixingDays,
137 const Calendar& calendar,
138 BusinessDayConvention convention,
139 bool endOfMonth,
140 const ext::shared_ptr<IborIndex>& baseCurrencyIndex,
141 const ext::shared_ptr<IborIndex>& quoteCurrencyIndex,
142 const Handle<YieldTermStructure>& collateralCurve,
143 bool isFxBaseCurrencyCollateralCurrency,
144 bool isBasisOnFxBaseCurrencyLeg,
145 bool isFxBaseCurrencyLegResettable);
146 //! \name RateHelper interface
147 //@{
148 Real impliedQuote() const override;
149 //@}
150 //! \name Visitability
151 //@{
152 void accept(AcyclicVisitor&) override;
153 //@}
154 private:
156 };
157}
158
159#endif
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
calendar class
Definition: calendar.hpp:61
Rate helper for bootstrapping over constant-notional cross-currency basis swaps.
Base class for cross-currency basis swap rate helpers.
void setTermStructure(YieldTermStructure *) override
RelinkableHandle< YieldTermStructure > termStructureHandle_
const Handle< YieldTermStructure > & baseCcyLegDiscountHandle() const
const Handle< YieldTermStructure > & quoteCcyLegDiscountHandle() const
Shared handle to an observable.
Definition: handle.hpp:41
Rate helper for bootstrapping over market-to-market cross-currency basis swaps.
Bootstrap helper with date schedule relative to global evaluation date.
Relinkable handle to an observable.
Definition: handle.hpp:117
Interest-rate term structure.
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
deposit, FRA, futures, and various swap rate helpers