Interface CreditDiscountFactors

  • All Superinterfaces:
    MarketDataView, ParameterizedData
    All Known Implementing Classes:
    IsdaCreditDiscountFactors

    public interface CreditDiscountFactors
    extends MarketDataView, ParameterizedData
    Provides access to discount factors for a single currency.

    The discount factor represents the time value of money for the specified currency when comparing the valuation date to the specified date.

    This is also used for representing survival probabilities of a legal entity for a single currency.

    • Method Detail

      • of

        static CreditDiscountFactors of​(Currency currency,
                                        LocalDate valuationDate,
                                        Curve curve)
        Obtains an instance from a curve.

        If the curve satisfies the conditions for ISDA compliant curve, IsdaCompliantZeroRateDiscountFactors is always instantiated.

        Parameters:
        currency - the currency
        valuationDate - the valuation date for which the curve is valid
        curve - the underlying curve
        Returns:
        the discount factors view
      • getCurrency

        Currency getCurrency()
        Gets the currency.

        The currency that discount factors are provided for.

        Returns:
        the currency
      • getDayCount

        DayCount getDayCount()
        Obtains day count convention.

        This is typically the day count convention of the underlying curve.

        Returns:
        the day count
      • getParameterKeys

        DoubleArray getParameterKeys()
        Obtains the parameter keys of the underlying curve.
        Returns:
        the parameter keys
      • withParameter

        CreditDiscountFactors withParameter​(int parameterIndex,
                                            double newValue)
        Description copied from interface: ParameterizedData
        Returns a copy of the data with the value at the specified index altered.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withParameter in interface ParameterizedData
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        newValue - the new value for the specified parameter
        Returns:
        a parameterized data instance based on this with the specified parameter altered
      • withPerturbation

        CreditDiscountFactors withPerturbation​(ParameterPerturbation perturbation)
        Description copied from interface: ParameterizedData
        Returns a perturbed copy of the data.

        The perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.

        This instance is immutable and unaffected by this method call.

        Specified by:
        withPerturbation in interface ParameterizedData
        Parameters:
        perturbation - the perturbation to apply
        Returns:
        a parameterized data instance based on this with the specified perturbation applied
      • isIsdaCompliant

        default boolean isIsdaCompliant()
        Checks if the instance is based on an ISDA compliant curve.

        This returns 'false' by default, and should be overridden when needed.

        Returns:
        true if this is an ISDA compliant curve, false otherwise
      • relativeYearFraction

        double relativeYearFraction​(LocalDate date)
        Calculates the relative time between the valuation date and the specified date.

        The double value returned from this method is used as the input to other methods. It is typically calculated from a DayCount.

        Parameters:
        date - the date
        Returns:
        the year fraction
        Throws:
        RuntimeException - if it is not possible to convert dates to relative times
      • discountFactor

        default double discountFactor​(LocalDate date)
        Gets the discount factor for the specified date.

        The discount factor represents the time value of money for the specified currency when comparing the valuation date to the specified date.

        If the valuation date is on the specified date, the discount factor is 1.

        Parameters:
        date - the date to discount to
        Returns:
        the discount factor
        Throws:
        RuntimeException - if the value cannot be obtained
      • discountFactor

        double discountFactor​(double yearFraction)
        Gets the discount factor for specified year fraction.

        The year fraction must be based on #relativeYearFraction(LocalDate).

        Parameters:
        yearFraction - the year fraction
        Returns:
        the discount factor
        Throws:
        RuntimeException - if the value cannot be obtained
      • zeroRate

        default double zeroRate​(LocalDate date)
        Gets the continuously compounded zero rate for the specified date.

        The continuously compounded zero rate is coherent to discountFactor(LocalDate) along with year fraction which is computed internally in each implementation.

        Parameters:
        date - the date to discount to
        Returns:
        the zero rate
        Throws:
        RuntimeException - if the value cannot be obtained
      • zeroRate

        double zeroRate​(double yearFraction)
        Gets the continuously compounded zero rate for specified year fraction.

        The year fraction must be based on #relativeYearFraction(LocalDate).

        Parameters:
        yearFraction - the year fraction
        Returns:
        the zero rate
        Throws:
        RuntimeException - if the value cannot be obtained
      • zeroRatePointSensitivity

        default ZeroRateSensitivity zeroRatePointSensitivity​(LocalDate date)
        Calculates the zero rate point sensitivity at the specified date.

        This returns a sensitivity instance referring to the zero rate sensitivity of the points that were queried in the market data. The sensitivity typically has the value (-discountFactor * yearFraction). The sensitivity refers to the result of discountFactor(LocalDate).

        Parameters:
        date - the date to discount to
        Returns:
        the point sensitivity of the zero rate
        Throws:
        RuntimeException - if the result cannot be calculated
      • zeroRatePointSensitivity

        default ZeroRateSensitivity zeroRatePointSensitivity​(double yearFraction)
        Calculates the zero rate point sensitivity at the specified year fraction.

        This returns a sensitivity instance referring to the zero rate sensitivity of the points that were queried in the market data. The sensitivity typically has the value (-discountFactor * yearFraction). The sensitivity refers to the result of discountFactor(LocalDate).

        The year fraction must be based on #relativeYearFraction(LocalDate).

        Parameters:
        yearFraction - the year fraction
        Returns:
        the point sensitivity of the zero rate
        Throws:
        RuntimeException - if the result cannot be calculated
      • zeroRatePointSensitivity

        default ZeroRateSensitivity zeroRatePointSensitivity​(LocalDate date,
                                                             Currency sensitivityCurrency)
        Calculates the zero rate point sensitivity at the specified date specifying the currency of the sensitivity.

        This returns a sensitivity instance referring to the zero rate sensitivity of the points that were queried in the market data. The sensitivity typically has the value (-discountFactor * yearFraction). The sensitivity refers to the result of discountFactor(LocalDate).

        This method allows the currency of the sensitivity to differ from the currency of the market data.

        Parameters:
        date - the date to discount to
        sensitivityCurrency - the currency of the sensitivity
        Returns:
        the point sensitivity of the zero rate
        Throws:
        RuntimeException - if the result cannot be calculated
      • zeroRatePointSensitivity

        ZeroRateSensitivity zeroRatePointSensitivity​(double yearFraction,
                                                     Currency sensitivityCurrency)
        Calculates the zero rate point sensitivity at the specified year fraction specifying the currency of the sensitivity.

        This returns a sensitivity instance referring to the zero rate sensitivity of the points that were queried in the market data. The sensitivity typically has the value (-discountFactor * yearFraction). The sensitivity refers to the result of discountFactor(LocalDate).

        This method allows the currency of the sensitivity to differ from the currency of the market data.

        The year fraction must be based on #relativeYearFraction(LocalDate).

        Parameters:
        yearFraction - the year fraction
        sensitivityCurrency - the currency of the sensitivity
        Returns:
        the point sensitivity of the zero rate
        Throws:
        RuntimeException - if the result cannot be calculated
      • parameterSensitivity

        CurrencyParameterSensitivities parameterSensitivity​(ZeroRateSensitivity pointSensitivity)
        Calculates the parameter sensitivity from the point sensitivity.

        This is used to convert a single point sensitivity to parameter sensitivity. The calculation typically involves multiplying the point and unit sensitivities.

        Parameters:
        pointSensitivity - the point sensitivity to convert
        Returns:
        the parameter sensitivity
        Throws:
        RuntimeException - if the result cannot be calculated
      • createParameterSensitivity

        CurrencyParameterSensitivities createParameterSensitivity​(Currency currency,
                                                                  DoubleArray sensitivities)
        Creates the parameter sensitivity when the sensitivity values are known.

        In most cases, parameterSensitivity(ZeroRateSensitivity) should be used and manipulated. However, it can be useful to create parameter sensitivity from pre-computed sensitivity values.

        There will typically be one CurrencyParameterSensitivity for each underlying data structure, such as a curve. For example, if the discount factors are based on a single discount curve, then there will be one CurrencyParameterSensitivity in the result.

        Parameters:
        currency - the currency
        sensitivities - the sensitivity values, which must match the parameter count
        Returns:
        the parameter sensitivity
        Throws:
        RuntimeException - if the result cannot be calculated