com.ftlabs.fisa.calc
Class AbstractCalculator

java.lang.Object
  extended by com.ftlabs.fisa.calc.AbstractCalculator
All Implemented Interfaces:
Calculator, YieldConvergable, java.io.Serializable
Direct Known Subclasses:
DiscountCalculator, InterestAtMaturityCalculator, LastPeriodCalculator, MultipleCashFlowCalculator, ZeroCouponCalculator

public abstract class AbstractCalculator
extends java.lang.Object
implements Calculator

See Also:
Serialized Form

Constructor Summary
AbstractCalculator()
           
 
Method Summary
protected static double calculateApproximateYield(double price, double redemptionValue, double interestRate, int interestFrequency, int remainingPeriods)
          price and redemptionValue are passed as per one currency unit of face value
protected static double calculateMPCIPrice(double yield, double redemptionValue, double interestRate, int interestFrequency, int remainingPeriods, double aif, double df, double fcf, double lcf, double ldf)
          This calculates a Multiple Period Compounded Interest price, per one currency unit of face value.
protected static double calculateSPSIPrice(double yield, double redemptionValue, double interestRate, int interestFrequency, double aif, double df, double lcf)
          This calculates a Single Period Simple Interest price.
protected static double calculateSPSIYield(double price, double redemptionValue, double interestRate, int interestFrequency, double aif, double df, double lcf)
          This calculates a Single Period Simple Interest yield.
 double calculateTotalInterestFlows()
          A convenience method to total all interest cashflows between the settlement to redemption period.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ftlabs.fisa.calc.Calculator
calculate, calculateAccruedInterest, calculateConvexity, calculateCurrentYield, calculateEstimatedConvexity, calculateEstimatedMacaulayDuration, calculateEstimatedModifiedDuration, calculateEstimatedModifiedDuration, calculateInterestOnInterest, calculateMacaulayDuration, calculateModifiedDuration, calculateModifiedDuration, calculatePeriodicYield, calculatePrice, calculatePriceValue1BP, calculateYield, calculateYieldValue1_32, getCashFlowCount, getCashFlowDate, getCashFlowDate, getInterest, getPeriodicTimeToFlow, getPrincipal, getRedemption, getSettlementDate, getTimeToFlow, getTotalCashFlow
 

Constructor Detail

AbstractCalculator

public AbstractCalculator()
Method Detail

calculateMPCIPrice

protected static double calculateMPCIPrice(double yield,
                                           double redemptionValue,
                                           double interestRate,
                                           int interestFrequency,
                                           int remainingPeriods,
                                           double aif,
                                           double df,
                                           double fcf,
                                           double lcf,
                                           double ldf)
                                    throws CalculationException
This calculates a Multiple Period Compounded Interest price, per one currency unit of face value.

Parameters:
redemptionValue - The redemption value per one currency unit of face value, with any applicable tax adjustments included.
Throws:
CalculationException

calculateSPSIPrice

protected static double calculateSPSIPrice(double yield,
                                           double redemptionValue,
                                           double interestRate,
                                           int interestFrequency,
                                           double aif,
                                           double df,
                                           double lcf)
                                    throws CalculationException
This calculates a Single Period Simple Interest price.

Throws:
CalculationException

calculateSPSIYield

protected static double calculateSPSIYield(double price,
                                           double redemptionValue,
                                           double interestRate,
                                           int interestFrequency,
                                           double aif,
                                           double df,
                                           double lcf)
                                    throws CalculationException
This calculates a Single Period Simple Interest yield.

Parameters:
price - The price value per one currency unit of face value.
redemptionValue - The redemption value per one currency unit of face value, with any applicable tax adjustments included.
Throws:
CalculationException

calculateApproximateYield

protected static double calculateApproximateYield(double price,
                                                  double redemptionValue,
                                                  double interestRate,
                                                  int interestFrequency,
                                                  int remainingPeriods)
price and redemptionValue are passed as per one currency unit of face value


calculateTotalInterestFlows

public double calculateTotalInterestFlows()
                                   throws CalculationException
A convenience method to total all interest cashflows between the settlement to redemption period.

Specified by:
calculateTotalInterestFlows in interface Calculator
Returns:
The total interest cashflows between the settlement to redemption period.
Throws:
CalculationException