Class CompositePeriod

java.lang.Object
org.drip.analytics.cashflow.CompositePeriod
Direct Known Subclasses:
CompositeFixedPeriod, CompositeFloatingPeriod

public abstract class CompositePeriod
extends java.lang.Object
CompositePeriod implements the Composite Coupon Period Functionality. It contains the Composite Period Coupon Frequency, Tenor, Accrual Compounding Rule, Day Count, Base Notional, Coupon/Notional Schedules, Pay Currency, Credit Label, FX Fixing Setting, and the List of Composable Period Units.

Author:
Lakshmi Krishnamurthy
  • Method Details

    • periods

      public java.util.List<ComposableUnitPeriod> periods()
      Retrieve the List of Composable Periods
      Returns:
      The List of Composable Periods
    • startDate

      public int startDate()
      Retrieve the Period Start Date
      Returns:
      The Period Start Date
    • endDate

      public int endDate()
      Retrieve the Period End Date
      Returns:
      The Period End Date
    • contains

      public boolean contains​(int iDate)
      Check whether the supplied Date is inside the Period specified
      Parameters:
      iDate - Date
      Returns:
      TRUE - The specified Date is inside the Period
    • enclosingCUP

      public ComposableUnitPeriod enclosingCUP​(int iDate)
      Return the Unit Period to which the Date belongs
      Parameters:
      iDate - Date
      Returns:
      The Unit Period to which the Date belongs
    • accrualCompoundingRule

      public int accrualCompoundingRule()
      Retrieve the Accrual Compounding Rule
      Returns:
      The Accrual Compounding Rule
    • payDate

      public int payDate()
      Return the Period Pay Date
      Returns:
      Period Pay Date
    • fxFixingDate

      public int fxFixingDate() throws java.lang.Exception
      Return the Period FX Fixing Date
      Returns:
      Period FX Fixing Date
      Throws:
      java.lang.Exception - Thrown if FX Fixing Date cannot be generated
    • isFXMTM

      public boolean isFXMTM()
      Is this Cash Flow FX MTM?
      Returns:
      TRUE - FX MTM is on (i.e., FX is not Driven by Fixing)
    • fx

      public double fx​(CurveSurfaceQuoteContainer csqc) throws java.lang.Exception
      Coupon Period FX
      Parameters:
      csqc - Market Parameters
      Returns:
      The Period FX
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • freq

      public int freq()
      Retrieve the Coupon Frequency
      Returns:
      The Coupon Frequency
    • tenor

      public java.lang.String tenor()
      Convert the Coupon Frequency into a Tenor
      Returns:
      The Coupon Frequency converted into a Tenor
    • payCurrency

      public java.lang.String payCurrency()
      Retrieve the Pay Currency
      Returns:
      The Pay Currency
    • couponCurrency

      public java.lang.String couponCurrency()
      Retrieve the Coupon Currency
      Returns:
      The Coupon Currency
    • basis

      public double basis()
      Retrieve the Period Basis
      Returns:
      The Period Basis
    • survival

      public double survival​(CurveSurfaceQuoteContainer csqc) throws java.lang.Exception
      Coupon Period Survival Probability
      Parameters:
      csqc - Market Parameters
      Returns:
      The Period Survival Probability
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • recovery

      public double recovery​(CurveSurfaceQuoteContainer csqc) throws java.lang.Exception
      Retrieve the Coupon Period Recovery
      Parameters:
      csqc - Market Parameters
      Returns:
      The Period Recovery
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • df

      public double df​(CurveSurfaceQuoteContainer csqc) throws java.lang.Exception
      Retrieve the Coupon Period Discount Factor
      Parameters:
      csqc - Market Parameters
      Returns:
      The Period Discount Factor
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • baseNotional

      public double baseNotional()
      Get the Period Base Notional
      Returns:
      Period Base Notional
    • notionalSchedule

      public Array2D notionalSchedule()
      Get the Period Notional Schedule
      Returns:
      Period Notional Schedule
    • notional

      public double notional​(int iDate) throws java.lang.Exception
      Retrieve the Coupon Period Notional Corresponding to the specified Date
      Parameters:
      iDate - The Specified Date
      Returns:
      The Period Notional Corresponding to the specified Date
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • notional

      public double notional​(int iDate1, int iDate2) throws java.lang.Exception
      Retrieve the Coupon Period Notional Aggregated over the specified Dates
      Parameters:
      iDate1 - The Date #1
      iDate2 - The Date #2
      Returns:
      The Period Notional Aggregated over the specified Dates
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • couponSchedule

      public Array2D couponSchedule()
      Get the Period Coupon Schedule
      Returns:
      Period Coupon Schedule
    • couponFactor

      public double couponFactor​(int iDate) throws java.lang.Exception
      Retrieve the Period Coupon Schedule Factor Corresponding to the specified Date
      Parameters:
      iDate - The Specified Date
      Returns:
      The Period Coupon Schedule Factor Corresponding to the specified Date
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • couponFactor

      public double couponFactor​(int iDate1, int iDate2) throws java.lang.Exception
      Retrieve the Period Coupon Schedule Factor Aggregated over the specified Dates
      Parameters:
      iDate1 - The Date #1
      iDate2 - The Date #2
      Returns:
      The Period Coupon Schedule Factor Aggregated over the specified Dates
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
    • creditLabel

      public EntityCDSLabel creditLabel()
      Return the Credit Label
      Returns:
      The Credit Label
    • floaterLabel

      public FloaterLabel floaterLabel()
      Return the Floater Label
      Returns:
      The Floater Label
    • fundingLabel

      public FundingLabel fundingLabel()
      Return the Funding Label
      Returns:
      The Funding Label
    • fxLabel

      public FXLabel fxLabel()
      Return the FX Label
      Returns:
      The FX Label
    • periodWiseConvexityAdjustment

      public java.util.List<ConvexityAdjustment> periodWiseConvexityAdjustment​(int iValueDate, CurveSurfaceQuoteContainer csqc)
      Compute the Convexity Adjustment for the Composable Periods that use Arithmetic Compounding using the specified Value Date using the Market Data provided
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curves/Surface
      Returns:
      The List of Convexity Adjustments
    • terminalConvexityAdjustment

      public ConvexityAdjustment terminalConvexityAdjustment​(int iValueDate, CurveSurfaceQuoteContainer csqc)
      Compute the Convexity Adjustment for the Composable Periods that use geometric Compounding using the specified Value Date using the Market Data provided
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curves/Surface
      Returns:
      The Convexity Adjustment
    • unitPeriodConvexityMetrics

      public java.util.List<UnitPeriodConvexityMetrics> unitPeriodConvexityMetrics​(int iValueDate, CurveSurfaceQuoteContainer csqc)
      Compute the Unit Period Convexity Measures
      Parameters:
      iValueDate - Valuation Date
      csqc - The Market Curve Surface/Quote Set
      Returns:
      The Unit Period Convexity Measures
    • couponMetrics

      public CompositePeriodCouponMetrics couponMetrics​(int iValueDate, CurveSurfaceQuoteContainer csqc)
      Compute the Full Period Coupon Measures
      Parameters:
      iValueDate - Valuation Date
      csqc - The Market Curve Surface/Quote Set
      Returns:
      The Full Period Coupon Measures
    • accrualDCF

      public double accrualDCF​(int iValueDate) throws java.lang.Exception
      Compute the Coupon Accrual DCF to the specified Accrual End Date
      Parameters:
      iValueDate - The Valuation Date
      Returns:
      The Coupon Accrual DCF to the specified Accrual End Date
      Throws:
      java.lang.Exception - Thrown if the Accrual DCF cannot be calculated
    • couponDCF

      public double couponDCF() throws java.lang.Exception
      Compute the Full Coupon DCF
      Returns:
      The Full Coupon DCF
      Throws:
      java.lang.Exception - Thrown if the Full Coupon DCF cannot be calculated
    • accrualMetrics

      public CompositePeriodAccrualMetrics accrualMetrics​(int iValueDate, CurveSurfaceQuoteContainer csqc)
      Compute the Coupon Accrual Measures to the specified Accrual End Date
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curve Surface/Quote Set
      Returns:
      The Coupon Accrual Measures to the specified Accrual End Date
    • lossMetrics

      public java.util.List<LossQuadratureMetrics> lossMetrics​(CreditComponent creditComponent, ValuationParams valuationParameters, CreditPricerParams cpp, int iWorkoutDate, CurveSurfaceQuoteContainer csqc)
      Create a List of Loss Period Measures
      Parameters:
      creditComponent - Component for which the Measures are to be generated
      valuationParameters - Valuation Parameters from which the Periods are generated
      cpp - Pricer Parameters that control the Generation Characteristics
      iWorkoutDate - Date representing the Absolute End of all the generated Periods
      csqc - Market Parameters
      Returns:
      The Generated Loss Quadrature Metrics
    • forwardPRWC

      public PredictorResponseWeightConstraint forwardPRWC​(int iValueDate, CurveSurfaceQuoteContainer csqc, ProductQuoteSet pqs)
      Generate the Forward Predictor/Response Constraint
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curve Surface/Quote Set
      pqs - Product Quote Set
      Returns:
      The Forward Predictor/Response Constraint
    • fundingPRWC

      public PredictorResponseWeightConstraint fundingPRWC​(int iValueDate, CurveSurfaceQuoteContainer csqc, ProductQuoteSet pqs)
      Generate the Funding Predictor/Response Constraint
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curve Surface/Quote Set
      pqs - Product Quote Set
      Returns:
      The Funding Predictor/Response Constraint
    • forwardFundingPRWC

      public PredictorResponseWeightConstraint forwardFundingPRWC​(int iValueDate, CurveSurfaceQuoteContainer csqc, ProductQuoteSet pqs)
      Generate the Merged Forward/Funding Predictor/Response Constraint
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curve Surface/Quote Set
      pqs - Product Quote Set
      Returns:
      The Merged Forward/Funding Predictor/Response Constraint
    • fxPRWC

      public PredictorResponseWeightConstraint fxPRWC​(int iValueDate, CurveSurfaceQuoteContainer csqc, ProductQuoteSet pqs)
      Generate the FX Predictor/Response Constraint
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curve Surface/Quote Set
      pqs - Product Quote Set
      Returns:
      The FX Predictor/Response Constraint
    • volatilityPRWC

      public PredictorResponseWeightConstraint volatilityPRWC​(int iValueDate, CurveSurfaceQuoteContainer csqc, ProductQuoteSet pqs)
      Generate the Volatility Predictor/Response Constraint
      Parameters:
      iValueDate - The Valuation Date
      csqc - The Market Curve Surface/Quote Set
      pqs - Product Quote Set
      Returns:
      The Volatility Predictor/Response Constraint
    • periodQuoteSet

      public abstract CompositePeriodQuoteSet periodQuoteSet​(ProductQuoteSet pqs, CurveSurfaceQuoteContainer csqc)
      Retrieve the Period Calibration Quotes from the specified product quote set
      Parameters:
      pqs - The Product Quote Set
      csqc - The Market Curve Surface/Quote Set
      Returns:
      The Composed Period Quote Set
    • basisQuote

      public abstract double basisQuote​(ProductQuoteSet pqs)
      Retrieve the Period Calibration Basis Quote from the specified product quote set
      Parameters:
      pqs - The Product Quote Set
      Returns:
      The Period Calibration Basis Quote