QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ForwardRateAgreement Class Reference

Forward rate agreement (FRA) class More...

#include <forwardrateagreement.hpp>

+ Inheritance diagram for ForwardRateAgreement:
+ Collaboration diagram for ForwardRateAgreement:

Public Member Functions

QL_DEPRECATED ForwardRateAgreement (const Date &valueDate, const Date &maturityDate, Position::Type type, Rate strikeForwardRate, Real notionalAmount, const ext::shared_ptr< IborIndex > &index, Handle< YieldTermStructure > discountCurve={}, bool useIndexedCoupon=true)
 
QL_DEPRECATED ForwardRateAgreement (const Date &valueDate, Position::Type type, Rate strikeForwardRate, Real notionalAmount, const ext::shared_ptr< IborIndex > &index, Handle< YieldTermStructure > discountCurve={})
 
 ForwardRateAgreement (const ext::shared_ptr< IborIndex > &index, const Date &valueDate, Position::Type type, Rate strikeForwardRate, Real notionalAmount, Handle< YieldTermStructure > discountCurve={})
 
 ForwardRateAgreement (const ext::shared_ptr< IborIndex > &index, const Date &valueDate, const Date &maturityDate, Position::Type type, Rate strikeForwardRate, Real notionalAmount, Handle< YieldTermStructure > discountCurve={})
 
- Public Member Functions inherited from Instrument
 Instrument ()
 
Real NPV () const
 returns the net present value of the instrument. More...
 
Real errorEstimate () const
 returns the error estimate on the NPV when available. More...
 
const DatevaluationDate () const
 returns the date the net present value refers to. More...
 
template<typename T >
T result (const std::string &tag) const
 returns any additional result returned by the pricing engine. More...
 
const std::map< std::string, ext::any > & additionalResults () const
 returns all additional result returned by the pricing engine. More...
 
void setPricingEngine (const ext::shared_ptr< PricingEngine > &)
 set the pricing engine to be used. More...
 
virtual void setupArguments (PricingEngine::arguments *) const
 
virtual void fetchResults (const PricingEngine::results *) const
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Calculations

Position::Type fraType_
 
InterestRate forwardRate_
 aka FRA rate (the market forward rate) More...
 
InterestRate strikeForwardRate_
 aka FRA fixing rate, contract rate More...
 
Real notionalAmount_
 
ext::shared_ptr< IborIndexindex_
 
bool useIndexedCoupon_
 
DayCounter dayCounter_
 
Calendar calendar_
 
BusinessDayConvention businessDayConvention_
 
Date valueDate_
 the valueDate is the date the underlying index starts accruing and the FRA is settled. More...
 
Date maturityDate_
 maturityDate of the underlying index; not the date the FRA is settled. More...
 
Handle< YieldTermStructurediscountCurve_
 
Real amount_
 
bool isExpired () const override
 A FRA expires/settles on the value date. More...
 
Real amount () const
 The payoff on the value date. More...
 
const Calendarcalendar () const
 
BusinessDayConvention businessDayConvention () const
 
const DayCounterdayCounter () const
 
Handle< YieldTermStructurediscountCurve () const
 term structure relevant to the contract (e.g. repo curve) More...
 
Date fixingDate () const
 
InterestRate forwardRate () const
 Returns the relevant forward rate associated with the FRA term. More...
 
void setupExpired () const override
 
void performCalculations () const override
 
void calculateForwardRate () const
 
void calculateAmount () const
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Instrument
void calculate () const override
 
- Protected Member Functions inherited from LazyObject
- Protected Attributes inherited from Instrument
Real NPV_
 
Real errorEstimate_
 
Date valuationDate_
 
std::map< std::string, ext::any > additionalResults_
 
ext::shared_ptr< PricingEngineengine_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

Forward rate agreement (FRA) class

  1. Unlike the forward contract conventions on carryable financial assets (stocks, bonds, commodities), the valueDate for a FRA is taken to be the day when the forward loan or deposit begins and when full settlement takes place (based on the NPV of the contract on that date). maturityDate is the date when the forward loan or deposit ends. In fact, the FRA settles and expires on the valueDate, not on the (later) maturityDate. It follows that (maturityDate - valueDate) is the tenor/term of the underlying loan or deposit
  2. Choose position type = Long for an "FRA purchase" (future long loan, short deposit [borrower])
  3. Choose position type = Short for an "FRA sale" (future short loan, long deposit [lender])

Example: valuation of a forward-rate agreement

Warning:
This class still needs to be rigorously tested
Examples
FRA.cpp.

Definition at line 66 of file forwardrateagreement.hpp.

Constructor & Destructor Documentation

◆ ForwardRateAgreement() [1/4]

ForwardRateAgreement ( const Date valueDate,
const Date maturityDate,
Position::Type  type,
Rate  strikeForwardRate,
Real  notionalAmount,
const ext::shared_ptr< IborIndex > &  index,
Handle< YieldTermStructure discountCurve = {},
bool  useIndexedCoupon = true 
)
Deprecated:
Use one of the other constructors. Deprecated in version 1.31.

Definition at line 28 of file forwardrateagreement.cpp.

◆ ForwardRateAgreement() [2/4]

ForwardRateAgreement ( const Date valueDate,
Position::Type  type,
Rate  strikeForwardRate,
Real  notionalAmount,
const ext::shared_ptr< IborIndex > &  index,
Handle< YieldTermStructure discountCurve = {} 
)
Deprecated:
Use one of the other constructors. Deprecated in version 1.31.

Definition at line 41 of file forwardrateagreement.cpp.

◆ ForwardRateAgreement() [3/4]

ForwardRateAgreement ( const ext::shared_ptr< IborIndex > &  index,
const Date valueDate,
Position::Type  type,
Rate  strikeForwardRate,
Real  notionalAmount,
Handle< YieldTermStructure discountCurve = {} 
)

When using this constructor, the forward rate will be forecast by the passed index. This corresponds to useIndexedCoupon=true in the FraRateHelper class.

Definition at line 50 of file forwardrateagreement.cpp.

◆ ForwardRateAgreement() [4/4]

ForwardRateAgreement ( const ext::shared_ptr< IborIndex > &  index,
const Date valueDate,
const Date maturityDate,
Position::Type  type,
Rate  strikeForwardRate,
Real  notionalAmount,
Handle< YieldTermStructure discountCurve = {} 
)

When using this constructor, a par-rate approximation will be used, i.e., the forward rate will be forecast from value date to maturity date by the forecast curve contained in the index. This corresponds to useIndexedCoupon=false in the FraRateHelper class.

Definition at line 61 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
overridevirtual

A FRA expires/settles on the value date.

Implements Instrument.

Definition at line 92 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:

◆ amount()

Real amount ( ) const

The payoff on the value date.

Examples
FRA.cpp.

Definition at line 96 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:

◆ calendar()

const Calendar & calendar ( ) const

Definition at line 168 of file forwardrateagreement.hpp.

◆ businessDayConvention()

BusinessDayConvention businessDayConvention ( ) const

Definition at line 170 of file forwardrateagreement.hpp.

◆ dayCounter()

const DayCounter & dayCounter ( ) const

Definition at line 174 of file forwardrateagreement.hpp.

◆ discountCurve()

Handle< YieldTermStructure > discountCurve ( ) const

term structure relevant to the contract (e.g. repo curve)

Definition at line 176 of file forwardrateagreement.hpp.

◆ fixingDate()

Date fixingDate ( ) const

Definition at line 88 of file forwardrateagreement.cpp.

+ Here is the caller graph for this function:

◆ forwardRate()

InterestRate forwardRate ( ) const

Returns the relevant forward rate associated with the FRA term.

Examples
FRA.cpp.

Definition at line 101 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:

◆ setupExpired()

void setupExpired ( ) const
overrideprotectedvirtual

This method must leave the instrument in a consistent state when the expiration condition is met.

Reimplemented from Instrument.

Definition at line 106 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overrideprotectedvirtual

In case a pricing engine is not used, this method must be overridden to perform the actual calculations and set any needed results. In case a pricing engine is used, the default implementation can be used.

Reimplemented from Instrument.

Definition at line 111 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:

◆ calculateForwardRate()

void calculateForwardRate ( ) const
private

Definition at line 118 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateAmount()

void calculateAmount ( ) const
private

Definition at line 132 of file forwardrateagreement.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fraType_

Position::Type fraType_
protected

Definition at line 143 of file forwardrateagreement.hpp.

◆ forwardRate_

InterestRate forwardRate_
mutableprotected

aka FRA rate (the market forward rate)

Definition at line 145 of file forwardrateagreement.hpp.

◆ strikeForwardRate_

InterestRate strikeForwardRate_
protected

aka FRA fixing rate, contract rate

Definition at line 147 of file forwardrateagreement.hpp.

◆ notionalAmount_

Real notionalAmount_
protected

Definition at line 148 of file forwardrateagreement.hpp.

◆ index_

ext::shared_ptr<IborIndex> index_
protected

Definition at line 149 of file forwardrateagreement.hpp.

◆ useIndexedCoupon_

bool useIndexedCoupon_
protected

Definition at line 150 of file forwardrateagreement.hpp.

◆ dayCounter_

DayCounter dayCounter_
protected

Definition at line 152 of file forwardrateagreement.hpp.

◆ calendar_

Calendar calendar_
protected

Definition at line 153 of file forwardrateagreement.hpp.

◆ businessDayConvention_

BusinessDayConvention businessDayConvention_
protected

Definition at line 154 of file forwardrateagreement.hpp.

◆ valueDate_

Date valueDate_
protected

the valueDate is the date the underlying index starts accruing and the FRA is settled.

Definition at line 157 of file forwardrateagreement.hpp.

◆ maturityDate_

Date maturityDate_
protected

maturityDate of the underlying index; not the date the FRA is settled.

Definition at line 159 of file forwardrateagreement.hpp.

◆ discountCurve_

Handle<YieldTermStructure> discountCurve_
protected

Definition at line 160 of file forwardrateagreement.hpp.

◆ amount_

Real amount_
mutableprivate

Definition at line 165 of file forwardrateagreement.hpp.