Forward Class Reference

### A free/open-source library for quantitative finance

Public Member Functions | Protected Member Functions | Protected Attributes
Forward Class Reference
Financial instruments

Abstract base forward class. More...

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

Inheritance diagram for Forward:
[legend]

List of all members.

## Public Member Functions
virtual Real | spotValue () const =0
| returns spot value/price of an underlying financial instrument
virtual Real | spotIncome (const Handle< YieldTermStructure > &incomeDiscountCurve) const =0
| NPV of income/dividends/storage-costs etc. of underlying instrument.
Inspectors
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.
Calculations
virtual Real | forwardValue () const
| forward value/price of underlying, discounting income/dividends
InterestRate | impliedYield (Real underlyingSpotValue, Real forwardValue, Date settlementDate, Compounding compoundingConvention, DayCounter dayCounter)
## Protected Member Functions
| 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 Attributes
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_

## Detailed Description

Abstract base forward class.

Derived classes must implement the virtual functions spotValue() (NPV or spot price) and spotIncome() associated with the specific relevant underlying (e.g. bond, stock, commodity, loan/deposit). These functions must be used to set the protected member variables underlyingSpotValue_ and underlyingIncome_ within performCalculations() in the derived class before the base-class implementation is called.

spotIncome() refers generically to the present value of coupons, dividends or storage costs.

discountCurve_ is the curve used to discount forward contract cash flows back to the evaluation day, as well as to obtain forward values for spot values/prices.

incomeDiscountCurve_, which for generality is not automatically set to the discountCurve_, is the curve used to discount future income/dividends/storage-costs etc back to the evaluation date.

Possible enhancements:
  Add preconditions and tests

Warning:
  This class still needs to be rigorously tested

## Member Function Documentation

virtual Real forwardValue | ( |  | ) | const`[virtual]`

forward value/price of underlying, discounting income/dividends

Note:
  if this is a bond forward price, is must be a dirty forward price.

InterestRate impliedYield | ( | Real | underlyingSpotValue,
|  | Real | forwardValue,
|  | Date | settlementDate,
|  | Compounding | compoundingConvention,
|  | DayCounter | dayCounter
| ) |  |

Simple yield calculation based on underlying spot and forward values, taking into account underlying income. When , call with: underlyingSpotValue=spotValue(t), forwardValue=strikePrice, to get current yield. For a repo, if , impliedYield should reproduce the spot repo rate. For FRA's, this should reproduce the relevant zero rate at the FRA's maturityDate_;

void performCalculations | ( |  | ) | const`[protected, virtual]`

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.

Reimplemented in FixedRateBondForward.

## Member Data Documentation

Real underlyingIncome_`[mutable, protected]`

derived classes must set this, typically via spotIncome()

Real underlyingSpotValue_`[mutable, protected]`

derived classes must set this, typically via spotValue()

Date valueDate_`[protected]`

valueDate = settlement date (date the fwd contract starts accruing)

Handle<YieldTermStructure> incomeDiscountCurve_`[protected]`

must set this in derived classes, based on particular underlying