Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
basistwoswaphelper.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 basistwoswaphelper.hpp
20 \brief Libor basis swap helper as two swaps
21 \ingroup termstructures
22*/
23
24#ifndef quantext_basis_two_swap_helper_hpp
25#define quantext_basis_two_swap_helper_hpp
26
27#include <ql/termstructures/yield/ratehelpers.hpp>
28
29namespace QuantExt {
30using namespace QuantLib;
31
32//! Basis Two Swap Helper
33/*! Rate helper for bootstrapping using Libor tenor basis as the
34 * difference between the fixed rate on two swaps
35
36 \ingroup termstructures
37 */
39public:
40 BasisTwoSwapHelper(const Handle<Quote>& spread, const Period& swapTenor, const Calendar& calendar,
41 // Long tenor swap
42 Frequency longFixedFrequency, BusinessDayConvention longFixedConvention,
43 const DayCounter& longFixedDayCount, const QuantLib::ext::shared_ptr<IborIndex>& longIndex,
44 // Short tenor swap
45 Frequency shortFixedFrequency, BusinessDayConvention shortFixedConvention,
46 const DayCounter& shortFixedDayCount, const QuantLib::ext::shared_ptr<IborIndex>& shortIndex,
47 bool longMinusShort = true,
48 // Discount curve
49 const Handle<YieldTermStructure>& discountingCurve = Handle<YieldTermStructure>());
50
51 //! \name RateHelper interface
52 //@{
53 Real impliedQuote() const override;
54 void setTermStructure(YieldTermStructure*) override;
55 //@}
56 //! \name BasisTwoSwapHelper inspectors
57 //@{
58 QuantLib::ext::shared_ptr<VanillaSwap> longSwap() const;
59 QuantLib::ext::shared_ptr<VanillaSwap> shortSwap() const;
60 //@}
61 //! \name Visitability
62 //@{
63 void accept(AcyclicVisitor&) override;
64 //@}
65
66protected:
67 void initializeDates() override;
68 Period swapTenor_;
69 Calendar calendar_;
70 // Long tenor swap
72 BusinessDayConvention longFixedConvention_;
74 QuantLib::ext::shared_ptr<IborIndex> longIndex_;
75 // Short tenor swap
77 BusinessDayConvention shortFixedConvention_;
79 QuantLib::ext::shared_ptr<IborIndex> shortIndex_;
81
82 QuantLib::ext::shared_ptr<VanillaSwap> longSwap_;
83 QuantLib::ext::shared_ptr<VanillaSwap> shortSwap_;
84
85 RelinkableHandle<YieldTermStructure> termStructureHandle_;
86 Handle<YieldTermStructure> discountHandle_;
87 RelinkableHandle<YieldTermStructure> discountRelinkableHandle_;
88};
89
90inline QuantLib::ext::shared_ptr<VanillaSwap> BasisTwoSwapHelper::shortSwap() const { return shortSwap_; }
91
92inline QuantLib::ext::shared_ptr<VanillaSwap> BasisTwoSwapHelper::longSwap() const { return longSwap_; }
93} // namespace QuantExt
94
95#endif
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
void setTermStructure(YieldTermStructure *) override
RelinkableHandle< YieldTermStructure > termStructureHandle_
QuantLib::ext::shared_ptr< VanillaSwap > shortSwap() const
QuantLib::ext::shared_ptr< VanillaSwap > longSwap() const
BusinessDayConvention longFixedConvention_
QuantLib::ext::shared_ptr< VanillaSwap > longSwap_
Handle< YieldTermStructure > discountHandle_
void accept(AcyclicVisitor &) override
QuantLib::ext::shared_ptr< VanillaSwap > shortSwap_
BusinessDayConvention shortFixedConvention_
Real impliedQuote() const override
QuantLib::ext::shared_ptr< IborIndex > shortIndex_
QuantLib::ext::shared_ptr< IborIndex > longIndex_