Class GenericSecurityPositionCalculationFunction

    • Constructor Detail

      • GenericSecurityPositionCalculationFunction

        public GenericSecurityPositionCalculationFunction()
        Creates an instance.
    • Method Detail

      • identifier

        public java.util.Optional<java.lang.String> identifier​(GenericSecurityPosition target)
        Description copied from interface: CalculationFunction
        Returns an identifier that should uniquely identify the specified target.

        This identifier is used in error messages to identify the target. This should normally be overridden to provide a suitable identifier. For example, if the target is a trade, there will typically be a trade identifier available.

        This method must not throw an exception.

        Specified by:
        identifier in interface CalculationFunction<GenericSecurityPosition>
        Parameters:
        target - the target of the calculation
        Returns:
        the identifier of the target, empty if no suitable identifier available
      • naturalCurrency

        public Currency naturalCurrency​(GenericSecurityPosition position,
                                        ReferenceData refData)
        Description copied from interface: CalculationFunction
        Returns the "natural" currency for the specified target.

        This is the currency to which currency amounts are converted if the "natural" reporting currency is requested using ReportingCurrency.NATURAL. Most targets have a "natural" currency, for example the currency of a FRA or the base currency of an FX forward.

        It is required that all functions that return a currency-convertible measure must choose a "natural" currency for each trade. The choice must be consistent not random, given the same trade the same currency must be returned. This might involve picking, the first leg or base currency from a currency pair. An exception must only be thrown if the function handles no currency-convertible measures.

        Specified by:
        naturalCurrency in interface CalculationFunction<GenericSecurityPosition>
        Parameters:
        position - the target of the calculation
        refData - the reference data to be used in the calculation
        Returns:
        the "natural" currency of the target
      • requirements

        public FunctionRequirements requirements​(GenericSecurityPosition position,
                                                 java.util.Set<Measure> measures,
                                                 CalculationParameters parameters,
                                                 ReferenceData refData)
        Description copied from interface: CalculationFunction
        Determines the market data required by this function to perform its calculations.

        Any market data needed by the calculate method should be specified.

        The set of measures may include measures that are not supported by this function.

        Specified by:
        requirements in interface CalculationFunction<GenericSecurityPosition>
        Parameters:
        position - the target of the calculation
        measures - the set of measures to be calculated
        parameters - the parameters that affect how the calculation is performed
        refData - the reference data to be used in the calculation
        Returns:
        the requirements specifying the market data the function needs to perform calculations