Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossccyfixfloatswap.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 qle/instruments/crossccyfixfloatswap.hpp
20 \brief Cross currency fixed vs float swap instrument
21 \ingroup instruments
22*/
23
24#ifndef quantext_cross_ccy_fix_float_swap_hpp
25#define quantext_cross_ccy_fix_float_swap_hpp
26
27#include <ql/indexes/iborindex.hpp>
28#include <ql/time/schedule.hpp>
30
31namespace QuantExt {
32
33/*! Cross currency fixed vs float swap
34 \ingroup instruments
35*/
37public:
38 enum Type { Receiver = -1, Payer = 1 };
39 class arguments;
40 class results;
41
42 //! \name Constructors
43 //@{
44 //! Detailed constructor
45 CrossCcyFixFloatSwap(Type type, QuantLib::Real fixedNominal, const QuantLib::Currency& fixedCurrency,
46 const QuantLib::Schedule& fixedSchedule, QuantLib::Rate fixedRate,
47 const QuantLib::DayCounter& fixedDayCount, QuantLib::BusinessDayConvention fixedPaymentBdc,
48 QuantLib::Natural fixedPaymentLag, const QuantLib::Calendar& fixedPaymentCalendar,
49 QuantLib::Real floatNominal, const QuantLib::Currency& floatCurrency,
50 const QuantLib::Schedule& floatSchedule,
51 const QuantLib::ext::shared_ptr<QuantLib::IborIndex>& floatIndex, QuantLib::Spread floatSpread,
52 QuantLib::BusinessDayConvention floatPaymentBdc, QuantLib::Natural floatPaymentLag,
53 const QuantLib::Calendar& floatPaymentCalendar);
54 //@}
55
56 //! \name Instrument interface
57 //@{
59 void fetchResults(const QuantLib::PricingEngine::results* r) const override;
60 //@}
61
62 //! \name Inspectors
63 //@{
64 Type type() const { return type_; }
65
66 QuantLib::Real fixedNominal() const { return fixedNominal_; }
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 QuantLib::BusinessDayConvention fixedPaymentBdc() const { return fixedPaymentBdc_; }
72 QuantLib::Natural fixedPaymentLag() const { return fixedPaymentLag_; }
73 const QuantLib::Calendar& fixedPaymentCalendar() const { return fixedPaymentCalendar_; }
74
75 QuantLib::Real floatNominal() const { return floatNominal_; }
76 const QuantLib::Currency& floatCurrency() const { return floatCurrency_; }
77 const QuantLib::Schedule& floatSchedule() const { return floatSchedule_; }
78 const QuantLib::ext::shared_ptr<QuantLib::IborIndex>& floatIndex() const { return floatIndex_; }
79 QuantLib::Rate floatSpread() const { return floatSpread_; }
80 QuantLib::BusinessDayConvention floatPaymentBdc() const { return floatPaymentBdc_; }
81 QuantLib::Natural floatPaymentLag() const { return floatPaymentLag_; }
82 const QuantLib::Calendar& floatPaymentCalendar() const { return floatPaymentCalendar_; }
83 //@}
84
85 //! \name Additional interface
86 //@{
87 QuantLib::Rate fairFixedRate() const {
88 calculate();
89 QL_REQUIRE(fairFixedRate_ != QuantLib::Null<QuantLib::Real>(), "Fair fixed rate is not available");
90 return fairFixedRate_;
91 }
92
93 QuantLib::Spread fairSpread() const {
94 calculate();
95 QL_REQUIRE(fairSpread_ != QuantLib::Null<QuantLib::Real>(), "Fair spread is not available");
96 return fairSpread_;
97 }
98 //@}
99
100protected:
101 //! \name Instrument interface
102 //@{
103 void setupExpired() const override;
104 //@}
105
106private:
108
109 QuantLib::Real fixedNominal_;
110 QuantLib::Currency fixedCurrency_;
111 QuantLib::Schedule fixedSchedule_;
112 QuantLib::Rate fixedRate_;
113 QuantLib::DayCounter fixedDayCount_;
114 QuantLib::BusinessDayConvention fixedPaymentBdc_;
115 QuantLib::Natural fixedPaymentLag_;
116 QuantLib::Calendar fixedPaymentCalendar_;
117
118 QuantLib::Real floatNominal_;
119 QuantLib::Currency floatCurrency_;
120 QuantLib::Schedule floatSchedule_;
121 QuantLib::ext::shared_ptr<QuantLib::IborIndex> floatIndex_;
122 QuantLib::Spread floatSpread_;
123 QuantLib::BusinessDayConvention floatPaymentBdc_;
124 QuantLib::Natural floatPaymentLag_;
125 QuantLib::Calendar floatPaymentCalendar_;
126
127 mutable QuantLib::Rate fairFixedRate_;
128 mutable QuantLib::Spread fairSpread_;
129};
130
131//! \ingroup instruments
133public:
134 QuantLib::Rate fixedRate;
135 QuantLib::Spread spread;
136 void validate() const override;
137};
138
139//! \ingroup instruments
141public:
142 QuantLib::Rate fairFixedRate;
143 QuantLib::Spread fairSpread;
144 void reset() override;
145};
146
147} // namespace QuantExt
148
149#endif
QuantLib::ext::shared_ptr< QuantLib::IborIndex > floatIndex_
const QuantLib::Calendar & floatPaymentCalendar() const
const QuantLib::Currency & floatCurrency() const
const QuantLib::Schedule & fixedSchedule() const
QuantLib::Natural floatPaymentLag() const
const QuantLib::Calendar & fixedPaymentCalendar() const
const QuantLib::DayCounter & fixedDayCount() const
QuantLib::Rate fairFixedRate() const
void fetchResults(const QuantLib::PricingEngine::results *r) const override
QuantLib::Natural fixedPaymentLag() const
QuantLib::BusinessDayConvention floatPaymentBdc() const
QuantLib::BusinessDayConvention fixedPaymentBdc() const
void setupArguments(QuantLib::PricingEngine::arguments *a) const override
const QuantLib::Schedule & floatSchedule() const
QuantLib::BusinessDayConvention floatPaymentBdc_
const QuantLib::ext::shared_ptr< QuantLib::IborIndex > & floatIndex() const
const QuantLib::Currency & fixedCurrency() const
QuantLib::BusinessDayConvention fixedPaymentBdc_
QuantLib::Spread fairSpread() const
Cross currency swap.
Swap instrument with legs involving two currencies.