QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
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 Frequency paymentFrequency = NoFrequency,
51 Integer paymentLag = 0);
52
53 void initializeDates() override;
56
62 ext::shared_ptr<IborIndex> baseCcyIdx_;
63 ext::shared_ptr<IborIndex> quoteCcyIdx_;
69
72
75
77 };
78
79 //! Rate helper for bootstrapping over constant-notional cross-currency basis swaps
80 /*!
81 Unlike marked-to-market cross currency swaps, both notionals
82 expressed in base and quote currency remain constant throughout
83 the lifetime of the swap.
84
85 Note on used conventions. Consider a currency pair EUR-USD.
86 EUR is the base currency, while USD is the quote currency.
87 The quote currency indicates the amount to be paid in that
88 currency for one unit of base currency.
89 Hence, for a cross currency swap we define a base currency
90 leg and a quote currency leg. The parameters of the instrument,
91 e.g. collateral currency, basis, resetting or constant notional
92 legs are defined relative to what base and quote currencies are.
93 For example, in case of EUR-USD basis swaps the collateral is paid
94 in quote currency (USD), the basis is given on the base currency
95 leg (EUR), etc.
96
97 For more details see:
98 N. Moreni, A. Pallavicini (2015)
99 FX Modelling in Collateralized Markets: foreign measures, basis curves
100 and pricing formulae.
101 */
103 public:
105 const Handle<Quote>& basis,
106 const Period& tenor,
107 Natural fixingDays,
108 const Calendar& calendar,
109 BusinessDayConvention convention,
110 bool endOfMonth,
111 const ext::shared_ptr<IborIndex>& baseCurrencyIndex,
112 const ext::shared_ptr<IborIndex>& quoteCurrencyIndex,
113 const Handle<YieldTermStructure>& collateralCurve,
114 bool isFxBaseCurrencyCollateralCurrency,
115 bool isBasisOnFxBaseCurrencyLeg,
116 Frequency paymentFrequency = NoFrequency,
117 Integer paymentLag = 0);
118 //! \name RateHelper interface
119 //@{
120 Real impliedQuote() const override;
121 //@}
122 //! \name Visitability
123 //@{
124 void accept(AcyclicVisitor&) override;
125 //@}
126 };
127
128
129 //! Rate helper for bootstrapping over market-to-market cross-currency basis swaps
130 /*!
131 Helper for a cross currency swap with resetting notional.
132 This means that at each interest payment the notional on the MtM
133 leg is being reset to reflect the changes in the FX rate - reducing
134 the counterparty and FX risk of the structure.
135
136 For more details see:
137 N. Moreni, A. Pallavicini (2015)
138 FX Modelling in Collateralized Markets: foreign measures, basis curves
139 and pricing formulae.
140 */
142 public:
144 const Period& tenor,
145 Natural fixingDays,
146 const Calendar& calendar,
147 BusinessDayConvention convention,
148 bool endOfMonth,
149 const ext::shared_ptr<IborIndex>& baseCurrencyIndex,
150 const ext::shared_ptr<IborIndex>& quoteCurrencyIndex,
151 const Handle<YieldTermStructure>& collateralCurve,
152 bool isFxBaseCurrencyCollateralCurrency,
153 bool isBasisOnFxBaseCurrencyLeg,
154 bool isFxBaseCurrencyLegResettable,
155 Frequency paymentFrequency = NoFrequency,
156 Integer paymentLag = 0);
157 //! \name RateHelper interface
158 //@{
159 Real impliedQuote() const override;
160 //@}
161 //! \name Visitability
162 //@{
163 void accept(AcyclicVisitor&) override;
164 //@}
165 private:
167 };
168}
169
170#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
Concrete date class.
Definition: date.hpp:125
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.
Frequency
Frequency of events.
Definition: frequency.hpp:37
BusinessDayConvention
Business Day conventions.
@ NoFrequency
null frequency
Definition: frequency.hpp:37
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Definition: any.hpp:37
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
deposit, FRA, futures, and various swap rate helpers