Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossccyfixfloatmtmresetswap.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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 crossccyfixfloatmtmresetswap.hpp
20 \brief Cross currency fix float swap instrument with MTM reset
21 \ingroup instruments
22*/
23
24#ifndef quantext_cross_ccy_fix_float_mtmreset_swap_hpp
25#define quantext_cross_ccy_fix_float_mtmreset_swap_hpp
26
27#include <ql/indexes/iborindex.hpp>
28#include <ql/time/schedule.hpp>
29
32
33namespace QuantExt {
34
35//! Cross currency fix float 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 */
51 CrossCcyFixFloatMtMResetSwap(QuantLib::Real nominal, const QuantLib::Currency& fixedCurrency, const QuantLib::Schedule& fixedSchedule,
52 QuantLib::Rate fixedRate, const QuantLib::DayCounter& fixedDayCount, const QuantLib::BusinessDayConvention& fixedPaymentBdc,
53 QuantLib::Natural fixedPaymentLag, const QuantLib::Calendar& fixedPaymentCalendar, const QuantLib::Currency& floatCurrency,
54 const QuantLib::Schedule& floatSchedule, const QuantLib::ext::shared_ptr<QuantLib::IborIndex>& floatIndex, QuantLib::Spread floatSpread,
55 const QuantLib::BusinessDayConvention& floatPaymentBdc, QuantLib::Natural floatPaymentLag, const QuantLib::Calendar& floatPaymentCalendar,
56 const QuantLib::ext::shared_ptr<FxIndex>& fxIdx, bool resetsOnFloatLeg = true, bool receiveFixed = true);
57
58 //@}
59 //! \name Instrument interface
60 //@{
61 void setupArguments(PricingEngine::arguments* args) const override;
62 void fetchResults(const PricingEngine::results*) const override;
63 //@}
64 //! \name Inspectors
65 //@{
66 QuantLib::Real nominal() const { return nominal_; }
67 const QuantLib::Currency& fixedCurrency() const { return fixedCurrency_; }
68 const QuantLib::Schedule& fixedSchedule() const { return fixedSchedule_; }
69 QuantLib::Rate fixedRate() const { return fixedRate_; }
70 const QuantLib::DayCounter& fixedDayCount() const { return fixedDayCount_; }
71 const QuantLib::BusinessDayConvention& fixedPaymentBdc() const { return fixedPaymentBdc_; }
72 QuantLib::Natural fixedPaymentLag() const { return fixedPaymentLag_; }
73 const QuantLib::Calendar& fixedPaymentCalendar() const { return fixedPaymentCalendar_; }
74
75 const QuantLib::Currency& floatCurrency() const { return floatCurrency_; }
76 const QuantLib::Schedule& floatSchedule() const { return floatSchedule_; }
77 const QuantLib::ext::shared_ptr<QuantLib::IborIndex>& floatIndex() const { return floatIndex_; }
78 QuantLib::Spread floatSpread() const { return floatSpread_; }
79 //@}
80
81 //! \name Additional interface
82 //@{
83 QuantLib::Rate fairFixedRate() const {
84 calculate();
85 QL_REQUIRE(fairFixedRate_ != QuantLib::Null<QuantLib::Real>(), "Fair fixed rate is not available");
86 return fairFixedRate_;
87 }
88
89 QuantLib::Spread fairSpread() const {
90 calculate();
91 QL_REQUIRE(fairSpread_ != QuantLib::Null<QuantLib::Real>(), "Fair spread is not available");
92 return fairSpread_;
93 }
94 //@}
95
96protected:
97 //! \name Instrument interface
98 //@{
99 void setupExpired() const override;
100 //@}
101
102private:
103 void initialize();
104
105 //! nominal of non resetting leg
107 QuantLib::Currency fixedCurrency_;
108 QuantLib::Schedule fixedSchedule_;
109 QuantLib::Rate fixedRate_;
110 QuantLib::DayCounter fixedDayCount_;
111 QuantLib::BusinessDayConvention fixedPaymentBdc_;
112 QuantLib::Natural fixedPaymentLag_;
113 QuantLib::Calendar fixedPaymentCalendar_;
114
115 QuantLib::Currency floatCurrency_;
116 QuantLib::Schedule floatSchedule_;
117 QuantLib::ext::shared_ptr<QuantLib::IborIndex> floatIndex_;
118 QuantLib::Spread floatSpread_;
119 QuantLib::BusinessDayConvention floatPaymentBdc_;
120 QuantLib::Natural floatPaymentLag_;
121 QuantLib::Calendar floatPaymentCalendar_;
122
123 QuantLib::ext::shared_ptr<FxIndex> fxIndex_;
126
127 mutable QuantLib::Spread fairSpread_;
128 mutable QuantLib::Rate fairFixedRate_;
129};
130
131//! \ingroup instruments
133public:
134 QuantLib::Spread spread;
135 QuantLib::Rate fixedRate;
136 void validate() const override;
137};
138
139//! \ingroup instruments
141public:
142 QuantLib::Spread fairSpread;
143 QuantLib::Rate fairFixedRate;
144 void reset() override;
145};
146} // namespace QuantExt
147
148#endif
Cross currency fix float MtM resettable swap.
QuantLib::ext::shared_ptr< QuantLib::IborIndex > floatIndex_
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
const QuantLib::Currency & floatCurrency() const
const QuantLib::Schedule & fixedSchedule() const
const QuantLib::Calendar & fixedPaymentCalendar() const
const QuantLib::DayCounter & fixedDayCount() const
const QuantLib::BusinessDayConvention & fixedPaymentBdc() const
void setupArguments(PricingEngine::arguments *args) const override
void fetchResults(const PricingEngine::results *) const override
const QuantLib::Schedule & floatSchedule() const
const QuantLib::ext::shared_ptr< QuantLib::IborIndex > & floatIndex() const
const QuantLib::Currency & fixedCurrency() const
Cross currency swap.
Swap instrument with legs involving two currencies.
FX index class.