Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossccybasisswap.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 crossccybasisswap.hpp
20 \brief Cross currency basis swap instrument
21
22 \ingroup instruments
23*/
24
25#ifndef quantext_cross_ccy_basis_swap_hpp
26#define quantext_cross_ccy_basis_swap_hpp
27
28#include <ql/indexes/iborindex.hpp>
29#include <ql/time/schedule.hpp>
30
32
33namespace QuantExt {
34
35//! Cross currency basis swap
36/*! The first leg holds the pay currency cashflows and second leg holds
37 the receive currency cashflows.
38
39 \ingroup instruments
40*/
42public:
43 class arguments;
44 class results;
45 //! \name Constructors
46 //@{
47 /*! First leg holds the pay currency cashflows and the second leg
48 holds the receive currency cashflows.
49 */
51 Real payNominal, const Currency& payCurrency, const Schedule& paySchedule,
52 const QuantLib::ext::shared_ptr<IborIndex>& payIndex, Spread paySpread, Real payGearing, Real recNominal,
53 const Currency& recCurrency, const Schedule& recSchedule, const QuantLib::ext::shared_ptr<IborIndex>& recIndex,
54 Spread recSpread, Real recGearing, Size payPaymentLag = 0, Size recPaymentLag = 0,
55 boost::optional<bool> payIncludeSpread = boost::none, boost::optional<Period> payLookback = boost::none,
56 boost::optional<Size> payFixingDays = boost::none, boost::optional<Size> payRateCutoff = boost::none,
57 boost::optional<bool> payIsAveraged = boost::none, boost::optional<bool> recIncludeSpread = boost::none,
58 boost::optional<Period> recLookback = boost::none, boost::optional<Size> recFixingDays = boost::none,
59 boost::optional<Size> recRateCutoff = boost::none, boost::optional<bool> recIsAveraged = boost::none,
60 const bool telescopicValueDates = false);
61 //@}
62 //! \name Instrument interface
63 //@{
64 void setupArguments(PricingEngine::arguments* args) const override;
65 void fetchResults(const PricingEngine::results*) const override;
66 //@}
67 //! \name Inspectors
68 //@{
69 Real payNominal() const { return payNominal_; }
70 const Currency& payCurrency() const { return payCurrency_; }
71 const Schedule& paySchedule() const { return paySchedule_; }
72 const QuantLib::ext::shared_ptr<IborIndex>& payIndex() const { return payIndex_; }
73 Spread paySpread() const { return paySpread_; }
74 Real payGearing() const { return payGearing_; }
75
76 Real recNominal() const { return recNominal_; }
77 const Currency& recCurrency() const { return recCurrency_; }
78 const Schedule& recSchedule() const { return recSchedule_; }
79 const QuantLib::ext::shared_ptr<IborIndex>& recIndex() const { return recIndex_; }
80 Spread recSpread() const { return recSpread_; }
81 Real recGearing() const { return recGearing_; }
82 //@}
83
84 //! \name Additional interface
85 //@{
86 Spread fairPaySpread() const {
87 calculate();
88 QL_REQUIRE(fairPaySpread_ != Null<Real>(), "Fair pay spread is not available");
89 return fairPaySpread_;
90 }
91 Spread fairRecSpread() const {
92 calculate();
93 QL_REQUIRE(fairRecSpread_ != Null<Real>(), "Fair pay spread is not available");
94 return fairRecSpread_;
95 }
96 //@}
97
98protected:
99 //! \name Instrument interface
100 //@{
101 void setupExpired() const override;
102 //@}
103
104private:
105 void initialize();
106
108 Currency payCurrency_;
109 Schedule paySchedule_;
110 QuantLib::ext::shared_ptr<IborIndex> payIndex_;
113
115 Currency recCurrency_;
116 Schedule recSchedule_;
117 QuantLib::ext::shared_ptr<IborIndex> recIndex_;
120
123 // OIS only
124 boost::optional<bool> payIncludeSpread_;
125 boost::optional<QuantLib::Period> payLookback_;
126 boost::optional<QuantLib::Size> payFixingDays_;
127 boost::optional<Size> payRateCutoff_;
128 boost::optional<bool> payIsAveraged_;
129 boost::optional<bool> recIncludeSpread_;
130 boost::optional<QuantLib::Period> recLookback_;
131 boost::optional<QuantLib::Size> recFixingDays_;
132 boost::optional<Size> recRateCutoff_;
133 boost::optional<bool> recIsAveraged_;
135
136 mutable Spread fairPaySpread_;
137 mutable Spread fairRecSpread_;
138};
139
140//! \ingroup instruments
142public:
143 Spread paySpread;
144 Spread recSpread;
145 void validate() const override;
146};
147
148//! \ingroup instruments
150public:
153 void reset() override;
154};
155} // namespace QuantExt
156
157#endif
Cross currency basis swap.
boost::optional< QuantLib::Period > payLookback_
const Currency & recCurrency() const
QuantLib::ext::shared_ptr< IborIndex > payIndex_
const QuantLib::ext::shared_ptr< IborIndex > & recIndex() const
QuantLib::ext::shared_ptr< IborIndex > recIndex_
boost::optional< bool > payIsAveraged_
const Schedule & recSchedule() const
boost::optional< Size > recRateCutoff_
boost::optional< bool > payIncludeSpread_
boost::optional< bool > recIsAveraged_
boost::optional< QuantLib::Size > payFixingDays_
boost::optional< QuantLib::Size > recFixingDays_
const Currency & payCurrency() const
const Schedule & paySchedule() const
void setupArguments(PricingEngine::arguments *args) const override
boost::optional< Size > payRateCutoff_
const QuantLib::ext::shared_ptr< IborIndex > & payIndex() const
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
boost::optional< QuantLib::Period > recLookback_
boost::optional< bool > recIncludeSpread_
Cross currency swap.
Swap instrument with legs involving two currencies.