QuantLib
A free/open-source library for quantitative finance
Reference manual - version 1.20
Public Member Functions | List of all members
ForwardRateAgreement Class Reference

Forward rate agreement (FRA) class More...

#include <ql/instruments/forwardrateagreement.hpp>

+ Inheritance diagram for ForwardRateAgreement:

Public Member Functions

 ForwardRateAgreement (const Date &valueDate, const Date &maturityDate, Position::Type type, Rate strikeForwardRate, Real notionalAmount, const ext::shared_ptr< IborIndex > &index, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), bool useIndexedCoupon=true)
 
- Public Member Functions inherited from Forward
const Calendarcalendar () const
 
BusinessDayConvention businessDayConvention () const
 
const DayCounterdayCounter () const
 
Handle< YieldTermStructurediscountCurve () const
 term structure relevant to the contract (e.g. repo curve)
 
Handle< YieldTermStructureincomeDiscountCurve () const
 term structure that discounts the underlying's income cash flows
 
virtual Real forwardValue () const
 forward value/price of underlying, discounting income/dividends More...
 
InterestRate impliedYield (Real underlyingSpotValue, Real forwardValue, Date settlementDate, Compounding compoundingConvention, const DayCounter &dayCounter)
 
- Public Member Functions inherited from Instrument
Real NPV () const
 returns the net present value of the instrument.
 
Real errorEstimate () const
 returns the error estimate on the NPV when available.
 
const DatevaluationDate () const
 returns the date the net present value refers to.
 
template<typename T >
result (const std::string &tag) const
 returns any additional result returned by the pricing engine.
 
const std::map< std::string, boost::any > & additionalResults () const
 returns all additional result returned by the pricing engine.
 
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
void update ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
void alwaysForwardNotifications ()
 
- Public Member Functions inherited from Observable
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
std::pair< iterator, bool > registerWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void deepUpdate ()
 

Calculations

Position::Type fraType_
 
InterestRate forwardRate_
 aka FRA rate (the market forward rate)
 
InterestRate strikeForwardRate_
 aka FRA fixing rate, contract rate
 
Real notionalAmount_
 
ext::shared_ptr< IborIndexindex_
 
bool useIndexedCoupon_
 
bool isExpired () const
 
Date settlementDate () const
 
Date fixingDate () const
 
Real spotIncome (const Handle< YieldTermStructure > &incomeDiscountCurve) const
 
Real spotValue () const
 Spot value (NPV) of the underlying loan. More...
 
InterestRate forwardRate () const
 Returns the relevant forward rate associated with the FRA term.
 
void setupExpired () const
 
void performCalculations () const
 

Additional Inherited Members

- Public Types inherited from Observer
typedef boost::unordered_set< ext::shared_ptr< Observable > > set_type
 
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Forward
 Forward (const DayCounter &dayCounter, const Calendar &calendar, BusinessDayConvention businessDayConvention, Natural settlementDays, const ext::shared_ptr< Payoff > &payoff, const Date &valueDate, const Date &maturityDate, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >())
 
- Protected Member Functions inherited from Instrument
void calculate () const
 
- Protected Member Functions inherited from LazyObject
- Protected Attributes inherited from Forward
Real underlyingIncome_
 
Real underlyingSpotValue_
 
DayCounter dayCounter_
 
Calendar calendar_
 
BusinessDayConvention businessDayConvention_
 
Natural settlementDays_
 
ext::shared_ptr< Payoffpayoff_
 
Date valueDate_
 
Date maturityDate_
 maturityDate of the forward contract or delivery date of underlying
 
Handle< YieldTermStructurediscountCurve_
 
Handle< YieldTermStructureincomeDiscountCurve_
 
- Protected Attributes inherited from Instrument
Real NPV_
 
Real errorEstimate_
 
Date valuationDate_
 
std::map< std::string, boost::any > additionalResults_
 
ext::shared_ptr< PricingEngineengine_
 
- Protected Attributes inherited from LazyObject
bool calculated_
 
bool frozen_
 
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])
  4. If strike is given in the constructor, can calculate the NPV of the contract via NPV().
  5. If forward rate is desired/unknown, it can be obtained via forwardRate(). In this case, the strike variable in the constructor is irrelevant and will be ignored.

Example: valuation of a forward-rate agreement

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

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
virtual

A FRA expires/settles on the valueDate

Reimplemented from Forward.

◆ settlementDate()

Date settlementDate ( ) const
virtual

This returns evaluationDate + settlementDays (not FRA valueDate).

Reimplemented from Forward.

◆ spotIncome()

Real spotIncome ( const Handle< YieldTermStructure > &  incomeDiscountCurve) const
virtual

Income is zero for a FRA

Implements Forward.

◆ spotValue()

Real spotValue ( ) const
virtual

Spot value (NPV) of the underlying loan.

This has always a positive value (asset), even if short the FRA

Implements Forward.

◆ setupExpired()

void setupExpired ( ) const
protectedvirtual

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

Reimplemented from Instrument.

◆ performCalculations()

void performCalculations ( ) const
protectedvirtual

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 Forward.