QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
averagebmacoupon.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Roland Lichters
5 Copyright (C) 2007 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_bma_coupon_hpp
26#define quantlib_bma_coupon_hpp
27
28#include <ql/cashflows/floatingratecoupon.hpp>
29#include <ql/indexes/bmaindex.hpp>
30
31namespace QuantLib {
32
34
45 public:
46 AverageBMACoupon(const Date& paymentDate,
48 const Date& startDate,
49 const Date& endDate,
50 const ext::shared_ptr<BMAIndex>& index,
51 Real gearing = 1.0,
52 Spread spread = 0.0,
53 const Date& refPeriodStart = Date(),
54 const Date& refPeriodEnd = Date(),
56
58
59
60 Date fixingDate() const override;
62 std::vector<Date> fixingDates() const;
63
65 Rate indexFixing() const override;
67 std::vector<Rate> indexFixings() const;
68
70 Rate convexityAdjustment() const override;
72
74
75 void accept(AcyclicVisitor&) override;
77 private:
79 };
80
81
84 public:
85 AverageBMALeg(Schedule schedule, ext::shared_ptr<BMAIndex> index);
87 AverageBMALeg& withNotionals(const std::vector<Real>& notionals);
91 AverageBMALeg& withGearings(const std::vector<Real>& gearings);
93 AverageBMALeg& withSpreads(const std::vector<Spread>& spreads);
94 operator Leg() const;
95 private:
97 ext::shared_ptr<BMAIndex> index_;
98 std::vector<Real> notionals_;
101 std::vector<Real> gearings_;
102 std::vector<Spread> spreads_;
103 };
104
105}
106
107
108#endif
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
std::vector< Date > fixingDates() const
fixing dates of the rates to be averaged
Rate indexFixing() const override
not applicable here; use indexFixings() instead
void accept(AcyclicVisitor &) override
std::vector< Rate > indexFixings() const
fixings of the underlying index to be averaged
Rate convexityAdjustment() const override
not applicable here
Date fixingDate() const override
not applicable here; use fixingDates() instead
helper class building a sequence of average BMA coupons
BusinessDayConvention paymentAdjustment_
AverageBMALeg & withSpreads(Spread spread)
AverageBMALeg & withGearings(Real gearing)
std::vector< Real > notionals_
std::vector< Spread > spreads_
AverageBMALeg & withPaymentDayCounter(const DayCounter &)
ext::shared_ptr< BMAIndex > index_
AverageBMALeg & withPaymentAdjustment(BusinessDayConvention)
AverageBMALeg & withNotionals(Real notional)
std::vector< Real > gearings_
virtual Real nominal() const
Definition: coupon.hpp:100
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
const ext::shared_ptr< InterestRateIndex > & index() const
floating index
Spread spread() const
spread paid over the fixing of the underlying index
Payment schedule.
Definition: schedule.hpp:40
BusinessDayConvention
Business Day conventions.
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