QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
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 /*! \deprecated Use OvernightIndexedSwap instead.
36 Deprecated in version 1.36.
37 */
38 class [[deprecated("Use OvernightIndexedSwap instead")]] ArithmeticAverageOIS : public Swap {
39 public:
41 Real nominal,
42 Schedule fixedLegSchedule,
43 Rate fixedRate,
44 DayCounter fixedDC,
45 ext::shared_ptr<OvernightIndex> overnightIndex,
46 Schedule overnightLegSchedule,
47 Spread spread = 0.0,
48 Real meanReversionSpeed = 0.03,
49 Real volatility = 0.00, // NO convexity adjustment by default
50 bool byApprox = false); // TRUE to use Katsumi Takada approximation
52 std::vector<Real> nominals,
53 Schedule fixedLegSchedule,
54 Rate fixedRate,
55 DayCounter fixedDC,
56 ext::shared_ptr<OvernightIndex> overnightIndex,
57 Schedule overnightLegSchedule,
58 Spread spread = 0.0,
59 Real meanReversionSpeed = 0.03,
60 Real volatility = 0.00, // NO convexity adjustment by default
61 bool byApprox = false); // TRUE to use Katsumi Takada approximation
62 //! \name Inspectors
63 //@{
64 Type type() const { return type_; }
65 Real nominal() const {
66 QL_REQUIRE(nominals_.size()==1, "varying nominals");
67 return nominals_[0];
68 }
69 std::vector<Real> nominals() const { return nominals_; }
70
71 //const Schedule& schedule() { return schedule_; }
72 Frequency fixedLegPaymentFrequency() { return fixedLegPaymentFrequency_; }
73 Frequency overnightLegPaymentFrequency() { return overnightLegPaymentFrequency_; }
74
75 Rate fixedRate() const { return fixedRate_; }
76 const DayCounter& fixedDayCount() { return fixedDC_; }
77
78 const ext::shared_ptr<OvernightIndex>& overnightIndex() { return overnightIndex_; }
79 Spread spread() const { return spread_; }
80
81 const Leg& fixedLeg() const { return legs_[0]; }
82 const Leg& overnightLeg() const { return legs_[1]; }
83 //@}
84
85 //! \name Results
86 //@{
87 Real fixedLegBPS() const;
88 Real fixedLegNPV() const;
89 Real fairRate() const;
90
91 Real overnightLegBPS() const;
92 Real overnightLegNPV() const;
93 Spread fairSpread() const;
94 //@}
95 private:
96 void initialize(Schedule fixedLegSchedule, Schedule overnightLegSchedule);
98 std::vector<Real> nominals_;
99
102 //Schedule schedule_;
103
106
107 ext::shared_ptr<OvernightIndex> overnightIndex_;
109
113 };
114
115}
116
117#endif
ext::shared_ptr< OvernightIndex > overnightIndex_
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
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:37
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
Interest rate swap.