- java.lang.Object
-
- net.finmath.marketdata.products.AbstractAnalyticProduct
-
- net.finmath.marketdata.products.Portfolio
-
- All Implemented Interfaces:
AnalyticProduct,Product
public class Portfolio extends AbstractAnalyticProduct implements AnalyticProduct
Implements the valuation of a portfolio of products implementingAnalyticProductInterface.- Version:
- 1.0
- Author:
- Christian Fries
-
-
Constructor Summary
Constructors Constructor Description Portfolio(List<AnalyticProduct> products)Create a portfolio of products implementingAnalyticProductInterface.Portfolio(List<AnalyticProduct> products, List<Double> weights)Create a portfolio of products implementingAnalyticProductInterface.Portfolio(AnalyticProduct product, double weight)Create a portfolio consisting of a single product with a given weight.Portfolio(Portfolio portfolio, List<AnalyticProduct> products, List<Double> weights)Create a portfolio of products implementingAnalyticProductInterface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<AnalyticProduct>getProducts()Returns the list of products as an unmodifiable list.doublegetValue(double evaluationTime, AnalyticModel model)Return the valuation of the product using the given model.List<Double>getWeights()Returns the list of weights as an unmodifiable list.-
Methods inherited from class net.finmath.marketdata.products.AbstractAnalyticProduct
getValue, getValue
-
-
-
-
Constructor Detail
-
Portfolio
public Portfolio(List<AnalyticProduct> products, List<Double> weights)
Create a portfolio of products implementingAnalyticProductInterface. The portfolio consists of an array of products and a corresponding array of weights. The value of the portfolio is given by the sum overweights[i] * products.get(i).getValue(evaluationTime, model)Note that a product in the array of products may itself be aPortfolio(hence you may easily combine portfolios).- Parameters:
products- Array of products implementingAnalyticProductInterface.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 implementingAnalyticProductInterface. The portfolio consists of an array of products and a corresponding array of weights. The value of the portfolio is given by the sum overweights[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 implementingAnalyticProductInterface.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 implementingAnalyticProductInterface.weight- A weight used in the valuation as a multiplicator.
-
Portfolio
public Portfolio(List<AnalyticProduct> products)
Create a portfolio of products implementingAnalyticProductInterface. The value of the portfolio is given by the sum overproducts.get(i).getValue(evaluationTime, model)Note that a product in the array of products may itself be aPortfolio(hence you may easily combine portfolios).- Parameters:
products- Array of products implementingAnalyticProductInterface.
-
-
Method Detail
-
getValue
public double getValue(double evaluationTime, AnalyticModel model)Description copied from interface:AnalyticProductReturn the valuation of the product using the given model. The model has to implement the modes ofAnalyticModel.- Specified by:
getValuein interfaceAnalyticProduct- 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. Callingaddon this list will result in anUnsupportedOperationException.- Returns:
- The list of products as an unmodifiable list.
-
getWeights
public List<Double> getWeights()
Returns the list of weights as an unmodifiable list. Callingaddon this list will result in anUnsupportedOperationException.- Returns:
- The list of weights as an unmodifiable list.
-
-