QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
equitytotalreturnswap.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2023 Marcin Rybacki
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18 */
19
20/*! \file equitytotalreturnswap.hpp
21 \brief Equity total return swap
22 */
23
24#ifndef quantlib_equitytotalreturnswap_hpp
25#define quantlib_equitytotalreturnswap_hpp
26
28#include <ql/time/schedule.hpp>
29#include <ql/time/calendar.hpp>
31
32namespace QuantLib {
33 class InterestRateIndex;
34 class IborIndex;
35 class OvernightIndex;
36 class EquityIndex;
37
38 //! Equity total return swap
39 /*! It exchanges a total return of an equity index for a set of
40 floating cash flows linked to either Ibor or overnight index.
41 The equity leg future value (FV) is:
42 \f[
43 FV^{equity} = N \left[ \frac{I(t, T_{M})}{I(T_{0})} -1 \right],
44 \f]
45 where \f$ N \f$ is the swap notional, \f$ I(T_{0}) \f$ is the
46 value of the equity index on the start date and \f$ I(t, T_{M}) \f$
47 is the value of the equity index at maturity.
48 The floating leg payments are linked to either an Ibor or
49 an overnight index. In case of an overnight index the interest
50 rate fixings are compounded over the accrual period.
51
52 Swap type (payer of receiver) refers to the equity leg.
53 */
54 class EquityTotalReturnSwap : public Swap {
55 public:
59 ext::shared_ptr<EquityIndex> equityIndex,
60 const ext::shared_ptr<IborIndex>& interestRateIndex,
63 Real gearing = 1.0,
67
71 ext::shared_ptr<EquityIndex> equityIndex,
72 const ext::shared_ptr<OvernightIndex>& interestRateIndex,
75 Real gearing = 1.0,
79
80 //! \name Inspectors
81 //@{
82 Type type() const { return type_; }
83 Real nominal() const { return nominal_; }
84 const ext::shared_ptr<EquityIndex>& equityIndex() const { return equityIndex_; }
85 const ext::shared_ptr<InterestRateIndex>& interestRateIndex() const { return interestRateIndex_; }
86 const Schedule& schedule() const { return schedule_; }
87 const DayCounter& dayCounter() const { return dayCounter_; }
88 Rate margin() const { return margin_; }
89 Real gearing() const { return gearing_; }
90 const Calendar& paymentCalendar() const { return paymentCalendar_; }
93
94 const Leg& equityLeg() const;
95 const Leg& interestRateLeg() const;
96 //@}
97
98 //! \name Results
99 //@{
100 Real equityLegNPV() const;
101 Real interestRateLegNPV() const;
102 Real fairMargin() const;
103 //@}
104
105 private:
106 EquityTotalReturnSwap(ext::shared_ptr<EquityIndex> equityIndex,
107 ext::shared_ptr<InterestRateIndex> interestRateIndex,
108 Type type,
112 Rate margin,
113 Real gearing = 1.0,
117
118 ext::shared_ptr<EquityIndex> equityIndex_;
119 ext::shared_ptr<InterestRateIndex> interestRateIndex_;
129 };
130}
131
132#endif
calendar class
calendar class
Definition: calendar.hpp:61
day counter class
Definition: daycounter.hpp:44
ext::shared_ptr< EquityIndex > equityIndex_
BusinessDayConvention paymentConvention() const
const DayCounter & dayCounter() const
ext::shared_ptr< InterestRateIndex > interestRateIndex_
const ext::shared_ptr< EquityIndex > & equityIndex() const
const ext::shared_ptr< InterestRateIndex > & interestRateIndex() const
const Calendar & paymentCalendar() const
Payment schedule.
Definition: schedule.hpp:40
Interest rate swap.
Definition: swap.hpp:41
day counter class
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
date schedule
Interest rate swap.