Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossccybasismtmresetswap.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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 crossccybasismtmresetswap.hpp
20 \brief Cross currency basis swap instrument with MTM reset
21 \ingroup instruments
22*/
23
24#ifndef quantext_cross_ccy_basis_mtmreset_swap_hpp
25#define quantext_cross_ccy_basis_mtmreset_swap_hpp
26
27#include <ql/indexes/iborindex.hpp>
28#include <ql/time/schedule.hpp>
29
32
33namespace QuantExt {
34
35//! Cross currency basis MtM resettable swap
36/*! The foreign leg holds the pay currency cashflows and domestic leg holds
37 the receive currency cashflows. The notional resets are applied to the
38 domestic leg.
39
40 \ingroup instruments
41*/
43public:
44 class arguments;
45 class results;
46 //! \name Constructors
47 //@{
48 /*! First leg holds the pay currency cashflows and the second leg
49 holds the receive currency cashflows.
50 */
52 Real foreignNominal, const Currency& foreignCurrency, const Schedule& foreignSchedule,
53 const QuantLib::ext::shared_ptr<IborIndex>& foreignIndex, Spread foreignSpread, const Currency& domesticCurrency,
54 const Schedule& domesticSchedule, const QuantLib::ext::shared_ptr<IborIndex>& domesticIndex, Spread domesticSpread,
55 const QuantLib::ext::shared_ptr<FxIndex>& fxIdx, bool receiveDomestic = true, Size foreignPaymentLag = 0,
56 Size recPaymentLag = 0, boost::optional<bool> foreignIncludeSpread = boost::none,
57 boost::optional<Period> foreignLookback = boost::none, boost::optional<Size> foreignFixingDays = boost::none,
58 boost::optional<Size> foreignRateCutoff = boost::none, boost::optional<bool> foreignIsAveraged = boost::none,
59 boost::optional<bool> domesticIncludeSpread = boost::none,
60 boost::optional<Period> domesticLookback = boost::none, boost::optional<Size> domesticFixingDays = boost::none,
61 boost::optional<Size> domesticRateCutoff = boost::none, boost::optional<bool> domesticIsAveraged = boost::none,
62 const bool telescopicValueDates = false,
63 bool fairSpreadLegIsForeign = true);
64 //@}
65 //! \name Instrument interface
66 //@{
67 void setupArguments(PricingEngine::arguments* args) const override;
68 void fetchResults(const PricingEngine::results*) const override;
69 //@}
70 //! \name Inspectors
71 //@{
72 Real foreignNominal() const { return foreignNominal_; }
73 const Currency& foreignCurrency() const { return foreignCurrency_; }
74 const Schedule& foreignSchedule() const { return foreignSchedule_; }
75 const QuantLib::ext::shared_ptr<IborIndex>& foreignIndex() const { return foreignIndex_; }
76 Spread foreignSpread() const { return foreignSpread_; }
77
78 const Currency& domesticCurrency() const { return domesticCurrency_; }
79 const Schedule& domesticSchedule() const { return domesticSchedule_; }
80 const QuantLib::ext::shared_ptr<IborIndex>& domesticIndex() const { return domesticIndex_; }
81 Spread domesticSpread() const { return domesticSpread_; }
82 //@}
83
84 //! \name Additional interface
85 //@{
86 Spread fairForeignSpread() const {
87 calculate();
88 QL_REQUIRE(fairForeignSpread_ != Null<Real>(), "Fair foreign spread is not available");
89 return fairForeignSpread_;
90 }
91 Spread fairDomesticSpread() const {
92 calculate();
93 QL_REQUIRE(fairDomesticSpread_ != Null<Real>(), "Fair domestic spread is not available");
95 }
96 Spread fairSpread() const {
98 return fairForeignSpread();
99 else
100 return fairDomesticSpread();
101 }
102 //@}
103
104protected:
105 //! \name Instrument interface
106 //@{
107 void setupExpired() const override;
108 //@}
109
110private:
111 void initialize();
112
116 QuantLib::ext::shared_ptr<IborIndex> foreignIndex_;
118
121 QuantLib::ext::shared_ptr<IborIndex> domesticIndex_;
123
124 QuantLib::ext::shared_ptr<FxIndex> fxIndex_;
126
129 // OIS only
130 boost::optional<bool> foreignIncludeSpread_;
131 boost::optional<QuantLib::Period> foreignLookback_;
132 boost::optional<QuantLib::Size> foreignFixingDays_;
133 boost::optional<Size> foreignRateCutoff_;
134 boost::optional<bool> foreignIsAveraged_;
135 boost::optional<bool> domesticIncludeSpread_;
136 boost::optional<QuantLib::Period> domesticLookback_;
137 boost::optional<QuantLib::Size> domesticFixingDays_;
138 boost::optional<Size> domesticRateCutoff_;
139 boost::optional<bool> domesticIsAveraged_;
142
143 mutable Spread fairForeignSpread_;
144 mutable Spread fairDomesticSpread_;
145};
146
147//! \ingroup instruments
149public:
152 void validate() const override;
153};
154
155//! \ingroup instruments
157public:
160 void reset() override;
161};
162} // namespace QuantExt
163
164#endif
Cross currency basis MtM resettable swap.
boost::optional< QuantLib::Period > foreignLookback_
const QuantLib::ext::shared_ptr< IborIndex > & foreignIndex() const
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
const QuantLib::ext::shared_ptr< IborIndex > & domesticIndex() const
boost::optional< QuantLib::Period > domesticLookback_
QuantLib::ext::shared_ptr< IborIndex > foreignIndex_
boost::optional< QuantLib::Size > domesticFixingDays_
void setupArguments(PricingEngine::arguments *args) const override
void fetchResults(const PricingEngine::results *) const override
boost::optional< QuantLib::Size > foreignFixingDays_
QuantLib::ext::shared_ptr< IborIndex > domesticIndex_
Cross currency swap.
Swap instrument with legs involving two currencies.
FX index class.