QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
averagebmacoupon.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) 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
21/*! \file averagebmacoupon.hpp
22 \brief coupon paying a weighted average of BMA-index fixings
23*/
24
25#ifndef quantlib_bma_coupon_hpp
26#define quantlib_bma_coupon_hpp
27
30
31namespace QuantLib {
32
33 //! Average BMA coupon
34 /*! %Coupon paying a BMA index, where the coupon rate is a
35 weighted average of relevant fixings.
36
37 The weighted average is computed based on the
38 actual calendar days for which a given fixing is valid and
39 contributing to the given interest period.
40
41 Before weights are computed, the fixing schedule is adjusted
42 for the index's fixing day gap. See rate() method for details.
43 */
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
57 //! \name FloatingRateCoupon interface
58 //@{
59 //! not applicable here; use fixingDates() instead
60 Date fixingDate() const override;
61 //! fixing dates of the rates to be averaged
62 std::vector<Date> fixingDates() const;
63
64 //! not applicable here; use indexFixings() instead
65 Rate indexFixing() const override;
66 //! fixings of the underlying index to be averaged
67 std::vector<Rate> indexFixings() const;
68
69 //! not applicable here
70 Rate convexityAdjustment() const override;
71 //@}
72
73 //! \name Visitability
74 //@{
75 void accept(AcyclicVisitor&) override;
76 //@}
77 private:
79 };
80
81
82 //! helper class building a sequence of average BMA coupons
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
Bond Market Association index.
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
Coupon paying a variable index-based rate.
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