com.ftlabs.fisa
Class MaturingSecurity

java.lang.Object
  extended by com.ftlabs.fisa.AbstractSecurity
      extended by com.ftlabs.fisa.MaturingSecurity
All Implemented Interfaces:
Security, java.io.Serializable
Direct Known Subclasses:
DiscountSecurity, MaturingCallableSecurity

public abstract class MaturingSecurity
extends AbstractSecurity

An abstract implementation of Security for securities that mature.

See Also:
Serialized Form

Constructor Summary
MaturingSecurity(Market market)
          Creates a MaturingSecurity object of the given Market.
 
Method Summary
 Analytics calculate(AnalyticValueType givenType, double givenValue, FISADate settlementDate)
          A convenience method to calculate an Analytics object using the provided value and settlementDate to Maturity period.
 Analytics calculate(AnalyticValueType givenType, double givenValue, FISADate settlementDate, Redemption redemption)
          A convenience method to calculate an Analytics object using the provided value and settlementDate to Redemption period.
 double calculateAccruedInterest(FISADate settlementDate)
          A convenience method to calculate the accrued interest for the provided settlementDate.
 double calculatePrice(double yield, FISADate settlementDate)
          A convenience method to calculate the price from the provided yield and settlementDate to maturity Redemption period.
 double calculatePrice(double yield, FISADate settlementDate, Redemption redemption)
          A convenience method to calculate the price from the provided yield and settlement to Redemption period.
 double calculateYield(double price, FISADate settlementDate)
          A convenience method to calculate the yield from the provided price and settlementDate to maturity Redemption period.
 double calculateYield(double price, FISADate settlementDate, Redemption redemption)
          A convenience method to calculate the yield from the provided price and settlement to Redemption period.
 QuoteAnalytics createQuoteAnalytics(Quote quote, FISADate settlementDate)
           
 Calculator getCalculator(FISADate settlementDate)
          Get a Calculator for this Security and provided settlementDate.
 Redemption getMaturity()
          Get the maturity Redemption.
 FISADate getMaturityDate()
          A convenience method to get the current maturityDate.
 java.util.Collection getRedemptions()
          Get a Collection that only contains maturity.
 void setMaturity(FISADate maturityDate)
          Sets maturity to a new Redemption object for the given maturityDate with a default redemption value of 100.
 void setMaturity(FISADate maturityDate, double redemptionValue)
          Sets maturity to a new Redemption object for the given maturityDate and redemptionValue.
 void setMaturity(Redemption maturity)
          Set the maturity Redemption.
 
Methods inherited from class com.ftlabs.fisa.AbstractSecurity
addSecurityInvalidationListener, getDatedDate, getDayCountBasis, getMarket, getParValue, invalidate, isEomAdjust, removeSecurityInvalidationListener, setDatedDate, setDayCountBasis, setEomAdjust, setParValue
 
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.Security
getCalculator
 

Constructor Detail

MaturingSecurity

public MaturingSecurity(Market market)
Creates a MaturingSecurity object of the given Market.

Parameters:
market - required and immutable Market for this security. This constructor will throw a java.lang.NullPointerException if Market is null.
Method Detail

getMaturity

public final Redemption getMaturity()
Get the maturity Redemption.

Returns:
The maturity Redemption.

getMaturityDate

public final FISADate getMaturityDate()
A convenience method to get the current maturityDate. This method returns getMaturity().getDate(), or null if getMaturity() is null.

Returns:
the current maturityDate, or null if it has not been set.

setMaturity

public final void setMaturity(Redemption maturity)
Set the maturity Redemption.

Parameters:
maturity - New maturity Redemption.

setMaturity

public final void setMaturity(FISADate maturityDate,
                              double redemptionValue)
Sets maturity to a new Redemption object for the given maturityDate and redemptionValue.

Parameters:
maturityDate - the date on which the security matures
redemptionValue - the redemption value at maturity

setMaturity

public final void setMaturity(FISADate maturityDate)
Sets maturity to a new Redemption object for the given maturityDate with a default redemption value of 100.

Parameters:
maturityDate - the date on which the security matures

getCalculator

public Calculator getCalculator(FISADate settlementDate)
                         throws CalculationException
Get a Calculator for this Security and provided settlementDate. The maturity Redemption will be used with this settlementDate to create a new Calculator.

Parameters:
settlementDate - The binding settlementDate for which all calculations will be run.
Returns:
A Calculator for this Security and provided settlement date to maturity Redemption period.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

createQuoteAnalytics

public QuoteAnalytics createQuoteAnalytics(Quote quote,
                                           FISADate settlementDate)
                                    throws CalculationException
Throws:
CalculationException

calculatePrice

public double calculatePrice(double yield,
                             FISADate settlementDate)
                      throws CalculationException
A convenience method to calculate the price from the provided yield and settlementDate to maturity Redemption period.

Parameters:
yield - The yield.
settlementDate - The settlement date.
Returns:
The price of this Security for the provided yield and settlement date.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

calculatePrice

public double calculatePrice(double yield,
                             FISADate settlementDate,
                             Redemption redemption)
                      throws CalculationException
A convenience method to calculate the price from the provided yield and settlement to Redemption period.

Parameters:
yield - The yield.
settlementDate - The settlement date for which this calculation is run.
redemption - The Redemption to which this calculation is run.
Returns:
The price of this Security for the provided yield and settlement to Redemption period.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

calculateYield

public double calculateYield(double price,
                             FISADate settlementDate)
                      throws CalculationException
A convenience method to calculate the yield from the provided price and settlementDate to maturity Redemption period.

Parameters:
price - The price.
settlementDate - The settlement date.
Returns:
The price of this Security for the provided price and settlement date.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

calculateYield

public double calculateYield(double price,
                             FISADate settlementDate,
                             Redemption redemption)
                      throws CalculationException
A convenience method to calculate the yield from the provided price and settlement to Redemption period.

Parameters:
price - The price.
settlementDate - The settlement date for which this calculation is run.
redemption - The Redemption to which this calculation is run.
Returns:
The yield of this Security for the provided price and settlement to Redemption period.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

calculate

public Analytics calculate(AnalyticValueType givenType,
                           double givenValue,
                           FISADate settlementDate)
                    throws CalculationException
A convenience method to calculate an Analytics object using the provided value and settlementDate to Maturity period.

Parameters:
givenType - The AnalyticValueType of the givenValue.
givenValue - The value to calculate the Analytics from.
settlementDate - The settlement date.
Returns:
The Analytics for this Security calcluated from the provided value and settlement date.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

calculate

public Analytics calculate(AnalyticValueType givenType,
                           double givenValue,
                           FISADate settlementDate,
                           Redemption redemption)
                    throws CalculationException
A convenience method to calculate an Analytics object using the provided value and settlementDate to Redemption period.

Parameters:
givenType - The AnalyticValueType of the givenValue.
givenValue - The value to calculate the Analytics from.
settlementDate - The settlement date.
redemption - The Redemption.
Returns:
The Analytics for this Security calcluated from the provided value and settlementDate to Redemption period.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

calculateAccruedInterest

public double calculateAccruedInterest(FISADate settlementDate)
                                throws CalculationException
A convenience method to calculate the accrued interest for the provided settlementDate.

Parameters:
settlementDate - The settlement date.
Returns:
The accrued interest of this Security for the provided settlement date.
Throws:
com.ftlabs.fis.calc.CalculationException
CalculationException

getRedemptions

public java.util.Collection getRedemptions()
Get a Collection that only contains maturity.

Returns:
a Collection that only contains maturity.