Class Portfolio

    • Constructor Detail

      • Portfolio

        public Portfolio​(List<AnalyticProduct> products,
                         List<Double> weights)
        Create a portfolio of products implementing AnalyticProductInterface. The portfolio consists of an array of products and a corresponding array of weights. The value of the portfolio is given by the sum over weights[i] * products.get(i).getValue(evaluationTime, model) Note that a product in the array of products may itself be a Portfolio (hence you may easily combine portfolios).
        Parameters:
        products - Array of products implementing AnalyticProductInterface.
        weights - Array of weights used in the valuation as a multiplicator.
      • Portfolio

        public Portfolio​(Portfolio portfolio,
                         List<AnalyticProduct> products,
                         List<Double> weights)
        Create a portfolio of products implementing AnalyticProductInterface. The portfolio consists of an array of products and a corresponding array of weights. The value of the portfolio is given by the sum over weights[i] * products.get(i).getValue(evaluationTime, model) The portfolio is created by taking all products and weights of a given portfolio and adding other given products and weights.
        Parameters:
        portfolio - A given portfolio, which will become part of this portfolio.
        products - Array of products implementing AnalyticProductInterface.
        weights - Array of weights used in the valuation as a multiplicator.
      • Portfolio

        public Portfolio​(AnalyticProduct product,
                         double weight)
        Create a portfolio consisting of a single product with a given weight.
        Parameters:
        product - A product, implementing implementing AnalyticProductInterface.
        weight - A weight used in the valuation as a multiplicator.
      • Portfolio

        public Portfolio​(List<AnalyticProduct> products)
        Create a portfolio of products implementing AnalyticProductInterface. The value of the portfolio is given by the sum over products.get(i).getValue(evaluationTime, model) Note that a product in the array of products may itself be a Portfolio (hence you may easily combine portfolios).
        Parameters:
        products - Array of products implementing AnalyticProductInterface.
    • Method Detail

      • getValue

        public double getValue​(double evaluationTime,
                               AnalyticModel model)
        Description copied from interface: AnalyticProduct
        Return the valuation of the product using the given model. The model has to implement the modes of AnalyticModel.
        Specified by:
        getValue in interface AnalyticProduct
        Parameters:
        evaluationTime - The evaluation time as double. Cash flows prior and including this time are not considered.
        model - The model under which the product is valued.
        Returns:
        The value of the product using the given model.
      • getProducts

        public List<AnalyticProduct> getProducts()
        Returns the list of products as an unmodifiable list. Calling add on this list will result in an UnsupportedOperationException.
        Returns:
        The list of products as an unmodifiable list.
      • getWeights

        public List<Double> getWeights()
        Returns the list of weights as an unmodifiable list. Calling add on this list will result in an UnsupportedOperationException.
        Returns:
        The list of weights as an unmodifiable list.