QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
forwardrateagreement.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) 2006 Allen Kuo
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 forwardrateagreement.hpp
21 \brief forward rate agreement
22*/
23
24#ifndef quantlib_forward_rate_agreement_hpp
25#define quantlib_forward_rate_agreement_hpp
26
28
29namespace QuantLib {
30
31 class IborIndex;
32
33 //! %Forward rate agreement (FRA) class
34 /*! 1. Unlike the forward contract conventions on carryable
35 financial assets (stocks, bonds, commodities), the
36 valueDate for a FRA is taken to be the day when the forward
37 loan or deposit begins and when full settlement takes place
38 (based on the NPV of the contract on that date).
39 maturityDate is the date when the forward loan or deposit
40 ends. In fact, the FRA settles and expires on the
41 valueDate, not on the (later) maturityDate. It follows that
42 (maturityDate - valueDate) is the tenor/term of the
43 underlying loan or deposit
44
45 2. Choose position type = Long for an "FRA purchase" (future
46 long loan, short deposit [borrower])
47
48 3. Choose position type = Short for an "FRA sale" (future short
49 loan, long deposit [lender])
50
51 <b>Example: </b>
52 \link FRA.cpp
53 valuation of a forward-rate agreement
54 \endlink
55
56 \todo Add preconditions and tests
57
58 \todo Differentiate between BBA (British)/AFB (French)
59 [assumed here] and ABA (Australian) banker conventions
60 in the calculations.
61
62 \warning This class still needs to be rigorously tested
63
64 \ingroup instruments
65 */
67 public:
68 /*! \deprecated Use one of the other constructors.
69 Deprecated in version 1.31.
70 */
73 const Date& valueDate,
74 const Date& maturityDate,
75 Position::Type type,
76 Rate strikeForwardRate,
77 Real notionalAmount,
78 const ext::shared_ptr<IborIndex>& index,
80 bool useIndexedCoupon = true);
81
82 /*! \deprecated Use one of the other constructors.
83 Deprecated in version 1.31.
84 */
87 const Date& valueDate,
88 Position::Type type,
89 Rate strikeForwardRate,
90 Real notionalAmount,
91 const ext::shared_ptr<IborIndex>& index,
93
94 /*! When using this constructor, the forward rate will be
95 forecast by the passed index. This corresponds to
96 useIndexedCoupon=true in the FraRateHelper class.
97 */
99 const ext::shared_ptr<IborIndex>& index,
100 const Date& valueDate,
101 Position::Type type,
102 Rate strikeForwardRate,
103 Real notionalAmount,
105
106 /*! When using this constructor, a par-rate approximation will
107 be used, i.e., the forward rate will be forecast from
108 value date to maturity date by the forecast curve
109 contained in the index. This corresponds to
110 useIndexedCoupon=false in the FraRateHelper class.
111 */
113 const ext::shared_ptr<IborIndex>& index,
114 const Date& valueDate,
115 const Date& maturityDate,
116 Position::Type type,
117 Rate strikeForwardRate,
118 Real notionalAmount,
120
121 //! \name Calculations
122 //@{
123 //! A FRA expires/settles on the value date
124 bool isExpired() const override;
125 //! The payoff on the value date
126 Real amount() const;
127
128 const Calendar& calendar() const;
130 const DayCounter& dayCounter() const;
131 //! term structure relevant to the contract (e.g. repo curve)
133
134 Date fixingDate() const;
135
136 //! Returns the relevant forward rate associated with the FRA term
138 //@}
139
140 protected:
141 void setupExpired() const override;
142 void performCalculations() const override;
144 //! aka FRA rate (the market forward rate)
146 //! aka FRA fixing rate, contract rate
149 ext::shared_ptr<IborIndex> index_;
151
155
156 //! the valueDate is the date the underlying index starts accruing and the FRA is settled.
158 //! maturityDate of the underlying index; not the date the FRA is settled.
161
162 private:
163 void calculateForwardRate() const;
164 void calculateAmount() const;
165 mutable Real amount_;
166 };
167
168 inline const Calendar& ForwardRateAgreement::calendar() const { return calendar_; }
169
172 }
173
175
177 return discountCurve_;
178 }
179
180}
181
182
183#endif
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Forward rate agreement (FRA) class
void performCalculations() const override
Handle< YieldTermStructure > discountCurve_
InterestRate strikeForwardRate_
aka FRA fixing rate, contract rate
bool isExpired() const override
A FRA expires/settles on the value date.
const DayCounter & dayCounter() const
Handle< YieldTermStructure > discountCurve() const
term structure relevant to the contract (e.g. repo curve)
InterestRate forwardRate_
aka FRA rate (the market forward rate)
BusinessDayConvention businessDayConvention() const
Date maturityDate_
maturityDate of the underlying index; not the date the FRA is settled.
Real amount() const
The payoff on the value date.
Date valueDate_
the valueDate is the date the underlying index starts accruing and the FRA is settled.
InterestRate forwardRate() const
Returns the relevant forward rate associated with the FRA term.
BusinessDayConvention businessDayConvention_
ext::shared_ptr< IborIndex > index_
Shared handle to an observable.
Definition: handle.hpp:41
Abstract instrument class.
Definition: instrument.hpp:44
Concrete interest rate class.
Base forward class.
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
#define QL_DEPRECATED
Definition: qldefines.hpp:215