com.ftlabs.fisa.calc
Class FixedInterestRateCalculator

java.lang.Object
  extended by com.ftlabs.fisa.calc.AbstractCalculator
      extended by com.ftlabs.fisa.calc.MultipleCashFlowCalculator
          extended by com.ftlabs.fisa.calc.MultiplePeriodCalculator
              extended by com.ftlabs.fisa.calc.FixedInterestRateCalculator
All Implemented Interfaces:
Calculator, YieldConvergable, java.io.Serializable
Direct Known Subclasses:
InflationIndexedMultiplePeriodCalculator, MSRBFixedInterestRateCalculator, SimpleYTRFixedInterestRateCalculator

public class FixedInterestRateCalculator
extends MultiplePeriodCalculator

See Also:
Serialized Form

Field Summary
protected  int cashFlowCount
           
protected  double interestRate
           
protected  double taxAdjustedInterestRate
           
protected  double taxAdjustedRedemptionValue
           
 
Fields inherited from class com.ftlabs.fisa.calc.MultiplePeriodCalculator
act_df, act_ldf, aif, df, fcf, lcf, ldf
 
Fields inherited from class com.ftlabs.fisa.calc.MultipleCashFlowCalculator
eomAdjust, interestFrequency, nextCouponDate, parValue, redemption, settlementDate
 
Constructor Summary
protected FixedInterestRateCalculator()
           
  FixedInterestRateCalculator(FISADate settlementDate, Redemption redemption, double parValue, double interestRate, DayCountBasis dayCountBasis, int interestFrequency, boolean eomAdjust, FISADate datedDate, FISADate firstInterestDate)
           
  FixedInterestRateCalculator(FISADate settlementDate, Redemption redemption, double parValue, double interestRate, DayCountBasis dayCountBasis, int interestFrequency, boolean eomAdjust, FISADate datedDate, FISADate firstInterestDate, boolean useFullPrice)
           
 
Method Summary
 Analytics calculate(AnalyticValueType givenType, double givenValue)
          Calculate an Analytics object using the provided AnalyticValueType and value.
 double calculateAccruedInterest()
          Calculate the accrued interest to the settlement date.
 double calculateCurrentYield(double price)
          Calculate current yield for the given price.
 double calculateEstimatedConvexity(double pv1b, double price, double yield)
          Calculate the estimated convexity.
 double calculatePeriodicYield(double price)
          Calculate a periodic discounted cash flow yield for use with convexity/duration methods.
 double calculatePrice(double yield)
          Calculate price for the given yield.
 double calculatePriceValue1BP(double price, double yield)
          Calculate the average price value obtained by varying the yield up and down one basis point.
 double calculateYield(double price)
          Calculate yield for the given price.
 int getCashFlowCount()
          Get the number of cashflows within the supported settlement to Redemption period.
 double getInterest(int cashFlowIndex)
          Get the interest to be paid for a particular cashflow, as specified by cashFlowIndex.
 void setValues(FISADate settlementDate, Redemption redemption, double parValue, double interestRate, DayCountBasis dayCountBasis, int interestFrequency, boolean eomAdjust, FISADate datedDate, FISADate firstInterestDate)
           
 void setValues(FISADate settlementDate, Redemption redemption, double parValue, double interestRate, DayCountBasis dayCountBasis, int interestFrequency, boolean eomAdjust, FISADate datedDate, FISADate firstInterestDate, boolean useFullPrice)
           
 
Methods inherited from class com.ftlabs.fisa.calc.MultiplePeriodCalculator
getPeriodicTimeToFlow, getTimeToFlow, setValues
 
Methods inherited from class com.ftlabs.fisa.calc.MultipleCashFlowCalculator
calculateConvexity, calculateEstimatedMacaulayDuration, calculateEstimatedModifiedDuration, calculateEstimatedModifiedDuration, calculateInterestOnInterest, calculateMacaulayDuration, calculateModifiedDuration, calculateModifiedDuration, calculateYieldValue1_32, getCashFlowDate, getCashFlowDate, getPrincipal, getRedemption, getSettlementDate, getTotalCashFlow, setValues
 
Methods inherited from class com.ftlabs.fisa.calc.AbstractCalculator
calculateApproximateYield, calculateMPCIPrice, calculateSPSIPrice, calculateSPSIYield, calculateTotalInterestFlows
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interestRate

protected double interestRate

cashFlowCount

protected int cashFlowCount

taxAdjustedInterestRate

protected double taxAdjustedInterestRate

taxAdjustedRedemptionValue

protected double taxAdjustedRedemptionValue
Constructor Detail

FixedInterestRateCalculator

protected FixedInterestRateCalculator()

FixedInterestRateCalculator

public FixedInterestRateCalculator(FISADate settlementDate,
                                   Redemption redemption,
                                   double parValue,
                                   double interestRate,
                                   DayCountBasis dayCountBasis,
                                   int interestFrequency,
                                   boolean eomAdjust,
                                   FISADate datedDate,
                                   FISADate firstInterestDate)
                            throws CalculationException
Throws:
CalculationException

FixedInterestRateCalculator

public FixedInterestRateCalculator(FISADate settlementDate,
                                   Redemption redemption,
                                   double parValue,
                                   double interestRate,
                                   DayCountBasis dayCountBasis,
                                   int interestFrequency,
                                   boolean eomAdjust,
                                   FISADate datedDate,
                                   FISADate firstInterestDate,
                                   boolean useFullPrice)
                            throws CalculationException
Throws:
CalculationException
Method Detail

setValues

public void setValues(FISADate settlementDate,
                      Redemption redemption,
                      double parValue,
                      double interestRate,
                      DayCountBasis dayCountBasis,
                      int interestFrequency,
                      boolean eomAdjust,
                      FISADate datedDate,
                      FISADate firstInterestDate)
               throws CalculationException
Throws:
CalculationException

setValues

public void setValues(FISADate settlementDate,
                      Redemption redemption,
                      double parValue,
                      double interestRate,
                      DayCountBasis dayCountBasis,
                      int interestFrequency,
                      boolean eomAdjust,
                      FISADate datedDate,
                      FISADate firstInterestDate,
                      boolean useFullPrice)
               throws CalculationException
Throws:
CalculationException

calculateCurrentYield

public double calculateCurrentYield(double price)
                             throws CalculationException
Description copied from interface: Calculator
Calculate current yield for the given price.

Parameters:
price - price
Returns:
current yield as calculated for the given price.
Throws:
CalculationException

calculateYield

public double calculateYield(double price)
                      throws CalculationException
Description copied from interface: Calculator
Calculate yield for the given price.

Parameters:
price - price
Returns:
yield as calculated for the given price.
Throws:
CalculationException

calculatePrice

public double calculatePrice(double yield)
                      throws CalculationException
Description copied from interface: Calculator
Calculate price for the given yield.

Parameters:
yield - yield
Returns:
price as calculated for the given yield.
Throws:
CalculationException

calculateAccruedInterest

public double calculateAccruedInterest()
                                throws CalculationException
Description copied from interface: Calculator
Calculate the accrued interest to the settlement date.

Returns:
The accrued interest to the settlement date.
Throws:
CalculationException

getCashFlowCount

public int getCashFlowCount()
Description copied from interface: Calculator
Get the number of cashflows within the supported settlement to Redemption period.

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

getInterest

public double getInterest(int cashFlowIndex)
Description copied from interface: Calculator
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.

calculatePeriodicYield

public double calculatePeriodicYield(double price)
                              throws CalculationException
Description copied from interface: Calculator
Calculate a periodic discounted cash flow yield for use with convexity/duration methods.

Parameters:
price - the price.
Returns:
Periodic discounted cash flow yield.
Throws:
CalculationException

calculatePriceValue1BP

public double calculatePriceValue1BP(double price,
                                     double yield)
                              throws CalculationException
Description copied from interface: Calculator
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.
Throws:
CalculationException

calculateEstimatedConvexity

public double calculateEstimatedConvexity(double pv1b,
                                          double price,
                                          double yield)
                                   throws CalculationException
Description copied from interface: Calculator
Calculate the estimated convexity.

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:
estimated convexity.
Throws:
CalculationException

calculate

public Analytics calculate(AnalyticValueType givenType,
                           double givenValue)
                    throws CalculationException
Description copied from interface: Calculator
Calculate an Analytics object using the provided AnalyticValueType and value.

Parameters:
givenType - The AnalyticValueType of the givenValue.
givenValue - The value to calculate the Analytics from.
Throws:
CalculationException