- java.lang.Object
-
- net.finmath.montecarlo.AbstractMonteCarloProduct
-
- net.finmath.montecarlo.interestrate.products.AbstractLIBORMonteCarloProduct
-
- net.finmath.montecarlo.interestrate.products.components.AbstractProductComponent
-
- net.finmath.montecarlo.interestrate.products.Portfolio
-
- All Implemented Interfaces:
Serializable
,Product
,TermStructureMonteCarloProduct
,MonteCarloProduct
public class Portfolio extends AbstractProductComponent
Implements the pricing of a portfolio of AbstractLIBORMonteCarloProduct products under a AbstractLIBORMarketModel. The products can be scaled by weights. The value of the portfolio is that of \( \sum_{i=0}^{n} weights\[i\] \cdot products\[i\] \text{.} \) Note: Currently the products have to be of the same currency.- Version:
- 1.2
- Author:
- Christian Fries
- See Also:
- Serialized Form
- Date:
- 08.09.2006
-
-
Constructor Summary
Constructors Constructor Description Portfolio(String currency, AbstractLIBORMonteCarloProduct[] products, double[] weights)
Creates a portfolio consisting of a set of products and a weights.Portfolio(AbstractLIBORMonteCarloProduct[] products, double[] weights)
Creates a portfolio consisting of a set of products and a weights.Portfolio(AbstractLIBORMonteCarloProduct product, double weight)
Creates a portfolio consisting of a single product and a weight.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCurrency()
Returns the currency string of this product.TermStructureMonteCarloProduct[]
getProducts()
RandomVariable
getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model)
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.double[]
getWeights()
Set<String>
queryUnderlyings()
Returns a set of underlying names referenced by this product component (i.e., required for valuation) or null if none.-
Methods inherited from class net.finmath.montecarlo.interestrate.products.components.AbstractProductComponent
getExecutor, getValues
-
Methods inherited from class net.finmath.montecarlo.interestrate.products.AbstractLIBORMonteCarloProduct
getFactorDrift, getValue, getValueForModifiedData
-
Methods inherited from class net.finmath.montecarlo.AbstractMonteCarloProduct
getValue, getValue, getValues, getValues, getValues, getValuesForModifiedData, getValuesForModifiedData, getValuesForModifiedData, getValuesForModifiedData, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.montecarlo.MonteCarloProduct
getValue, getValue, getValues, getValues, getValues, getValuesForModifiedData, getValuesForModifiedData, getValuesForModifiedData, getValuesForModifiedData
-
-
-
-
Constructor Detail
-
Portfolio
public Portfolio(AbstractLIBORMonteCarloProduct product, double weight)
Creates a portfolio consisting of a single product and a weight. The currency of this portfolio is the currency of the product.- Parameters:
product
- A product.weight
- A weight.
-
Portfolio
public Portfolio(AbstractLIBORMonteCarloProduct[] products, double[] weights)
Creates a portfolio consisting of a set of products and a weights. Note: Currently the products have to be of the same currency.- Parameters:
products
- An array of products.weights
- An array of weights (having the same lengths as the array of products).
-
Portfolio
public Portfolio(String currency, AbstractLIBORMonteCarloProduct[] products, double[] weights)
Creates a portfolio consisting of a set of products and a weights. Note: Currently the products have to be of the same currency, namely the one provided.- Parameters:
currency
- The currency of the value of this portfolio when callinggetValue
.products
- An array of products.weights
- An array of weights (having the same lengths as the array of products).
-
-
Method Detail
-
getCurrency
public String getCurrency()
Description copied from interface:MonteCarloProduct
Returns the currency string of this product.- Specified by:
getCurrency
in interfaceMonteCarloProduct
- Overrides:
getCurrency
in classAbstractMonteCarloProduct
- Returns:
- the currency
-
queryUnderlyings
public Set<String> queryUnderlyings()
Description copied from class:AbstractProductComponent
Returns a set of underlying names referenced by this product component (i.e., required for valuation) or null if none.- Specified by:
queryUnderlyings
in classAbstractProductComponent
- Returns:
- A set of underlying names referenced by this product component (i.e., required for valuation) or null if none.
-
getValue
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered.- Specified by:
getValue
in interfaceTermStructureMonteCarloProduct
- Specified by:
getValue
in classAbstractLIBORMonteCarloProduct
- Parameters:
evaluationTime
- The time on which this products value should be observed.model
- The model used to price the product.- Returns:
- The random variable representing the value of the product discounted to evaluation time
- Throws:
CalculationException
- Thrown if the valuation fails, specific cause may be available via thecause()
method.- To dos:
- The conversion between different currencies is currently not performed.
-
getProducts
public TermStructureMonteCarloProduct[] getProducts()
- Returns:
- the products
-
getWeights
public double[] getWeights()
- Returns:
- the weights
-
-