QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
arithmeticaverageois.hpp
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
24#ifndef quantlib_arithmetic_average_ois_hpp
25#define quantlib_arithmetic_average_ois_hpp
26
27#include <ql/instruments/swap.hpp>
28#include <ql/time/daycounter.hpp>
29
30namespace QuantLib {
31
32 class Schedule;
33 class OvernightIndex;
34
36 class ArithmeticAverageOIS : public Swap {
37 public:
40 const Schedule& fixedLegSchedule,
42 DayCounter fixedDC,
43 ext::shared_ptr<OvernightIndex> overnightIndex,
44 const 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 const Schedule& fixedLegSchedule,
53 DayCounter fixedDC,
54 ext::shared_ptr<OvernightIndex> overnightIndex,
55 const 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
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]; }
79
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;
90 private:
91 void initialize(const Schedule& fixedLegSchedule,
92 const Schedule& overnightLegSchedule);
94 std::vector<Real> nominals_;
95
98 //Schedule schedule_;
99
102
103 ext::shared_ptr<OvernightIndex> overnightIndex_;
105
109 };
110
111
112 // inline
113
115 QL_REQUIRE(nominals_.size()==1, "varying nominals");
116 return nominals_[0];
117 }
118
119}
120
121#endif
Arithemtic Average OIS: fix vs arithmetic average of overnight rate.
ext::shared_ptr< OvernightIndex > overnightIndex_
std::vector< Real > nominals() const
const ext::shared_ptr< OvernightIndex > & overnightIndex()
void initialize(const Schedule &fixedLegSchedule, const Schedule &overnightLegSchedule)
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
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