com::ftlabs::fisa::calc::DelegatingCalculator Class Reference

This interface provides calculation methods that are tuned specifically for the implemented security and for a particular settlement to Redemption period. More...

#include <DelegatingCalculator.h>

Inheritance diagram for com::ftlabs::fisa::calc::DelegatingCalculator:

com::ftlabs::fisa::calc::Calculator com::ftlabs::fisa::calc::YieldConvergable com::ftlabs::fisa::calc::InflationIndexedCalculator List of all members.

Public Member Functions

virtual ~DelegatingCalculator (void)
DelegatingCalculatoroperator= (const DelegatingCalculator &calculator)
virtual const com::ftlabs::fisa::FISADategetSettlementDate (void) const
 Get the settlement date to which this Calculator is bound.
virtual const com::ftlabs::fisa::RedemptiongetRedemption (void) const
 Get the Redemption to which this Calculator is bound.
virtual const com::ftlabs::fisa::FISADategetInterestAccrualDate (void) const
 Get the date on which interest begins to accrue for this settlement to redemption period.
virtual double calculateYield (double price) const throw ( CalculationException )
 Calculate yield for the given price.
virtual double calculateCurrentYield (double price) const throw ( CalculationException )
 Calculate current yield for the given price.
virtual double calculatePrice (double yield) const throw ( CalculationException )
 Calculate price for the given yield.
virtual double calculateAccruedInterest () const throw ( CalculationException )
 Calculate the accrued interest to the settlement date.
virtual int getCashFlowCount () const
 Get the number of cashflows within the bounding settlement to Redemption period.
virtual double getInterest (int cashFlowIndex) const
 Get the interest to be paid for a particular cashflow, as specified by cashFlowIndex.
virtual double getPrincipal (int cashFlowIndex) const
 Get the principal to be paid for a particular cashflow, as specified by cashFlowIndex.
virtual double getTotalCashFlow (int cashFlowIndex) const
 Get the principal and interest to be paid for a particular cashflow, as specified by cashFlowIndex.
virtual double getTimeToFlow (int cashFlowIndex) const
 Get the time to flow for a particular cashflow, as specified by cashFlowIndex.
virtual double getPeriodicTimeToFlow (int cashFlowIndex) const
 Get the periodic time to flow as calculated with an actual day count method for a particular cashflow, as specified by cashFlowIndex. This value is generally used in actual convexity and duration methods.
virtual FISADate getCashFlowDate (int cashFlowIndex) const
 Get a cash flow date for a particular cashflow, as specified by the provided cashFlowIndex.
virtual void getCashFlowDate (int cashFlowIndex, FISADate &date) const
 Set the provided FISADate to the cash flow date of a particular cashflow, as specified by the provided cashFlowIndex.
virtual double calculatePeriodicYield (double price) const throw ( CalculationException )
 Calculate a periodic discounted cash flow yield for use with convexity/duration methods.
virtual double calculateMacaulayDuration (double periodicYield) const throw ( CalculationException )
 Calculate the actual Macaulay duration.
virtual double calculateModifiedDuration (double periodicYield) const throw ( CalculationException )
 Calculate the actual modified duration. If Macaulay Duration has already been or will be calculated, then it is more efficient to use the overloaded calculateModifiedDuration method that accepts the Macaulay Duration.
virtual double calculateModifiedDuration (double macaulayDuration, double periodicYield) const throw ( CalculationException )
 Calculate the actual modified duration using an already calculated Macaulay Duration.
virtual double calculateConvexity (double periodicYield) const throw ( CalculationException )
 Calculate the actual convexity.
virtual double calculatePriceValue1BP (double price, double yield) const throw ( CalculationException )
 Calculate the average price value obtained by varying the yield up and down one basis point.
virtual double calculateYieldValue1_32 (double pv1b) const throw ( CalculationException )
 Calculate the average yield value obtained by varying the price up and down 1/32.
virtual double calculateEstimatedMacaulayDuration (double pv1b, double price, double yield) const throw ( CalculationException )
 Calculate an estimated Macaulay duration.
virtual double calculateEstimatedModifiedDuration (double pv1b, double price, double yield) const throw ( CalculationException )
 Calculate an estimated modified duration.
virtual double calculateEstimatedModifiedDuration (double duration, double yield) const throw ( CalculationException )
 Calculate the estimated modified duration.
virtual double calculateEstimatedConvexity (double pv1b, double price, double yield) const throw ( CalculationException )
 Calculate an estimated convexity.
virtual double calculateTrueYield (double price) const throw ( CalculationException )
 Calculate a True Yield, using adjusting cashflows that fall on business days.
virtual double calculateAccruedIncome (void) const throw ( CalculationException )
 Calculates the accrued interest income to Redemption.
virtual double calculateAccruedIncome (const FISADate &salesDate) const throw ( CalculationException )
 Calculates the accrued interest income to the supplied salesDate.
virtual double calculateTotalInterestFlows (void) const throw ( CalculationException )
 A convenience method to total all interest cashflows between the settlement to redemption period.
virtual double calculateInterestOnInterest (double reinvestmentYield) const throw ( CalculationException )
 Calculate the interest earned on reinvested interest cashflows using the provided reinvestmentYield.
virtual Calculatorclone (void) const

Protected Member Functions

 DelegatingCalculator (const Calculator *calculator)
 Construct a new DelegatingCalculator that delegates all calls to the provided Calculator.
 DelegatingCalculator (const DelegatingCalculator &calculator)

Private Attributes

const Calculatorcalculator

Detailed Description

This interface provides calculation methods that are tuned specifically for the implemented security and for a particular settlement to Redemption period.


Constructor & Destructor Documentation

com::ftlabs::fisa::calc::DelegatingCalculator::DelegatingCalculator ( const Calculator calculator  )  [protected]

Construct a new DelegatingCalculator that delegates all calls to the provided Calculator.

The new DelegatingCalculator assumes ownership of the provided Calculator pointer and will delete the pointer upon deconstruction.

Parameters:
calculator A pointer to the delegated Calculator.

com::ftlabs::fisa::calc::DelegatingCalculator::DelegatingCalculator ( const DelegatingCalculator calculator  )  [protected]

virtual com::ftlabs::fisa::calc::DelegatingCalculator::~DelegatingCalculator ( void   )  [virtual]


Member Function Documentation

DelegatingCalculator& com::ftlabs::fisa::calc::DelegatingCalculator::operator= ( const DelegatingCalculator calculator  ) 

virtual const com::ftlabs::fisa::FISADate& com::ftlabs::fisa::calc::DelegatingCalculator::getSettlementDate ( void   )  const [virtual]

Get the settlement date to which this Calculator is bound.

Returns:
Settlement date.

Implements com::ftlabs::fisa::calc::Calculator.

virtual const com::ftlabs::fisa::Redemption& com::ftlabs::fisa::calc::DelegatingCalculator::getRedemption ( void   )  const [virtual]

Get the Redemption to which this Calculator is bound.

Returns:
Redemption.

Implements com::ftlabs::fisa::calc::Calculator.

virtual const com::ftlabs::fisa::FISADate* com::ftlabs::fisa::calc::DelegatingCalculator::getInterestAccrualDate ( void   )  const [virtual]

Get the date on which interest begins to accrue for this settlement to redemption period.

This method will return dated date if the settlement date is before the first interest date, the coupon date just prior to the settlement date, or the settlement date if it falls on a coupon payment date. This method may not be applicable to all implementations, in which case a 0 should be returned.

Returns:
The date on which interest begins to accrue.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateYield ( double  price  )  const throw ( CalculationException ) [virtual]

Calculate yield for the given price.

Parameters:
price a price
Returns:
yield as calculated for the given price.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateCurrentYield ( double  price  )  const throw ( CalculationException ) [virtual]

Calculate current yield for the given price.

Parameters:
price a price
Returns:
current yield as calculated for the given price.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculatePrice ( double  yield  )  const throw ( CalculationException ) [virtual]

Calculate price for the given yield.

Parameters:
yield a yield
Returns:
price as calculated for the given yield.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateAccruedInterest (  )  const throw ( CalculationException ) [virtual]

Calculate the accrued interest to the settlement date.

Returns:
The accrued interest to the settlement date.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual int com::ftlabs::fisa::calc::DelegatingCalculator::getCashFlowCount (  )  const [virtual]

Get the number of cashflows within the bounding settlement to Redemption period.

Returns:
The number of cashflows within the supported settlement to Redemption period.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::getInterest ( int  cashFlowIndex  )  const [virtual]

Get the interest to be paid for a particular cashflow, as specified by cashFlowIndex.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.

Returns:
The interest to be paid for the specified cashflow.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::getPrincipal ( int  cashFlowIndex  )  const [virtual]

Get the principal to be paid for a particular cashflow, as specified by cashFlowIndex.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.

Returns:
The principal to be paid for the specified cashflow.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::getTotalCashFlow ( int  cashFlowIndex  )  const [virtual]

Get the principal and interest to be paid for a particular cashflow, as specified by cashFlowIndex.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.

Returns:
The principal + interest to be paid for the specified cashflow.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::getTimeToFlow ( int  cashFlowIndex  )  const [virtual]

Get the time to flow for a particular cashflow, as specified by cashFlowIndex.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.

Returns:
The time to flow for the specified cashflow.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::getPeriodicTimeToFlow ( int  cashFlowIndex  )  const [virtual]

Get the periodic time to flow as calculated with an actual day count method for a particular cashflow, as specified by cashFlowIndex. This value is generally used in actual convexity and duration methods.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.
Returns:
The periodic time to flow as calculated with an actual day count method for the specified cashflow.

Implements com::ftlabs::fisa::calc::Calculator.

virtual FISADate com::ftlabs::fisa::calc::DelegatingCalculator::getCashFlowDate ( int  cashFlowIndex  )  const [virtual]

Get a cash flow date for a particular cashflow, as specified by the provided cashFlowIndex.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.
Returns:
The cash flow date for the provided cash flow index.

Implements com::ftlabs::fisa::calc::Calculator.

virtual void com::ftlabs::fisa::calc::DelegatingCalculator::getCashFlowDate ( int  cashFlowIndex,
FISADate date 
) const [virtual]

Set the provided FISADate to the cash flow date of a particular cashflow, as specified by the provided cashFlowIndex.

Parameters:
cashFlowIndex The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1.
date A reference to a FISADate to be set to the specified cash flow date.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculatePeriodicYield ( double  price  )  const throw ( CalculationException ) [virtual]

Calculate a periodic discounted cash flow yield for use with convexity/duration methods.

Parameters:
price the price.
Returns:
Periodic discounted cash flow yield.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateMacaulayDuration ( double  periodicYield  )  const throw ( CalculationException ) [virtual]

Calculate the actual Macaulay duration.

Parameters:
periodicYield The periodicYield as returned from the calculatePeriodicYield method.

Returns:
the Macaulay duration.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateModifiedDuration ( double  periodicYield  )  const throw ( CalculationException ) [virtual]

Calculate the actual modified duration. If Macaulay Duration has already been or will be calculated, then it is more efficient to use the overloaded calculateModifiedDuration method that accepts the Macaulay Duration.

Parameters:
periodicYield The periodicYield as returned from the calculatePeriodicYield method.

Returns:
the modified duration.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateModifiedDuration ( double  macaulayDuration,
double  periodicYield 
) const throw ( CalculationException ) [virtual]

Calculate the actual modified duration using an already calculated Macaulay Duration.

Parameters:
macaulayDuration The Macaulay Duration as calculated by the calculateMacaulayDuration method.
periodicYield The periodicYield as returned from the calculatePeriodicYield method.

Returns:
the modified duration.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateConvexity ( double  periodicYield  )  const throw ( CalculationException ) [virtual]

Calculate the actual convexity.

Parameters:
periodicYield The periodicYield as returned from the calculatePeriodicYield method.

Returns:
the convexity.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculatePriceValue1BP ( double  price,
double  yield 
) const throw ( CalculationException ) [virtual]

Calculate the average price value obtained by varying the yield up and down one basis point.

Returns:
the average price value obtained by varying the yield up and down one basis point.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateYieldValue1_32 ( double  pv1b  )  const throw ( CalculationException ) [virtual]

Calculate the average yield value obtained by varying the price up and down 1/32.

Parameters:
pv1b The average price value obtained by varying the yield up and down one basis point, as returned by the calculatePriceValue1BP method.

Returns:
the average yield value obtained by varying the price up and down 1/32.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateEstimatedMacaulayDuration ( double  pv1b,
double  price,
double  yield 
) const throw ( CalculationException ) [virtual]

Calculate an estimated Macaulay duration.

This is usually faster than the actual Macaulay duration method.

Parameters:
pv1b The average price value obtained by varying the yield up and down one basis point, as returned by the calculatePriceValue1BP method.
price the price.
yield the yield.

Returns:
an estimated Macaulay duration.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateEstimatedModifiedDuration ( double  pv1b,
double  price,
double  yield 
) const throw ( CalculationException ) [virtual]

Calculate an estimated modified duration.

This is usually faster than the actual modified duration method.

Parameters:
pv1b The average price value obtained by varying the yield up and down one basis point, as returned by the calculatePriceValue1BP method.
price the price.
yield the yield.

Returns:
an estimated modified duration.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateEstimatedModifiedDuration ( double  duration,
double  yield 
) const throw ( CalculationException ) [virtual]

Calculate the estimated modified duration.

Parameters:
duration an estimated Macaulay Duration as returned from calculateEstimatedMacaulayDuration.
yield the yield.

Returns:
estimated modified duration.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateEstimatedConvexity ( double  pv1b,
double  price,
double  yield 
) const throw ( CalculationException ) [virtual]

Calculate an estimated convexity.

This is usually faster than the actual convexity method.

Parameters:
pv1b The average price value obtained by varying the yield up and down one basis point, as returned by the calculatePriceValue1BP method.
price the price.
yield the yield.

Returns:
an estimated convexity.

Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateTrueYield ( double  price  )  const throw ( CalculationException ) [virtual]

Calculate a True Yield, using adjusting cashflows that fall on business days.

Cashflow dates are adjusted according to a provided HolidaySchedule and/or weekend days.

Parameters:
price the clean price.
Returns:
The true yield using adjusted cashflows that fall on business days.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateAccruedIncome ( void   )  const throw ( CalculationException ) [virtual]

Calculates the accrued interest income to Redemption.

Returns:
The accrued interest income to redemption.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateAccruedIncome ( const FISADate salesDate  )  const throw ( CalculationException ) [virtual]

Calculates the accrued interest income to the supplied salesDate.

Parameters:
salesDate The projected or actual sales date.
Returns:
The accrued interest income to the supplied salesDate.
Exceptions:
com::ftlabs::fisa::calc::CalculationException CalculationException

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateTotalInterestFlows ( void   )  const throw ( CalculationException ) [virtual]

A convenience method to total all interest cashflows between the settlement to redemption period.

Returns:
The total interest cashflows between the settlement to redemption period.

Implements com::ftlabs::fisa::calc::Calculator.

virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateInterestOnInterest ( double  reinvestmentYield  )  const throw ( CalculationException ) [virtual]

Calculate the interest earned on reinvested interest cashflows using the provided reinvestmentYield.

Parameters:
reinvestmentYield The assumed yield of the reinvested interest cashflows.
Returns:
The interest earned on reinvested interest cashflows.

Implements com::ftlabs::fisa::calc::Calculator.

virtual Calculator* com::ftlabs::fisa::calc::DelegatingCalculator::clone ( void   )  const [virtual]

Implements com::ftlabs::fisa::calc::Calculator.


Member Data Documentation

const Calculator* com::ftlabs::fisa::calc::DelegatingCalculator::calculator [private]


The documentation for this class was generated from the following file:
Generated on Tue Feb 5 03:50:34 2008 for FTLabs FISA (c++) by  doxygen 1.5.2