QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
arithmeticaverageois.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) 2016 Stefano Fondi
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 arithmeticaverageois.hpp
21 \brief Overnight index swap paying arithmetic average of overnight vs. fixed
22*/
23
24#ifndef quantlib_arithmetic_average_ois_hpp
25#define quantlib_arithmetic_average_ois_hpp
26
29
30namespace QuantLib {
31
32 class Schedule;
33 class OvernightIndex;
34
35 //! Arithemtic Average OIS: fix vs arithmetic average of overnight rate
36 class ArithmeticAverageOIS : public Swap {
37 public:
40 Schedule fixedLegSchedule,
42 DayCounter fixedDC,
43 ext::shared_ptr<OvernightIndex> overnightIndex,
44 Schedule overnightLegSchedule,
45 Spread spread = 0.0,
46 Real meanReversionSpeed = 0.03,
47 Real volatility = 0.00, // NO convexity adjustment by default
48 bool byApprox = false); // TRUE to use Katsumi Takada approximation
50 std::vector<Real> nominals,
51 Schedule fixedLegSchedule,
53 DayCounter fixedDC,
54 ext::shared_ptr<OvernightIndex> overnightIndex,
55 Schedule overnightLegSchedule,
56 Spread spread = 0.0,
57 Real meanReversionSpeed = 0.03,
58 Real volatility = 0.00, // NO convexity adjustment by default
59 bool byApprox = false); // TRUE to use Katsumi Takada approximation
60 //! \name Inspectors
61 //@{
62 Type type() const { return type_; }
63 Real nominal() const;
64 std::vector<Real> nominals() const { return nominals_; }
65
66 //const Schedule& schedule() { return schedule_; }
69
70 Rate fixedRate() const { return fixedRate_; }
71 const DayCounter& fixedDayCount() { return fixedDC_; }
72
73 const ext::shared_ptr<OvernightIndex>& overnightIndex() { return overnightIndex_; }
74 Spread spread() const { return spread_; }
75
76 const Leg& fixedLeg() const { return legs_[0]; }
77 const Leg& overnightLeg() const { return legs_[1]; }
78 //@}
79
80 //! \name Results
81 //@{
82 Real fixedLegBPS() const;
83 Real fixedLegNPV() const;
84 Real fairRate() const;
85
86 Real overnightLegBPS() const;
87 Real overnightLegNPV() const;
88 Spread fairSpread() const;
89 //@}
90 private:
91 void initialize(Schedule fixedLegSchedule, Schedule overnightLegSchedule);
93 std::vector<Real> nominals_;
94
97 //Schedule schedule_;
98
101
102 ext::shared_ptr<OvernightIndex> overnightIndex_;
104
108 };
109
110
111 // inline
112
114 QL_REQUIRE(nominals_.size()==1, "varying nominals");
115 return nominals_[0];
116 }
117
118}
119
120#endif
Arithemtic Average OIS: fix vs arithmetic average of overnight rate.
ext::shared_ptr< OvernightIndex > overnightIndex_
void initialize(Schedule fixedLegSchedule, Schedule overnightLegSchedule)
std::vector< Real > nominals() const
const ext::shared_ptr< OvernightIndex > & overnightIndex()
day counter class
Definition: daycounter.hpp:44
Payment schedule.
Definition: schedule.hpp:40
Interest rate swap.
Definition: swap.hpp:41
std::vector< Leg > legs_
Definition: swap.hpp:133
day counter class
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
Frequency
Frequency of events.
Definition: frequency.hpp:37
QL_REAL Real
real number
Definition: types.hpp:50
Real Spread
spreads on interest rates
Definition: types.hpp:74
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
Interest rate swap.