Interface CurveNode

    • Method Detail

      • getLabel

        String getLabel()
        Gets the label to use for the node.
        Returns:
        the label, not empty
      • getDateOrder

        CurveNodeDateOrder getDateOrder()
        Gets the date order rules that apply to this node within the curve.

        Each curve node has an associated date which defines the x-value in the curve, available via date(LocalDate, ReferenceData). Restrictions may be placed on the node to prevent it from being too close, before or after another node.

        Returns:
        the date order rules
      • requirements

        Set<? extends MarketDataId<?>> requirements()
        Determines the market data that is required by the node.

        This returns the market data needed to build the trade that the node represents.

        Returns:
        requirements for the market data needed to build a trade representing the instrument at the node
      • date

        LocalDate date​(LocalDate valuationDate,
                       ReferenceData refData)
        Calculates the date associated with the node.

        Each curve node has an associated date which defines the x-value in the curve. This date is visible in the parameter metadata.

        Parameters:
        valuationDate - the valuation date used when calibrating the curve
        refData - the reference data to use to resolve the trade
        Returns:
        the date associated with the node
      • metadata

        DatedParameterMetadata metadata​(LocalDate valuationDate,
                                        ReferenceData refData)
        Returns metadata for the node.

        This provides curve metadata for the node at the specified valuation date.

        Parameters:
        valuationDate - the valuation date used when calibrating the curve
        refData - the reference data to use to resolve the trade
        Returns:
        metadata for the node
      • trade

        Trade trade​(double quantity,
                    MarketData marketData,
                    ReferenceData refData)
        Creates a trade representing the instrument at the node.

        This uses the observed market data to build the trade that the node represents. The reference data is typically used to find the start date of the trade from the valuation date. The resulting trade is not resolved. The notional of the trade is taken from the 'quantity' variable. The quantity is signed and will affect whether the trade is Buy or Sell. The valuation date is defined by the market data.

        Parameters:
        quantity - the quantity or notional of the trade
        marketData - the market data required to build a trade for the instrument, including the valuation date
        refData - the reference data, used to resolve the trade dates
        Returns:
        a trade representing the instrument at the node
        Throws:
        ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data
        RuntimeException - if unable to resolve due to an invalid definition
      • resolvedTrade

        ResolvedTrade resolvedTrade​(double quantity,
                                    MarketData marketData,
                                    ReferenceData refData)
        Creates a resolved trade representing the instrument at the node.

        This uses the observed market data to build the trade that the node represents. The trade is then resolved using the specified reference data if necessary. The valuation date is defined by the market data.

        Resolved objects may be bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.

        Parameters:
        quantity - the quantity or notional of the trade
        marketData - the market data required to build a trade for the instrument, including the valuation date
        refData - the reference data, used to resolve the trade
        Returns:
        a trade representing the instrument at the node
        Throws:
        ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data
        RuntimeException - if unable to resolve due to an invalid definition
      • sampleResolvedTrade

        default ResolvedTrade sampleResolvedTrade​(LocalDate valuationDate,
                                                  FxRateProvider fxProvider,
                                                  ReferenceData refData)
        Creates a resolved trade representing the instrument at the node.

        This uses an arbitrary quantity, typically 1, and an arbitrary market data quote, typically 0, to create a trade. This is useful when the trade is to be used to calculate the current par value. The FX provider is typically only used for cross-currency trades. In many cases, FxRateProvider.minimal() can be passed in.

        Resolved objects may be bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.

        Parameters:
        valuationDate - the valuation date
        fxProvider - the FX rate provider
        refData - the reference data, used to resolve the trade
        Returns:
        a trade representing the instrument at the node
        Throws:
        ReferenceDataNotFoundException - if an identifier cannot be resolved in the reference data
        RuntimeException - if unable to resolve due to an invalid definition
      • initialGuess

        double initialGuess​(MarketData marketData,
                            ValueType valueType)
        Gets the initial guess used for calibrating the node.

        This uses the observed market data to select a suitable initial guess. For example, a Fixed-Ibor swap would return the market quote, which is the fixed rate, providing that the value type is 'ZeroRate'. The valuation date is defined by the market data.

        This is primarily used as a performance hint. Since the guess is refined by calibration, in most cases any suitable number can be returned, such as zero.

        Parameters:
        marketData - the market data required to build a trade for the instrument, including the valuation date
        valueType - the type of y-value that the curve will contain
        Returns:
        the initial guess of the calibrated value