Interface BondFutureVolatilities

    • Method Detail

      • getValuationDate

        default java.time.LocalDate getValuationDate()
        Gets the valuation date.

        The volatilities are calibrated for this date.

        Specified by:
        getValuationDate in interface MarketDataView
        Returns:
        the valuation date
      • getValuationDateTime

        java.time.ZonedDateTime getValuationDateTime()
        Gets the valuation date-time.

        The volatilities are calibrated for this date-time.

        Returns:
        the valuation date-time
      • withParameter

        BondFutureVolatilities 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

        BondFutureVolatilities 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
      • volatility

        default double volatility​(java.time.ZonedDateTime expiryDateTime,
                                  java.time.LocalDate fixingDate,
                                  double strike,
                                  double forward)
        Calculates the volatility at the specified expiry.
        Parameters:
        expiryDateTime - the option expiry
        fixingDate - the underlying future fixing date
        strike - the option strike rate
        forward - the forward rate
        Returns:
        the volatility
        Throws:
        java.lang.RuntimeException - if the value cannot be obtained
      • volatility

        double volatility​(double expiry,
                          java.time.LocalDate fixingDate,
                          double strike,
                          double forward)
        Calculates the volatility at the specified expiry.

        This relies on expiry supplied by relativeTime(ZonedDateTime).

        Parameters:
        expiry - the time to expiry as a year fraction
        fixingDate - the underlying future fixing date
        strike - the option strike rate
        forward - the forward rate
        Returns:
        the volatility
        Throws:
        java.lang.RuntimeException - if the value cannot be obtained
      • relativeTime

        double relativeTime​(java.time.ZonedDateTime dateTime)
        Converts a time and date to a relative year fraction.

        When the date is after the valuation date (and potentially time), the returned number is negative.

        Parameters:
        dateTime - the date-time to find the relative year fraction of
        Returns:
        the relative year fraction