QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
overnightindexedcoupon.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Roland Lichters
5 Copyright (C) 2009 Ferdinando Ametrano
6 Copyright (C) 2014 Peter Caspers
7 Copyright (C) 2017 Joseph Jeisman
8 Copyright (C) 2017 Fabrice Lecuyer
9
10 This file is part of QuantLib, a free-software/open-source library
11 for financial quantitative analysts and developers - http://quantlib.org/
12
13 QuantLib is free software: you can redistribute it and/or modify it
14 under the terms of the QuantLib license. You should have received a
15 copy of the license along with this program; if not, please email
16 <quantlib-dev@lists.sf.net>. The license is also available online at
17 <http://quantlib.org/license.shtml>.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the license for more details.
22*/
23
28#ifndef quantlib_overnight_indexed_coupon_hpp
29#define quantlib_overnight_indexed_coupon_hpp
30
31#include <ql/cashflows/floatingratecoupon.hpp>
32#include <ql/cashflows/rateaveraging.hpp>
33#include <ql/indexes/iborindex.hpp>
34#include <ql/time/schedule.hpp>
35
36namespace QuantLib {
37
39
50 public:
52 const Date& paymentDate,
54 const Date& startDate,
55 const Date& endDate,
56 const ext::shared_ptr<OvernightIndex>& overnightIndex,
57 Real gearing = 1.0,
58 Spread spread = 0.0,
59 const Date& refPeriodStart = Date(),
60 const Date& refPeriodEnd = Date(),
62 bool telescopicValueDates = false,
65
66
67 const std::vector<Date>& fixingDates() const { return fixingDates_; }
69 const std::vector<Time>& dt() const { return dt_; }
71 const std::vector<Rate>& indexFixings() const;
73 const std::vector<Date>& valueDates() const { return valueDates_; }
75
77
78 Date fixingDate() const override { return fixingDates_.back(); }
79 Real accruedAmount(const Date&) const override;
81
83 void accept(AcyclicVisitor&) override;
85 private:
86 std::vector<Date> valueDates_, fixingDates_;
87 mutable std::vector<Rate> fixings_;
89 std::vector<Time> dt_;
90
91 Rate averageRate(const Date& date) const;
92 };
93
94
97 public:
98 OvernightLeg(const Schedule& schedule, ext::shared_ptr<OvernightIndex> overnightIndex);
100 OvernightLeg& withNotionals(const std::vector<Real>& notionals);
106 OvernightLeg& withGearings(const std::vector<Real>& gearings);
108 OvernightLeg& withSpreads(const std::vector<Spread>& spreads);
109 OvernightLeg& withTelescopicValueDates(bool telescopicValueDates);
111 operator Leg() const;
112 private:
114 ext::shared_ptr<OvernightIndex> overnightIndex_;
115 std::vector<Real> notionals_;
120 std::vector<Real> gearings_;
121 std::vector<Spread> spreads_;
124 };
125
126}
127
128#endif
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
calendar class
Definition: calendar.hpp:61
virtual Real nominal() const
Definition: coupon.hpp:100
Date date() const override
Definition: coupon.hpp:53
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
base floating-rate coupon class
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
DayCounter dayCounter() const override
day counter for accrual calculation
Spread spread() const
spread paid over the fixing of the underlying index
const std::vector< Date > & valueDates() const
value dates for the rates to be compounded
const std::vector< Rate > & indexFixings() const
fixings to be compounded
void accept(AcyclicVisitor &) override
Real accruedAmount(const Date &) const override
accrued amount at the given date
const std::vector< Time > & dt() const
accrual (compounding) periods
const std::vector< Date > & fixingDates() const
fixing dates for the rates to be compounded
Date fixingDate() const override
the date when the coupon is fully determined
Rate averageRate(const Date &date) const
helper class building a sequence of overnight coupons
ext::shared_ptr< OvernightIndex > overnightIndex_
BusinessDayConvention paymentAdjustment_
OvernightLeg & withGearings(Real gearing)
OvernightLeg & withPaymentCalendar(const Calendar &)
OvernightLeg & withTelescopicValueDates(bool telescopicValueDates)
OvernightLeg & withPaymentAdjustment(BusinessDayConvention)
std::vector< Spread > spreads_
OvernightLeg & withNotionals(Real notional)
RateAveraging::Type averagingMethod_
OvernightLeg & withAveragingMethod(RateAveraging::Type averagingMethod)
OvernightLeg & withPaymentDayCounter(const DayCounter &)
OvernightLeg & withSpreads(Spread spread)
OvernightLeg & withPaymentLag(Natural lag)
Payment schedule.
Definition: schedule.hpp:40
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Spread
spreads on interest rates
Definition: types.hpp:74
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78