QuantLib: FixedRateBondForward Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.12

Protected Member Functions | Protected Attributes | List of all members
FixedRateBondForward Class Reference
Financial instruments

Forward contract on a fixed-rate bond More...

`#include <ql/instruments/fixedratebondforward.hpp>`

Inheritance diagram for FixedRateBondForward:
[legend]

## Public Member Functions
Constructors
| FixedRateBondForward (const Date &valueDate, const Date &maturityDate, Position::Type type, Real strike, Natural settlementDays, const DayCounter &dayCounter, const Calendar &calendar, BusinessDayConvention businessDayConvention, const boost::shared_ptr< FixedRateBond > &fixedCouponBond, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const Handle< YieldTermStructure > &incomeDiscountCurve=Handle< YieldTermStructure >())
Calculations
Real | forwardPrice () const
| (dirty) forward bond price
Real | cleanForwardPrice () const
| (dirty) forward bond price minus accrued on bond at delivery
Real | spotIncome (const Handle< YieldTermStructure > &incomeDiscountCurve) const
| NPV of bond coupons discounted using incomeDiscountCurve. More...
Real | spotValue () const
| NPV of underlying bond.
Public Member Functions inherited from Forward
virtual Date | settlementDate () const
const Calendar & | calendar () const
BusinessDayConvention | businessDayConvention () const
const DayCounter & | dayCounter () const
Handle< YieldTermStructure > | discountCurve () const
| term structure relevant to the contract (e.g. repo curve)
Handle< YieldTermStructure > | incomeDiscountCurve () const
| term structure that discounts the underlying's income cash flows
bool | isExpired () const
| returns whether the instrument is still tradable.
virtual Real | forwardValue () const
| forward value/price of underlying, discounting income/dividends More...
InterestRate | impliedYield (Real underlyingSpotValue, Real forwardValue, Date settlementDate, Compounding compoundingConvention, DayCounter dayCounter)
Public Member Functions inherited from Instrument
virtual void | setupArguments (PricingEngine::arguments *) const
virtual void | fetchResults (const PricingEngine::results *) const
Real | NPV () const
| returns the net present value of the instrument.
Real | errorEstimate () const
| returns the error estimate on the NPV when available.
const Date & | valuationDate () const
| returns the date the net present value refers to.
template<typename T >
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 boost::shared_ptr< PricingEngine > &)
| set the pricing engine to be used. More...
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 &)
Observable & | operator= (const Observable &)
void | notifyObservers ()
Public Member Functions inherited from Observer
| Observer (const Observer &)
Observer & | operator= (const Observer &)
std::pair< iterator, bool > | registerWith (const boost::shared_ptr< Observable > &)
void | registerWithObservables (const boost::shared_ptr< Observer > &)
Size | unregisterWith (const boost::shared_ptr< Observable > &)
void | unregisterWithAll ()
virtual void | deepUpdate ()

## Protected Member Functions
void | performCalculations () const
Protected Member Functions inherited from Forward
| Forward (const DayCounter &dayCounter, const Calendar &calendar, BusinessDayConvention businessDayConvention, Natural settlementDays, const boost::shared_ptr< Payoff > &payoff, const Date &valueDate, const Date &maturityDate, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >())
void | performCalculations () const
Protected Member Functions inherited from Instrument
void | calculate () const
virtual void | setupExpired () const
Protected Member Functions inherited from LazyObject

## Protected Attributes
boost::shared_ptr< FixedRateBond > | fixedCouponBond_
Protected Attributes inherited from Forward
Real | underlyingIncome_
Real | underlyingSpotValue_
DayCounter | dayCounter_
Calendar | calendar_
BusinessDayConvention | businessDayConvention_
Natural | settlementDays_
boost::shared_ptr< Payoff > | payoff_
Date | valueDate_
Date | maturityDate_
| maturityDate of the forward contract or delivery date of underlying
Handle< YieldTermStructure > | discountCurve_
Handle< YieldTermStructure > | incomeDiscountCurve_
Protected Attributes inherited from Instrument
boost::shared_ptr< PricingEngine > | engine_
Real | NPV_
Real | errorEstimate_
Date | valuationDate_
std::map< std::string, boost::any > | additionalResults_
Protected Attributes inherited from LazyObject
bool | calculated_
bool | frozen_
bool | alwaysForward_

## Additional Inherited Members
Public Types inherited from Observer
typedef std::set< boost::shared_ptr< Observable > > | set_type
typedef set_type::iterator | iterator

## Detailed Description

Forward contract on a fixed-rate bond

1. valueDate refers to the settlement date of the bond forward contract. maturityDate is the delivery (or repurchase) date for the underlying bond (not the bond's maturity date).

2. Relevant formulas used in the calculations ( \(P\) refers to a price):

   a. \( P_{CleanFwd}(t) = P_{DirtyFwd}(t) - AI(t=deliveryDate) \) where \( AI \) refers to the accrued interest on the underlying bond.

   b. \( P_{DirtyFwd}(t) = \frac{P_{DirtySpot}(t) - SpotIncome(t)} {discountCurve->discount(t=deliveryDate)} \)

   c. \( SpotIncome(t) = \sum_i \left( CF_i \times incomeDiscountCurve->discount(t_i) \right) \) where \( CF_i \) represents the ith bond cash flow (coupon payment) associated with the underlying bond falling between the settlementDate and the deliveryDate. (Note the two different discount curves used in b. and c.)

Example: valuation of a repo on a fixed-rate bond

Warning:
  This class still needs to be rigorously tested

Examples:
  Repo.cpp.

## Constructor & Destructor Documentation

## ◆ FixedRateBondForward()

FixedRateBondForward | ( | const Date & | valueDate,
|  | const Date & | maturityDate,
|  | Position::Type | type,
|  | Real | strike,
|  | Natural | settlementDays,
|  | const DayCounter & | dayCounter,
|  | const Calendar & | calendar,
|  | BusinessDayConvention | businessDayConvention,
|  | const boost::shared_ptr< FixedRateBond > & | fixedCouponBond,
|  | const Handle< YieldTermStructure > & | discountCurve = `Handle< YieldTermStructure >()`,
|  | const Handle< YieldTermStructure > & | incomeDiscountCurve = `Handle< YieldTermStructure >()`
| ) |  |

If strike is given in the constructor, can calculate the NPV of the contract via NPV().

If strike/forward price is desired, it can be obtained via forwardPrice(). In this case, the strike variable in the constructor is irrelevant and will be ignored.

## Member Function Documentation

## ◆ spotIncome()

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

NPV of bond coupons discounted using incomeDiscountCurve.

Here only coupons between max(evaluation date,settlement date) and maturity date of bond forward contract are considered income.

Implements Forward.

## ◆ 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 Instrument.