com::ftlabs::fisa::calc::DiscountCalculator Class Reference

#include <DiscountCalculator.h>

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

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

Public Member Functions

 DiscountCalculator (const FISADate &settlementDate, const Redemption &maturity, const double parValue, const DayCountBasis &dayCountBasis, const bool eomAdjust, const FISADate *datedDate, const HolidaySchedule *holidaySchedule) throw ( com::ftlabs::fisa::calc::CalculationException )
 DiscountCalculator (const DiscountCalculator &calculator)
DiscountCalculatoroperator= (const DiscountCalculator &calculator)
 ~DiscountCalculator (void)
void setValues (const FISADate &settlementDate, const Redemption &maturity, const double parValue, const DayCountBasis &dayCountBasis, const bool eomAdjust, const FISADate *datedDate, const HolidaySchedule *holidaySchedule) throw ( com::ftlabs::fisa::calc::CalculationException )
double calculateCurrentYield (double price) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate current yield for the given price.
double calculateYield (double price) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate yield for the given price.
double calculatePrice (double yield) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate price for the given yield.
double calculateAccruedInterest () const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate the accrued interest to the settlement date.
double getInterest (int cashFlowIndex) const
 Get the interest to be paid for a particular cashflow, as specified by cashFlowIndex.
double getPrincipal (int cashFlowIndex) const
 Get the principal to be paid for a particular cashflow, as specified by cashFlowIndex.
double getTimeToFlow (int cashFlowIndex) const
 Get the time to flow for a particular cashflow, as specified by cashFlowIndex.
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.
double calculatePriceValue1BP (double price, double yield) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate the average price value obtained by varying the yield up and down one basis point.
double calculateYieldValue1_32 (double pv1b) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate the average yield value obtained by varying the price up and down 1/32.
double calculateEstimatedMacaulayDuration (double pv1b, double price, double yield) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate an estimated Macaulay duration.
double calculateEstimatedModifiedDuration (double pv1b, double price, double yield) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate an estimated modified duration.
double calculateEstimatedModifiedDuration (double duration, double yield) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate the estimated modified duration.
double calculateEstimatedConvexity (double pv1b, double price, double yield) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate an estimated convexity.
double calculateTrueYield (double price) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate a True Yield, using adjusting cashflows that fall on business days.
virtual double calculatePriceFromDiscount (double discount) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate price from discount.
virtual double calculateDiscount (double price) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate a discount value from a given price.
virtual double calculateCEY (double price) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate a coupon equivalent yield (CEY) from the given price.
virtual double calculateBEY (double price) const throw ( com::ftlabs::fisa::calc::CalculationException )
 Calculate a bond equivalent yield (BEY) from the given price.
virtual Calculatorclone (void) const

Private Attributes

double taxAdjustedRedemptionValue
double df
double daysRemaining
double diy
double periodicTTF
double ty_df

Constructor & Destructor Documentation

com::ftlabs::fisa::calc::DiscountCalculator::DiscountCalculator ( const FISADate settlementDate,
const Redemption maturity,
const double  parValue,
const DayCountBasis dayCountBasis,
const bool  eomAdjust,
const FISADate datedDate,
const HolidaySchedule holidaySchedule 
) throw ( com::ftlabs::fisa::calc::CalculationException )

com::ftlabs::fisa::calc::DiscountCalculator::DiscountCalculator ( const DiscountCalculator calculator  ) 

com::ftlabs::fisa::calc::DiscountCalculator::~DiscountCalculator ( void   ) 


Member Function Documentation

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

void com::ftlabs::fisa::calc::DiscountCalculator::setValues ( const FISADate settlementDate,
const Redemption maturity,
const double  parValue,
const DayCountBasis dayCountBasis,
const bool  eomAdjust,
const FISADate datedDate,
const HolidaySchedule holidaySchedule 
) throw ( com::ftlabs::fisa::calc::CalculationException )

double com::ftlabs::fisa::calc::DiscountCalculator::calculateCurrentYield ( double  price  )  const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateYield ( double  price  )  const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculatePrice ( double  yield  )  const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateAccruedInterest (  )  const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::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.

double com::ftlabs::fisa::calc::DiscountCalculator::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.

double com::ftlabs::fisa::calc::DiscountCalculator::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.

double com::ftlabs::fisa::calc::DiscountCalculator::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculatePriceValue1BP ( double  price,
double  yield 
) const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateYieldValue1_32 ( double  pv1b  )  const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateEstimatedMacaulayDuration ( double  pv1b,
double  price,
double  yield 
) const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateEstimatedModifiedDuration ( double  pv1b,
double  price,
double  yield 
) const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateEstimatedModifiedDuration ( double  duration,
double  yield 
) const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateEstimatedConvexity ( double  pv1b,
double  price,
double  yield 
) const throw ( com::ftlabs::fisa::calc::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.

double com::ftlabs::fisa::calc::DiscountCalculator::calculateTrueYield ( double  price  )  const throw ( com::ftlabs::fisa::calc::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

Reimplemented from com::ftlabs::fisa::calc::OneCashFlowCalculator.

virtual double com::ftlabs::fisa::calc::DiscountCalculator::calculatePriceFromDiscount ( double  discount  )  const throw ( com::ftlabs::fisa::calc::CalculationException ) [virtual]

Calculate price from discount.

Parameters:
discount The discount rate.
Returns:
The price

virtual double com::ftlabs::fisa::calc::DiscountCalculator::calculateDiscount ( double  price  )  const throw ( com::ftlabs::fisa::calc::CalculationException ) [virtual]

Calculate a discount value from a given price.

Parameters:
price The price.
Returns:
The discount rate.

virtual double com::ftlabs::fisa::calc::DiscountCalculator::calculateCEY ( double  price  )  const throw ( com::ftlabs::fisa::calc::CalculationException ) [virtual]

Calculate a coupon equivalent yield (CEY) from the given price.

If datedDate is present, then the number of days in a year is counted as a 1 year period forward from the dated date. Otherwise, it is a 1 year period backward from the maturity date.

Parameters:
price The price as a percentage of par.
Returns:
A Coupon Equivalent yield.

virtual double com::ftlabs::fisa::calc::DiscountCalculator::calculateBEY ( double  price  )  const throw ( com::ftlabs::fisa::calc::CalculationException ) [virtual]

Calculate a bond equivalent yield (BEY) from the given price.

If datedDate is present, then the number of days in a year is counted as the 1 year period forward from the dated date. Otherwise, it is the 1 year period backward from the maturity date.

Parameters:
price The price as a percentage of par.
Returns:
A Bond Equivalent yield.

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

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


Member Data Documentation

double com::ftlabs::fisa::calc::DiscountCalculator::taxAdjustedRedemptionValue [private]

double com::ftlabs::fisa::calc::DiscountCalculator::df [private]

double com::ftlabs::fisa::calc::DiscountCalculator::daysRemaining [private]

double com::ftlabs::fisa::calc::DiscountCalculator::diy [private]

double com::ftlabs::fisa::calc::DiscountCalculator::periodicTTF [private]

double com::ftlabs::fisa::calc::DiscountCalculator::ty_df [private]


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