#include <DelegatingCalculator.h>
Inheritance diagram for com::ftlabs::fisa::calc::DelegatingCalculator:

Public Member Functions | |
| virtual | ~DelegatingCalculator (void) |
| DelegatingCalculator & | operator= (const DelegatingCalculator &calculator) |
| virtual const com::ftlabs::fisa::FISADate & | getSettlementDate (void) const |
| Get the settlement date to which this Calculator is bound. | |
| virtual const com::ftlabs::fisa::Redemption & | getRedemption (void) const |
| Get the Redemption to which this Calculator is bound. | |
| virtual const com::ftlabs::fisa::FISADate * | getInterestAccrualDate (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 Calculator * | clone (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 Calculator * | calculator |
| 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.
| 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] |
| 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.
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.
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.
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.
| price | a price |
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.
| price | a price |
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.
| yield | a yield |
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.
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.
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.
| cashFlowIndex | The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1. |
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.
| cashFlowIndex | The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1. |
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.
| cashFlowIndex | The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1. |
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.
| cashFlowIndex | The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1. |
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.
| cashFlowIndex | The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1. |
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.
| cashFlowIndex | The cashflow index. cashFlowIndex is zero based and must be a number from 0 to getCashFlowCount() - 1. |
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.
| 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.
| price | the price. |
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.
| periodicYield | The periodicYield as returned from the calculatePeriodicYield method. |
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.
| periodicYield | The periodicYield as returned from the calculatePeriodicYield method. |
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.
| macaulayDuration | The Macaulay Duration as calculated by the calculateMacaulayDuration method. | |
| periodicYield | The periodicYield as returned from the calculatePeriodicYield method. |
Implements com::ftlabs::fisa::calc::Calculator.
| virtual double com::ftlabs::fisa::calc::DelegatingCalculator::calculateConvexity | ( | double | periodicYield | ) | const throw ( CalculationException ) [virtual] |
Calculate the actual convexity.
| periodicYield | The periodicYield as returned from the calculatePeriodicYield method. |
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.
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.
| pv1b | The average price value obtained by varying the yield up and down one basis point, as returned by the calculatePriceValue1BP method. |
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.
| 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. |
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.
| 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. |
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.
| duration | an estimated Macaulay Duration as returned from calculateEstimatedMacaulayDuration. | |
| yield | the yield. |
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.
| 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. |
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.
| price | the clean price. |
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.
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.
| salesDate | The projected or actual sales date. |
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.
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.
| reinvestmentYield | The assumed yield of the 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.
const Calculator* com::ftlabs::fisa::calc::DelegatingCalculator::calculator [private] |
1.5.2