com.ftlabs.fisa.calc
Class DefaultAnalytics

java.lang.Object
  extended by com.ftlabs.fisa.calc.DefaultAnalytics
All Implemented Interfaces:
Analytics, java.io.Serializable

public class DefaultAnalytics
extends java.lang.Object
implements Analytics

An implementation of Analytics that attempts to balance memory and CPU usage by caching only the values with more complex formulas, and values that are needed for multiple methods.

See Also:
Serialized Form

Field Summary
protected  double intOnInt
           
protected  double totalInterestFlows
           
 
Constructor Summary
DefaultAnalytics(Calculator calculator, double price)
           
DefaultAnalytics(Calculator calculator, double price, double yield)
           
 
Method Summary
 double getAccruedInterest()
          Get the accrued interest.
 double getAnalyticValue(AnalyticValueType type)
          Get an analytic value of the provided AnalyticValueType.
 Calculator getCalculator()
          Get the calculator that was used to create this Analytics object.
 double getConvexity()
          Get the convexity.
 double getEstimatedConvexity()
          Get the estimated convexity.
 double getEstimatedMacaulayDuration()
          Get the estimated Macaulay duration.
 double getEstimatedModifiedDuration()
          Get the estimated modified duration.
 double getInterestOnInterest()
          Get interest on interest using an assumed reinvestment yield that is equal to yield.
 double getInterestOnInterest(double reinvestmentYield)
          Get interest on interest.
 double getMacaulayDuration()
          Get the Macaulay duration
 double getModifiedDuration()
          Get the modified duration
 double getPrice()
          Get the price.
 double getPriceValue1BP()
          Get the average price value obtained by varying the yield up and down by one basis point.
 Redemption getRedemption()
          Get the Redemption object to which this Analytics object is calculated.
 double getTotalInterestFlows()
          Get the total interest flows.
 double getYield()
          Get the yield.
 double getYieldValue1_32()
          Get the average yield value obtained by varying the price up and down by 1/32.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

totalInterestFlows

protected double totalInterestFlows

intOnInt

protected double intOnInt
Constructor Detail

DefaultAnalytics

public DefaultAnalytics(Calculator calculator,
                        double price)

DefaultAnalytics

public DefaultAnalytics(Calculator calculator,
                        double price,
                        double yield)
Method Detail

getRedemption

public Redemption getRedemption()
Get the Redemption object to which this Analytics object is calculated.

Specified by:
getRedemption in interface Analytics
Returns:
the Redemption object to which this Analytics object is calculated.

getCalculator

public Calculator getCalculator()
Get the calculator that was used to create this Analytics object.

Specified by:
getCalculator in interface Analytics
Returns:
the calculator that was used to create this Analtyics object.

getPrice

public double getPrice()
                throws CalculationException
Get the price.

Specified by:
getPrice in interface Analytics
Returns:
price.
Throws:
CalculationException

getYield

public double getYield()
                throws CalculationException
Get the yield.

Specified by:
getYield in interface Analytics
Returns:
yield.
Throws:
CalculationException

getAnalyticValue

public double getAnalyticValue(AnalyticValueType type)
                        throws CalculationException
Get an analytic value of the provided AnalyticValueType.

Specified by:
getAnalyticValue in interface Analytics
Parameters:
type - the type of analytic value to get
Returns:
yield.
Throws:
CalculationException

getMacaulayDuration

public double getMacaulayDuration()
                           throws CalculationException
Get the Macaulay duration

Specified by:
getMacaulayDuration in interface Analytics
Returns:
Macaulay duration.
Throws:
CalculationException

getModifiedDuration

public double getModifiedDuration()
                           throws CalculationException
Get the modified duration

Specified by:
getModifiedDuration in interface Analytics
Returns:
modified duration.
Throws:
CalculationException

getConvexity

public double getConvexity()
                    throws CalculationException
Get the convexity.

Specified by:
getConvexity in interface Analytics
Returns:
convexity.
Throws:
CalculationException

getPriceValue1BP

public double getPriceValue1BP()
                        throws CalculationException
Get the average price value obtained by varying the yield up and down by one basis point.

Specified by:
getPriceValue1BP in interface Analytics
Returns:
the average price value obtained by varying the yield up and down by one basis point.
Throws:
CalculationException

getYieldValue1_32

public double getYieldValue1_32()
                         throws CalculationException
Get the average yield value obtained by varying the price up and down by 1/32.

Specified by:
getYieldValue1_32 in interface Analytics
Returns:
the average yield value obtained by varying the price up and down by 1/32.
Throws:
CalculationException

getEstimatedMacaulayDuration

public double getEstimatedMacaulayDuration()
                                    throws CalculationException
Get the estimated Macaulay duration.

Specified by:
getEstimatedMacaulayDuration in interface Analytics
Returns:
estimated Macaulay duration.
Throws:
CalculationException

getEstimatedModifiedDuration

public double getEstimatedModifiedDuration()
                                    throws CalculationException
Get the estimated modified duration.

Specified by:
getEstimatedModifiedDuration in interface Analytics
Returns:
estimated modified duration.
Throws:
CalculationException

getEstimatedConvexity

public double getEstimatedConvexity()
                             throws CalculationException
Get the estimated convexity.

Specified by:
getEstimatedConvexity in interface Analytics
Returns:
estimated convexity.
Throws:
CalculationException

getTotalInterestFlows

public double getTotalInterestFlows()
                             throws CalculationException
Get the total interest flows.

Specified by:
getTotalInterestFlows in interface Analytics
Returns:
the total interest flows.
Throws:
CalculationException

getInterestOnInterest

public double getInterestOnInterest()
                             throws CalculationException
Get interest on interest using an assumed reinvestment yield that is equal to yield.

Specified by:
getInterestOnInterest in interface Analytics
Returns:
interest on interest
Throws:
CalculationException

getInterestOnInterest

public double getInterestOnInterest(double reinvestmentYield)
                             throws CalculationException
Get interest on interest.

Specified by:
getInterestOnInterest in interface Analytics
Parameters:
reinvestmentYield -
Returns:
interest on interest
Throws:
CalculationException

getAccruedInterest

public double getAccruedInterest()
                          throws CalculationException
Get the accrued interest.

Specified by:
getAccruedInterest in interface Analytics
Returns:
accrued interest.
Throws:
CalculationException