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

Public Member Functions | |
| virtual | ~MultiplePeriodCalculator (void) |
| const FISADate & | getSettlementDate () const |
| Get the settlement date to which this Calculator is bound. | |
| const Redemption & | getRedemption () const |
| Get the Redemption to which this Calculator is bound. | |
| const FISADate * | getInterestAccrualDate (void) const |
| Get the date on which interest begins to accrue for this settlement to redemption period. | |
| double | getPrincipal (int cashFlowIndex) const |
| Get the principal to be paid for a particular cashflow, as specified by cashFlowIndex. | |
| double | getTotalCashFlow (int cashFlowIndex) const |
| Get the principal and interest 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. | |
| FISADate | getCashFlowDate (int cashFlowIndex) const |
| Get a cash flow date for a particular cashflow, as specified by the provided cashFlowIndex. | |
| 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. | |
| double | calculateYieldValue1_32 (double pv1b) const throw ( 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 ( CalculationException ) |
| Calculate an estimated Macaulay duration. | |
| double | calculateEstimatedModifiedDuration (double pv1b, double price, double yield) const throw ( CalculationException ) |
| Calculate an estimated modified duration. | |
| double | calculateEstimatedModifiedDuration (double duration, double yield) const throw ( CalculationException ) |
| Calculate the estimated modified duration. | |
| virtual double | calculateAccruedIncome (const FISADate &salesDate) const throw ( CalculationException ) |
| Calculates the accrued interest income to the supplied salesDate. | |
| virtual double | calculateInterestOnInterest (double reinvestmentYield) const throw ( CalculationException ) |
| Calculate the interest earned on reinvested interest cashflows using the provided reinvestmentYield. | |
Protected Member Functions | |
| MultiplePeriodCalculator (void) | |
| MultiplePeriodCalculator (const FISADate &settlementDate, const FISADate *exDividendDate, const Redemption &redemption, double parValue, const DayCountBasis &dayCountBasis, int interestFrequency, bool eomAdjust, const FISADate *datedDate, const FISADate *firstInterestDate) throw ( CalculationException ) | |
| MultiplePeriodCalculator (const MultiplePeriodCalculator &calculator) | |
| MultiplePeriodCalculator & | operator= (const MultiplePeriodCalculator &calculator) |
| void | setValues (const FISADate &settlementDate, const FISADate *exDividendDate, const Redemption &redemption, double parValue, const DayCountBasis &dayCountBasis, int interestFrequency, bool eomAdjust, const FISADate *datedDate, const FISADate *firstInterestDate) throw ( CalculationException ) |
Protected Attributes | |
| FISADate | settlementDate |
| Redemption | redemption |
| FISADate | interestAccrualDate |
| FISADate | nextCouponDate |
| double | parValue |
| bool | eomAdjust |
| const DayCountBasis * | dayCountBasis |
| double | aif |
| double | fcf |
| double | df |
| double | lcf |
| double | ldf |
| double | act_df |
| double | act_ldf |
Private Types | |
| typedef const std::map< FISADate, double > | partial_payments_map |
Private Member Functions | |
| void | calculateNormalFirstPeriodFactors (const FISADate &prevDate, const FISADate &nextDate, const DayCountBasis &dayCountBasis, int interestFrequency, bool eomAdjust, bool tradingExDividend) |
| void | calculateShortFirstPeriodFactors (const FISADate &quasiDatedDate, const FISADate &datedDate, const FISADate &firstInterestDate, const DayCountBasis &dayCountBasis, int interestFrequency, bool eomAdjust, bool tradingExDividend) |
| void | calculateLongFirstPeriodFactors (CouponDateGenerator &couponDates, const FISADate &datedDate, const FISADate &firstInterestDate, const DayCountBasis &dayCountBasis, int interestFrequency, bool eomAdjust, bool tradingExDividend) |
typedef const std::map<FISADate, double> com::ftlabs::fisa::calc::MultiplePeriodCalculator::partial_payments_map [private] |
| com::ftlabs::fisa::calc::MultiplePeriodCalculator::MultiplePeriodCalculator | ( | void | ) | [protected] |
| com::ftlabs::fisa::calc::MultiplePeriodCalculator::MultiplePeriodCalculator | ( | const FISADate & | settlementDate, | |
| const FISADate * | exDividendDate, | |||
| const Redemption & | redemption, | |||
| double | parValue, | |||
| const DayCountBasis & | dayCountBasis, | |||
| int | interestFrequency, | |||
| bool | eomAdjust, | |||
| const FISADate * | datedDate, | |||
| const FISADate * | firstInterestDate | |||
| ) | throw ( CalculationException ) [protected] |
| com::ftlabs::fisa::calc::MultiplePeriodCalculator::MultiplePeriodCalculator | ( | const MultiplePeriodCalculator & | calculator | ) | [protected] |
| virtual com::ftlabs::fisa::calc::MultiplePeriodCalculator::~MultiplePeriodCalculator | ( | void | ) | [virtual] |
| MultiplePeriodCalculator& com::ftlabs::fisa::calc::MultiplePeriodCalculator::operator= | ( | const MultiplePeriodCalculator & | calculator | ) | [protected] |
| void com::ftlabs::fisa::calc::MultiplePeriodCalculator::setValues | ( | const FISADate & | settlementDate, | |
| const FISADate * | exDividendDate, | |||
| const Redemption & | redemption, | |||
| double | parValue, | |||
| const DayCountBasis & | dayCountBasis, | |||
| int | interestFrequency, | |||
| bool | eomAdjust, | |||
| const FISADate * | datedDate, | |||
| const FISADate * | firstInterestDate | |||
| ) | throw ( CalculationException ) [protected] |
| const FISADate& com::ftlabs::fisa::calc::MultiplePeriodCalculator::getSettlementDate | ( | ) | const [virtual] |
Get the settlement date to which this Calculator is bound.
Implements com::ftlabs::fisa::calc::Calculator.
| const Redemption& com::ftlabs::fisa::calc::MultiplePeriodCalculator::getRedemption | ( | ) | const [virtual] |
Get the Redemption to which this Calculator is bound.
Implements com::ftlabs::fisa::calc::Calculator.
| const FISADate* com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| FISADate com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| void com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
Reimplemented in com::ftlabs::fisa::calc::JapaneseCalculator.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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::MultiplePeriodCalculator::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.
Reimplemented in com::ftlabs::fisa::calc::FixedInterestRateCalculator, and com::ftlabs::fisa::calc::SteppedCouponCalculator.
| virtual double com::ftlabs::fisa::calc::MultiplePeriodCalculator::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.
| void com::ftlabs::fisa::calc::MultiplePeriodCalculator::calculateNormalFirstPeriodFactors | ( | const FISADate & | prevDate, | |
| const FISADate & | nextDate, | |||
| const DayCountBasis & | dayCountBasis, | |||
| int | interestFrequency, | |||
| bool | eomAdjust, | |||
| bool | tradingExDividend | |||
| ) | [private] |
| void com::ftlabs::fisa::calc::MultiplePeriodCalculator::calculateShortFirstPeriodFactors | ( | const FISADate & | quasiDatedDate, | |
| const FISADate & | datedDate, | |||
| const FISADate & | firstInterestDate, | |||
| const DayCountBasis & | dayCountBasis, | |||
| int | interestFrequency, | |||
| bool | eomAdjust, | |||
| bool | tradingExDividend | |||
| ) | [private] |
| void com::ftlabs::fisa::calc::MultiplePeriodCalculator::calculateLongFirstPeriodFactors | ( | CouponDateGenerator & | couponDates, | |
| const FISADate & | datedDate, | |||
| const FISADate & | firstInterestDate, | |||
| const DayCountBasis & | dayCountBasis, | |||
| int | interestFrequency, | |||
| bool | eomAdjust, | |||
| bool | tradingExDividend | |||
| ) | [private] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::parValue [protected] |
bool com::ftlabs::fisa::calc::MultiplePeriodCalculator::eomAdjust [protected] |
const DayCountBasis* com::ftlabs::fisa::calc::MultiplePeriodCalculator::dayCountBasis [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::aif [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::fcf [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::df [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::lcf [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::ldf [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::act_df [protected] |
double com::ftlabs::fisa::calc::MultiplePeriodCalculator::act_ldf [protected] |
1.5.2