WebCab Portfolio Demo
v4.2
(J2EE Edition)

com.webcab.ejb.finance.portfolio
Interface AssetParameters

All Superinterfaces:
EJBObject, Remote

public interface AssetParameters
extends EJBObject

Within this Enterprise JavaBean we provide procedures for the evaluation of various quantities which are required within the application of this Component. These parameters include:

Note: Further methods for the evaluation of the Volatility are provided within the Volatility Enterprise JavaBean.

Remarks of using Absolute or Relative Values

Within the application of portfolio theory using this component you have the option of using either relative (i.e. percentage) or absolute values. However, which ever unit convention you choose you will need to apply the convention consistently throughout the given application. The reason for this is that some of the quantities considered within portfolio theory are are dependent upon the unit. In particular, the following two quantities will need to use the corresponding units of measurement throughout a given application:

  1. Historical Values: This is the source data which is given in absolute or relative terms.
  2. Expected Returns: The expected return of the investment over the period considered which should be given and will be returned in the units used (i.e. absolute or relative) by the historical values.

These units in turn will effect the following objects:

  1. Utility Function: The values of the expected returns provided within the definition of the utility function should be in accordance with the units used to describe the historical values.
  2. Efficient Frontier: The values of the expected return which are either evaluated or given will be or will need to be in accordance with the units used within the historical values.

Therefore, whenever wishing to apply our portfolio component you should decide for the beginning whether you wish to use absolute or relative values and then stick to this choice for the remainder of the application.

It should also be pointed out that some quantities do not depend on the units used and so will be the same whichever convention is used. In particular, the asset weights are unit-less and hence the weighting of the asset within the optimal portfolio are not effected (as one might expect) by the units convention used.


Method Summary
 double[][] absoluteToRelative(double[][] aboluteValues)
          The returned array has the same number of rows but every row is one unit shorter.
 double covariance(double[] return1, double[] returns2)
          Uses a backwardly looking historical approach in order to evaluate the covariance between two assets.
 double covariance(double[] probability, double[] returns1, double[] returns2)
          Uses a forward looking scenario based approach in order to evaluate the covariance between two assets.
 double[][] covarianceMatrix(double[][] historicalReturns)
          Returns the (realized) covariance matrix for a collection of assets when the assets historical returns are known.
 double[][] covarianceMatrix(double[] probability, double[][] returns)
          Returns the covariance matrix for a collection of assets given a finite number of possible scenarios, the asset returns resulting from each one of these scenarios and the probability of each one of the scenarios taking place.
 double expectedReturn(double[] historicalReturns)
          Estimates the expected return from the historical values of an asset by evaluating the arithmetic average of the returns over the period considered.
 double expectedReturn(double[] probability, double[] returns)
          Evaluates the expected return of an asset given the (finite) probability distribution of its returns.
 double[] expectedReturns(double[][] historicalReturns)
          Estimates the expected returns from the historical values of a collection of assets by evaluating the arithmetic average of the returns for each asset within the collection over the period considered.
 double intermediateValue(double upperBound, double lowerBound, double ratio)
          Evaluates a point within the range over which the Efficient Frontier exists which lies ratio percent of the entire range from the lower bound and the (100-ratio) percent of the entire range from the upper bound.
 double portfolioExpectedReturn(double[] weights, double[] expectedReturns)
          Evaluates the expected return of a Portfolio where the expected returns of the assets within the portfolio and the weighting of those asset is known.
 double portfolioRisk(double[] weight, double[][] covarianceMatrix)
          The risk (also known as the volatility or standard deviation) of a portfolio.
 double portfolioVariance(double[] weight, double[][] covarianceMatrix)
          Evaluates the variance of the portfolio's value.
 double[][] relativeToAbsolute(double[][] relativeValues)
          Converts relative-shift values to their absolute values.
 double[][] transpose(double[][] twoDimArray)
          For an array A[i,j], of dimension two this methods performance the following mapping for all elements A[i,j] --> A[j,i], where the length of each of the array elements has the same length.
 double volatility(double[] historicalReturns)
          Estimate of the volatility of the returns (i.e. the standard deviation) of an asset from the assets historical returns.
 double volatility(double[] probability, double[] returns)
          Returns the (expected) volatility (i.e. standard deviation) of the returns of an asset given the (discrete) probability distribution of a range of states which may occur and the corresponding returns which each of these states will result in.
 
Methods inherited from interface javax.ejb.EJBObject
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove
 

Method Detail

relativeToAbsolute

public double[][] relativeToAbsolute(double[][] relativeValues)
                              throws AssetParametersDemoException,
                                     RemoteException
Converts relative-shift values to their absolute values. This unit conversion method is generally applied to the historical values and is used to convert the historical values given in relative terms (i.e. 0 percent = 0.01, 2 percent = 0.02, etc) to a set of equivalent absolute values (i.e. 100, 102, etc).

Remark: Absolute values might exceed maximum number limit.

Parameters:
relativeValues - the percentage changes between elements of a series.
Returns:
the absolute values of the elements of the series where the first term is scaled to 100.
AssetParametersDemoException
RemoteException

absoluteToRelative

public double[][] absoluteToRelative(double[][] aboluteValues)
                              throws AssetParametersDemoException,
                                     RemoteException
The returned array has the same number of rows but every row is one unit shorter.

AssetParametersDemoException
RemoteException

transpose

public double[][] transpose(double[][] twoDimArray)
                     throws AssetParametersDemoException,
                            RemoteException
For an array A[i,j], of dimension two this methods performance the following mapping for all elements A[i,j] --> A[j,i], where the length of each of the array elements has the same length. That is, we transpose the two dimensional array.

This method is useful when the the historical returns (i.e. the source data) has been provided as a two dimension array where the k-th array corresponds to the returns in the k-th period for each of the assets considered. By transposing we are able to map the 2-dim array into an array where each array element represent the historical prices series of each of the assets.

.

Parameters:
twoDimArray - a two dimension array which will be `transposed'.
AssetParametersDemoException
RemoteException

covariance

public double covariance(double[] probability,
                         double[] returns1,
                         double[] returns2)
                  throws AssetParametersDemoException,
                         RemoteException
Uses a forward looking scenario based approach in order to evaluate the covariance between two assets.

Parameters:
probability - an array where the i-th term of the probability of the i-th state occurring.
returns1 - an array where the i-th term is the expected return of the first asset if the i-th state occurs.
AssetParametersDemoException
RemoteException

covariance

public double covariance(double[] return1,
                         double[] returns2)
                  throws AssetParametersDemoException,
                         RemoteException
Uses a backwardly looking historical approach in order to evaluate the covariance between two assets.

Parameters:
return1 - an array where the first term is the return of the first asset over the previous period and the second terms is the return over the period before that and so on. Note that each of these periods must be of equal duration and the returned return will need to be quoted in terms of this period.
AssetParametersDemoException
RemoteException

covarianceMatrix

public double[][] covarianceMatrix(double[] probability,
                                   double[][] returns)
                            throws AssetParametersDemoException,
                                   RemoteException
Returns the covariance matrix for a collection of assets given a finite number of possible scenarios, the asset returns resulting from each one of these scenarios and the probability of each one of the scenarios taking place.

Parameters:
probability - probability[i] is the probability of market state i occurring.
returns - returns[i][j] is the return in absolute or relative terms of the j-th asset in the i-th state. Note that all the returns must be given in either absolute (i.e. market value) or relative (i.e. percentage change) terms.
AssetParametersDemoException
RemoteException

covarianceMatrix

public double[][] covarianceMatrix(double[][] historicalReturns)
                            throws AssetParametersDemoException,
                                   RemoteException
Returns the (realized) covariance matrix for a collection of assets when the assets historical returns are known.

Remarks on Historical Returns parameter

The historical returns for all the assets considered are provided within an array of dimension two where the array double[n] is the historical prices of the n-th asset from the collection. That is, if you think of the double array as a matrix then the i-th column are the historical values of the i-th asset.

Parameters:
historicalReturns - historicalReturns[i][t] is the historical return (increase in market value) for the asset i in the tth period. Note that the historical returns may be given in either absolute (i.e. market values) or relative (i.e percentage) terms but which ever conversion is used the returned results will be expressed within respect to the same conversation.
AssetParametersDemoException
RemoteException

volatility

public double volatility(double[] probability,
                         double[] returns)
                  throws AssetParametersDemoException,
                         RemoteException
Returns the (expected) volatility (i.e. standard deviation) of the returns of an asset given the (discrete) probability distribution of a range of states which may occur and the corresponding returns which each of these states will result in.

Further Explanation

This approach to estimating the (future) volatility is particularly applicable when there are a number of alternatively market events which could have a major influence on a given assets price (and hence volatility) and the probability of these events taking place can be reasonably well estimated. In such instances this approach to estimated the future volatility is more appropriate than using a estimate based on recent historical prices.

When should the scenario approach be used?

One such instance is when a takeover of a quoted company has been announced and the share price converges to almost the offer price in anticipation of the takeover being completed. In this scenario the more likely the takeover will be completed the closer the price will converge to the offer price. However, if the takeover breaks down then the price is likely to experience sharp moves to the price level found prior to the intended takeover being announced. By estimating the likely-hood of each scenario and the likely level of volatility resulting we are able to give a realistic forward looking estimate.

Parameters:
probability - probability[s] is the probability of the state s occurring. The probabilities here are given in decimal format (i.e. 1 percent = 0.01).
returns - returns[s] is the (absolute or relative percentage terms) return of the asset in the state s. Note that if the absolute (resp. percentage) returns are used then the returned volatility will be expressed in absolute (resp. relative percentage) terms. Moreover, if the daily returns are used then the returned volatility is an estimate of the daily volatility and so on.
AssetParametersDemoException
RemoteException

volatility

public double volatility(double[] historicalReturns)
                  throws AssetParametersDemoException,
                         RemoteException
Estimate of the volatility of the returns (i.e. the standard deviation) of an asset from the assets historical returns.

The number of historical values which should be used

The number of historical values used here in order to estimate the volatility should reflect the length of the period over which a reliable estimate of the volatility is required. For example, if an estimate of the 1-month volatility is sort then it is reasonable to use at least the last 1-months historical values up to a few years of historical values.

If the market under consideration goes through seasonal or business cycles, or if a given company has transformed itself then the observations used in order to estimate the expected volatility should reflect these issues. For example, if company which was a diversified general industrial company has since refocused on certain key areas, then in terms of estimating its expected volatility from historical values it is reasonable to only consider the period after the company refocused.

Parameters:
historicalReturns - historicalReturns[t] is the return (in absolute or relative percentage terms) of the asset in the tth period. Note that if the absolute (resp. percentage) returns are used then the returned volatility will be expressed in (absolute or relative percentage) terms. Moreover, if the daily returns are used then the returned volatility estimate will be an estimate of the daily volatility and so on.
AssetParametersDemoException
RemoteException

portfolioVariance

public double portfolioVariance(double[] weight,
                                double[][] covarianceMatrix)
                         throws AssetParametersDemoException,
                                RemoteException
Evaluates the variance of the portfolio's value.

Evaluating the Asset Weights and Covariance Matrix

When applying this method you will need to provide:

  1. The weights of the assets within the portfolio.
  2. The covariance matrix of those assets.

The weights of the assets can be evaluated by dividing the market value of an asset within the portfolio by the total market value of the entire portfolio. For example, if a given asset within the portfolio has a market value of $200,000; and the total portfolio (including the asset being considered) has a market value of $1,000,000; then the market weighting of the asset is 0.2.

In order to evaluate the covariance matrix of the assets we suggest that you use one of the following methods from this Enterprise JavaBean, namely:

  1. Historical Approach: covarianceMatrix(double[][])
  2. Scenario Approach: covarianceMatrix(double[],double[][])

Parameters:
weight - weight[i] is the weight for asset i. Note that, x[0] + x[1] + ... + x[N - 1]=1.
covarianceMatrix - is the covariance matrix of the portfolio's assets
AssetParametersDemoException
RemoteException

portfolioRisk

public double portfolioRisk(double[] weight,
                            double[][] covarianceMatrix)
                     throws AssetParametersDemoException,
                            RemoteException
The risk (also known as the volatility or standard deviation) of a portfolio.

Evaluating the Asset Weights and Covariance Matrix

When applying this method you will need to provide:

  1. The weights of the assets within the portfolio.
  2. The covariance matrix of those assets.

The weights of the assets can be evaluated by dividing the market value of an asset within the portfolio by the total market value of the entire portfolio. For example, if a given asset within the portfolio has a market value of $200,000; and the total portfolio (including the asset being considered) has a market value of $1,000,000; then the market weighting of the asset is 0.2.

In order to evaluate the covariance matrix of the assets we suggest that you use one of the following methods from this Enterprise JavaBean, namely:

  1. Historical Approach: covarianceMatrix(double[][])
  2. Scenario Approach: covarianceMatrix(double[],double[][])

Parameters:
weight - weight[i] is the weight for asset i. Note that, x[0] + x[1] + ... + x[N - 1]=1.
covarianceMatrix - is the covariance matrix of the portfolio's assets
AssetParametersDemoException
RemoteException

expectedReturn

public double expectedReturn(double[] probability,
                             double[] returns)
                      throws AssetParametersDemoException,
                             RemoteException
Evaluates the expected return of an asset given the (finite) probability distribution of its returns. That is, if we expect one of a finite number of possible market conditions for which we can estimate the probability of there occurrence and corresponding returns then this method provides a forward looking estimate of the expected return.

Further Explanation

This approach to estimating the (future) return is particularly applicable when there are a number of alternative market events which could have a major influence on the assets price under consideration. It is necessary that we are able to reasonably well estimate the probability of these events taking place and the likely level of return which will result. In such instances this (forwardly looking) approach to estimating the future (expected) return is more appropriate than using backwardly looking estimates based on recent historical prices.

When should the scenario approach be used?

In general terms this estimate should be used when you explicitly need a forward looking estimate and you anticipate one event from a finite number of possibilities occurring. For example, this approach is particularly applicable when a takeover of a quoted company has been announced and the share price converges to almost the offer price in anticipation of the takeover being completed. In this scenario the more likely the takeover being completed the closer the price will be to the offer price. If the takeover breaks down then the price will likely experience sharp moves to price levels found prior to the takeover being announced. By estimating the chance that each scenario and the likely level of return we are able to give an reasonably good forward looking estimate.

Parameters:
probability - probability[s] is the probability of the state s occurring. The probabilities here are given in decimal format (i.e. 1 percent = 0.01).
returns - returns[s] is the (in absolute or relative percentage terms) return from the asset in the state s. Note that of the absolute (resp. percentage) returns are used then the estimated return will be expressed in absolute (resp. relative percentage) terms. Moreover, if the daily returns are used then the estimated return is an estimate of the expected daily return and so on.
AssetParametersDemoException
RemoteException

expectedReturn

public double expectedReturn(double[] historicalReturns)
                      throws AssetParametersDemoException,
                             RemoteException
Estimates the expected return from the historical values of an asset by evaluating the arithmetic average of the returns over the period considered. This method applies exactly the same procedure as expectedReturns(double[][]) except that here we evaluate the expected return of one asset rather than the expected return of a collection of assets.

The number of historical values which should be used

The number of historical values used here in order to estimate the expected return should reflect the length of the period over which a reliable estimate of the return is required. For example, if an estimate of the 1-month return is sort then it is reasonable to use at least the last 1-months historical values up to a few years historical values in its estimation.

If the market under consideration goes through seasonal or business cycles, or if a given company has transformed itself then the observations used in order to estimate the expected return should reflect these issues. For example, if company which was a diversified general industrial company has since refocused on certain key areas, then in terms of estimating its expected return from its historical values it is reasonable to only consider the period after the company refocused.

Parameters:
historicalReturns - historicalReturns[t] is the return (in absolute or relative percentage terms) of the asset in the tth period. Note that if the absolute (resp. percentage) returns are used then the estimated expected return will be expressed in absolute (resp. relative percentage) terms. Moreover, if the daily returns are used then the estimated return will be an estimate of the daily return and so on.
AssetParametersDemoException
RemoteException

expectedReturns

public double[] expectedReturns(double[][] historicalReturns)
                         throws AssetParametersDemoException,
                                RemoteException
Estimates the expected returns from the historical values of a collection of assets by evaluating the arithmetic average of the returns for each asset within the collection over the period considered. This method applies exactly the same procedure as expectedReturn(double[]) except that here we evaluate the expected returns of a collection of assets rather than just one.

The number of historical values which should used

The number of historical values used here in order to estimate the expected return should reflect the length of the period over which a reliable estimate of the return is required. For example, if an estimate of the 1-month return is sort then it is reasonable to use at least the last 1-months historical values up to a few years historical values in its estimation.

If the market under consideration goes through seasonal or business cycles, or if a given company has transformed itself then the observations used in order to estimate the expected return should reflect these issues. For example, if company which was a diversified general industrial company has since refocused on certain key areas, then in terms of estimating its expected return from its historical values it is reasonable to only consider the period after the company refocused.

Parameters:
historicalReturns - historicalReturns[i][t] is the return (in absolute or relative percentage terms) of the i-th asset of the collect in the tth period. Note that if the absolute (resp. percentage) returns are used then the estimated expected return will be expressed in absolute (resp. relative percentage) terms. Moreover, if the daily returns are used then the estimated return will be an estimate of the daily return and so on.
AssetParametersDemoException
RemoteException

portfolioExpectedReturn

public double portfolioExpectedReturn(double[] weights,
                                      double[] expectedReturns)
                               throws AssetParametersDemoException,
                                      RemoteException
Evaluates the expected return of a Portfolio where the expected returns of the assets within the portfolio and the weighting of those asset is known.

Evaluating the Assets Weights and Expected Returns

When applying this method you will need to provide:

  1. The weights of the assets within the portfolio
  2. The expected returns of those assets.

The weights of the assets can be evaluated by dividing the market value of an asset within the portfolio by the total market value of the entire portfolio. For example, if a given asset within the portfolio has a market value of $200,000; and the total portfolio (including the asset being considered) has a market value of $1,000,000; then the market weighting of the asset is 0.2.

In order to evaluate the expected returns of the asset we suggest that you use one of the following methods from this Enterprise JavaBean, namely:

  1. Historical Approach: expectedReturn(double[]), expectedReturns(double[][])
  2. Scenario Approach: expectedReturn(double[], double[])

Parameters:
weights - weights[i] is the weight for i-th asset. Note that, weights[0] + weights[1] + ... + weights[N - 1] = 1, where each weight lies in the interval [0,1].
expectedReturns - an array of doubles where the n-th terms is expected return of the n-th asset from with the portfolio is constructed.
AssetParametersDemoException
RemoteException

intermediateValue

public double intermediateValue(double upperBound,
                                double lowerBound,
                                double ratio)
                         throws AssetParametersDemoException,
                                RemoteException
Evaluates a point within the range over which the Efficient Frontier exists which lies ratio percent of the entire range from the lower bound and the (100-ratio) percent of the entire range from the upper bound.

Application

This method is useful in client applications where you wish to determine the point at which (for example) the Efficient Frontier is evaluated by qualitative rather than quantitative means. The advantage of taking this approach is that you are able to describe the qualitative information in a way that if you change the source data used, namely the historical returns then the qualitative information is still preserved. If on the other hand you encoded a point as a value then if you change the source data you would need to modify the point in order to preserve its relative position.

Examples

  1. When ratio = 50, the point found will be the mid-point between the two extremes of the range over which the Efficient Frontier exists.
  2. When ratio = 20, the point found will be four times the distance to the upper bound than the lower bound of the extremes of the expected returns over which the Efficient Frontier exists.
  3. When ratio = 0, the point found is just the lower bound of the expected return over which the Efficient Frontier exists.
  4. When ratio = 100, the point found is just the upper bound of the expected return over which the Efficient Frontier exists.

Parameters:
upperBound - the value of the expected return at the upper bound over which the Efficient Frontier exists.
lowerBound - the value of the expected return at the lower bound over which the Efficient Frontier exists.
ratio - a double between with [0,100] which determines the
AssetParametersDemoException
RemoteException

WebCab Portfolio Demo
v4.2
(J2EE Edition)