QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
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 /*! When using this constructor, the forward rate will be
69 forecast by the passed index. This corresponds to
70 useIndexedCoupon=true in the FraRateHelper class.
71 */
73 const ext::shared_ptr<IborIndex>& index,
74 const Date& valueDate,
75 Position::Type type,
76 Rate strikeForwardRate,
77 Real notionalAmount,
79
80 /*! When using this constructor, a par-rate approximation will
81 be used, i.e., the forward rate will be forecast from
82 value date to maturity date by the forecast curve
83 contained in the index. This corresponds to
84 useIndexedCoupon=false in the FraRateHelper class.
85 */
87 const ext::shared_ptr<IborIndex>& index,
88 const Date& valueDate,
89 const Date& maturityDate,
90 Position::Type type,
91 Rate strikeForwardRate,
92 Real notionalAmount,
94
95 //! \name Calculations
96 //@{
97 //! A FRA expires/settles on the value date
98 bool isExpired() const override;
99 //! The payoff on the value date
100 Real amount() const;
101
102 const Calendar& calendar() const;
104 const DayCounter& dayCounter() const;
105 //! term structure relevant to the contract (e.g. repo curve)
107
108 Date fixingDate() const;
109
110 //! Returns the relevant forward rate associated with the FRA term
112 //@}
113
114 protected:
115 void setupExpired() const override;
116 void performCalculations() const override;
118 //! aka FRA rate (the market forward rate)
120 //! aka FRA fixing rate, contract rate
123 ext::shared_ptr<IborIndex> index_;
125
129
130 //! the valueDate is the date the underlying index starts accruing and the FRA is settled.
132 //! maturityDate of the underlying index; not the date the FRA is settled.
135
136 private:
137 void calculateForwardRate() const;
138 void calculateAmount() const;
139 mutable Real amount_;
140 };
141
142 inline const Calendar& ForwardRateAgreement::calendar() const { return calendar_; }
143
146 }
147
149
151 return discountCurve_;
152 }
153
154}
155
156
157#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:37