QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
equitytotalreturnswap.hpp
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
24#ifndef quantlib_equitytotalreturnswap_hpp
25#define quantlib_equitytotalreturnswap_hpp
26
27#include <ql/instruments/swap.hpp>
28#include <ql/time/schedule.hpp>
29#include <ql/time/calendar.hpp>
30#include <ql/time/daycounter.hpp>
31
32namespace QuantLib {
33 class InterestRateIndex;
34 class IborIndex;
35 class OvernightIndex;
36 class EquityIndex;
37
39
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
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;
97
99
100 Real equityLegNPV() const;
101 Real interestRateLegNPV() const;
102 Real fairMargin() const;
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
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
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