WebCab Portfolio Demo
v4.2
(J2SE Edition)

webcab.lib.finance.portfolio
Class CapitalMarket

java.lang.Object
  |
  +--webcab.lib.finance.portfolio.CapitalMarket
All Implemented Interfaces:
Serializable

public class CapitalMarket
extends Object
implements Serializable

This class applies the Capital Asset Pricing Model (CAPM) to analyze the construction and qualitative nature of a portfolio's risk-return characteristics. The Capital Asset Pricing Model (CAPM) is an extension of the Markowitz model which was implemented within the Markowitz class.

The CAPM allows the investors portfolio to be constructed from risky assets and `cash' holdings or borrowings which are either lent or borrow from the market at some prevailing rate. These additional options of allowing the portfolio to either borrow or lend cash at a prevailing market rate accurately reflects the possibilities available and practices used with the management of portfolios. That is, when a managed portfolio has excess capital it will typical be lent to the market at the prevailing rate (which is typically around LIBOR). Conversely, if the portfolio wishes to increase its positions (and hence expected return) above the capital available within the fund then it will often borrow money at approximately the prevailing market rate (which is typically around LIBOR).

Remarks: The CAPM simplifies the situation in that it does not take into effect the credit worthiness of the fund when it wishes to borrow cash from the market. However, the assumptions are not unreasonable if we assume that the fund does not become very leveraged, since the fund could in principle at least arrange repo agreements which would allow it to borrow additional capital at close to the prevailing market rate.

Nature of the Capital Asset Pricing Model (CAPM)

The introduction of the risk free asset, namely cash along with the risky assets transforms the `curve' on which the optimal portfolios found with respect to the Markowitz Theory into a straight line, known as the Capital Market Line (CML) on which the optimal portfolios with respect to the CAPM lie. The reason for this is that in all cases in order to obtain the optimal portfolio with respect to the CAPM, that is the portfolio which offers a given return for the minimal risk. You will need to construct a portfolio which consists of a `weighting' of the `Market Portfolio' (explained below) and either lend excess cash to the market or borrow cash from the market in order to purchase more (baskets) of the Market Portfolio.

The Market Portfolio is the portfolio on the Efficient Frontier (see Markowitz class or the PDF documentation for more details) which offers the greatest return per unit of risk, that is, the portfolio on the Efficient Frontier which maximizes:

Expected Return / Total Risk

The reason for this is that the investor whatever his risk/reward profile will seek the portfolio which offers the greatest return of a given level of risk, or the minimum risk for a given level of return. Clearly, at the level of the expected return of the Market Portfolio, the Market Portfolio is the optimal portfolio. However, if you wish to obtain a portfolio with a higher expected return then you should borrow cash (with zero risk) from the market in order to purchase more (baskets) of the `Market Portfolio'. Since the Market Portfolio is the cheapest way in terms of risk to increase the return of the portfolio. Similarly, if you wish to obtain a portfolio with a lower expected return than the Market Portfolio. You will need to hold a sufficient weighting of the Market Portfolio in order that a portfolio consisting of a weighting of the Market Portfolio with the remaining capital held as (zero risk) cash holdings will ensure the desired level of the expected return. Again the rationale for this construction is that the cheapest way to increase the expected return of a portfolio invested in cash is to move some of the cash into the Market Portfolio which by definition offers the cheapest means with regard to risk in obtained a higher expected return.

Therefore, when selecting the optimal portfolio with respect to the CAPM one of three possible scenarios will occur:

  1. Borrow money at the prevailing market rate in order to purchase further blocks of the Market Portfolio. That is, the portfolio which offers the greatest expected return per unit of risk. Since the cash borrowings are risk free and unlimited you can in principle hold an arbitrarily large amount of the Market Portfolio using the same (original) capital base. Allowing the portfolio to be geared to a level where are arbitrarily high value of the expected return can be obtained.
  2. Lend Money at the prevailing rate if you do not require the level of expected return which is offered by investing all the available capital in the Market Portfolio. That is, the portfolio with the highest expected return per unit of risk. The rationale being that even if you require a lower level of expected return a weighted portfolio between the cash with zero risk (and a positive return) and the most efficient means to purchasing additional expected return (i.e. the Market Portfolio) is going to be most efficient means of obtaining the desired level of the expected return.
  3. No cash holdings or borrowing if the expected return (or risk) you require is the same as the expected return (or risk) of the Market Portfolio.

The line within the risk/reward plain which replaces the Efficients Frontier of Markowitz Theory is known as the Capital Market Line (CML). Where each point on the CML corresponds to an optimal portfolio (i.e. minimum risk for a given value of the expected return) with respect to the CAPM.

Brief Overview of the Functionality Offered

As described above the introduction of a risk free asset within the Capital Market Theory transforms the Efficient Frontier into the Capital Market Line (CML) which as the name suggests is a straight line when plotted with the risk against the expected return. Moreover, the portfolios which correspond to points on the CML correspond to portfolios which consists to multiples of a basket of assets known as the Market Portfolio and a positive or negative balance of cash which is either borrow from the market or lend to the market at the prevailing market rate. Therefore, the key functionality will evolve around the construction of the Market Portfolio from which the corresponding Capital Market Line (CML) will be derived.

The steps required to construct and then analyze a portfolio using the CAPM will almost always proceed along the following lines. Moreover, when applying the CAPM you will need to apply the procedures (nearly always) in the following order:

  1. Evaluate (possibly constrained) Efficient Frontier using setConstraints (if applicable), and then calculateEfficientFrontier.
  2. Construct Market Portfolio using marketPortfolio, and evaluate its expected return and risk using marketPortfolioExpectedReturn, marketPortfolioRisk respectively.
  3. Evaluate the weight of the Market Portfolio and hence the weight of the cash component within a portfolio on the CML for a given expected return using the method weightCML. Recall that the portfolios on the CML offer the lowest risk for a given value of the expected return (which can take an arbitrarily high value).

Remark: For a given set of assets with possibly constrained asset weights there will correspond a range of values of the expected return over which the (constrained) Efficient Frontier exists and in which the Market Portfolio will lie. You are able to evaluate this continuous range by applying the methods minFrontierReturn(double[]) and maxFrontierReturn(double[]), in order to evaluate the upper and lower bounds respectively of the expected return over which the Efficient Frontier exists. If you are considering the constrained case then the constraints should be set (by calling setConstraints) before the range of the expected returns are evaluated.

Detailed Overview of the Functionality Offered

The functionality offered within this class is a through and flexible implementation of the CAPM. The functionality of the CAPM and its application will consist of performing the following three main steps:

  1. Construction of the Efficient Frontier
  2. Evaluation of the Market Portfolio
  3. Selecting a Portfolio from the CML

1) Construction of the Efficient Frontier

In order to construct the Market Portfolio it is necessary to evaluate the Efficient Frontier which consists of a portfolio built from (possibly constrained) assets. Within this class we provide the following two methods which offer the functionality required by the CAPM. These methods are:

  1. setConstraints - Sets of the constraints (lower and upper bounds) on the assets within the collection of (risky) assets from which the Market Portfolio and the other portfolios on the Efficient Frontier will be evaluated.
  2. calculateEfficientFrontier - Evaluates a finite number of points on the Efficient Frontier of the collection of assets from which the Market Portfolio can be constructed and store them within a private field. It is necessary to evaluate the Efficient Frontier because by definition the Market Portfolio is the portfolio on the Efficient Frontier which offers the maximum expected return per unit of risk.

Remark: In order to make a more detailed study of the Efficient Frontier we refer you to the methods contained within the Markowitz class.

The Efficient Frontier is constructed by the following steps:

  1. Evaluated the Efficient Frontier at a finite number of points. That is, find the portfolio which exhibits the lowest risk for a given expected return from the collection of asset available. Note that the weights of the assets may be subject to constraints.
  2. Interpolate about these points using cubic spline (or some other method) in order to construct the Efficient Frontier. Since the Efficient Frontier by nature is `smooth' using cubic spline interpolation to construct the Efficient Frontier will not introduce significant errors. If you wish to use another polynomial interpolation technique to construct the Efficient Frontier then we refer you to the Interpolation class.

The points on the Efficient Frontier are portfolios constructed from the set of assets considered which exhibit the lowest risk for a given expected return. These portfolio are characterized by the following three characteristics:

  1. Expected Return - The expected return of the portfolio which is estimated from the historical returns of the assets within the portfolio.
  2. Total Risk - The total risk of the portfolio which is estimated from the historical returns of the assets within the portfolio.
  3. Asset Weights - the weights of the collection of assets from which the portfolio can be constructed.

It is important to point out that the Efficient Frontier in monotonically increasing function in risk and expected return. This means that if we are given a value of the expected return then there will correspond a unique portfolio on the Efficient Frontier with a given total risk. Conversely, if we are given the total risk of the portfolio then there will exist a unique portfolio on the Efficient Frontier with a corresponding value its expected return.

Why the class has been designed so that the Efficient Frontier is pre-evaluated?

To calculate the Efficient Frontier, Rosen's gradient projection optimization algorithm is used. Moreover, it turns out to be very inefficient to call Rosen's algorithm every time you need to find a point on the Efficient Frontier. Therefore, we designed this class so that this would not be necessary by allowing the computation at the beginning a number of points on the Efficient Frontier, from which the other points will be deduced (in fact, estimated) through the use of cubic spline interpolation. These interpolation points are determined by calculateEfficientFrontier, which must be called prior to any subsequent method which depends on the Efficient Frontier being known.

2) Evaluation of the Market Portfolio

The Efficient Frontier is the collection of portfolios constructed from the given set of available assets. These portfolios have the lowest risk for a given value of the expected return with the possibility of constraints on the weights of the assets (set using setConstraints).

Once the Efficient Frontier has been constructed are next aim within the application of the CAPM is to find which portfolio on the Efficient Frontier which is the Market Portfolio. That is, that portfolio on the Efficient Frontier which maximizes:

Expected Return of Portfolio / Total Risk of Portfolio

The Market Portfolio is selected from the Efficient Frontier using the method marketPortfolio, which will return the (possibly constrained) weights of the Market Portfolio which has the highest expected return per unit of risk of the portfolios on the Efficient Frontier constructed from the available set of (risky) assets.

Uniqueness of the Market Portfolio

Here we discuss the `uniqueness' of the market portfolio subject to some remarks concerning the given collection of assets from which the portfolios of the Efficient Frontier are constructed. These remarks though assisting in a deeper understanding of CAPM (and Markowitz Theory) can be safely skipped for those solely interested in the application of the CAPM (or Markowitz Theory).

The uniqueness of the Market Portfolio depends in the nature of the collection of assets from which the Efficient Frontier is constructed. Clearly the Efficient Frontier is convex and hence if we assume that there are two (or more) distinct Market Portfolios then it follows that one Market Portfolio is a leveraged version of the other in the following sense. The covariance between the two (distinct) market portfolios must be one since otherwise by holding a weighting of both Market Portfolios and gaining from the effects of diversification we are able to construct a portfolio with a higher expected return per unit of risk. Therefore, the covariance between any distinct Market Portfolios must be one.

In fact, if there are two distinct Market Portfolios with differing values of the risk and expected return then there exists an continuous range of Market Portfolios in risk and expected return within the intervals of the risk and expected return of the two given Market Portfolios. The reason for this is that we can form a weighting of the two Market Portfolios which forms another Market Portfolio (i.e. it has the same expected return per unit of risk) which has any value of the expected return or risk within there respective intervals. This possibility becomes clear if we consider the portfolio R = a P + (a-1) Q, where a lies in the interval [0,1], and where P, Q are the two given Market Portfolios. Now as a varies from 0 to 1 the portfolio R's expected return and risk will vary over all values within the respective domains but the expected return per unit of risk will remain fixed. That is, they will all be Market Portfolios.

3) Selecting a Portfolio on the CML

The Capital Market Line (CML) is a collection of portfolios which can be constructed from the available (risky) assets with the option of borrowing or lending (risk free) cash at the prevailing market rate. Since by default the amount of cash which can be borrowed or lend is not restricted the expected return of the resulting portfolios can be anything equal or greater than the return available from cash. Similarly, the risk from possible portfolios can (by default) be any positive number.

We allow within the class portfolios on the CML to be selected from knowledge any one of the following:

  1. Expected Return
  2. Total Risk
  3. Weighting of the Market Portfolio

This in fact allows for the greatest generality and moreover which even property is used in the identification the other two properties can be deduced as described below.

Completeness of the Methods: riskCML, weightCML, returnCML, weight2Risk

The portfolio on the CML can be selected when one of the following three properties is known:

  1. Total Risk of the optimal portfolio on the CML.
  2. Expected Return of the optimal portfolio on the CML.
  3. Weighting of the Market Portfolio on the CML.

Then using the above mentioned methods we are able to evaluate the other (two) quantities from the three properties which are listed above. For example, if the expected return of the portfolio is known then the weight of the market portfolio can be evaluated using weightCML and the risk can be evaluated using riskCML. If on the other hand the total risk of the portfolio is known then the corresponding expected return of the portfolio can be evaluated by returnCML, and then using this deduced value we are able to evaluated the weight of the Market Portfolio using weightCML. For completeness we include the method weight2Risk which evaluates the risk of a portfolio on the CML when the weight of the Market Portfolio within the CML portfolio is known. From knowledge of the risk of the CML portfolio we able to evaluate the corresponding value of the expected return using the method returnCML.

Therefore, using the three `...CML' methods along with `weight2Risk', which ever one of: total risk, expected return or weight of Market Portfolio, is used in order to select the optimal portfolio from the CML we are able to deduce the other two quantitative properties.

Putting Constraints on the level of Borrowing or Lending of Cash

Often in practice a given fund will have limits regarding:

  1. Maximum level of cash which should be held within the portfolio
  2. Maximum level of borrowing (i.e. gearing) which the portfolio can use

Remark: We provide further motivation concerning the rationale for such limits within the PDF documentation.

Within the context of our implementation these restrictions would translate into constraints on the level of cash, that is the weighting of the Market Portfolio within the portfolio on the CML. Within the class we are able to deal with such constraints of the level of cash borrow or lent from/to the market. In particular, within such instances we are able to evaluated the corresponding optimal portfolio and evaluate this portfolios expected return, risk and Market Portfolio Weighting. For further details we refer you to weight2Risk.

Using Absolute or Relative Historical Values

Within the application of portfolio theory the following two quantities will need to use the corresponding units of measurement throughout the computation:

  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.

The units used within these two quantities 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. Note, that similar remarks hold for the Market portfolio which lies on the Efficient Frontier.

Therefore, whenever wishing to apply our portfolio component you should decide for the beginning whether you wish to use absolute or relative values for these three instances.

Assumptions of the Capital Asset Pricing Model (CAPM)

The CAPM makes all the assumptions of the Markowitz models concerning the (investment) market and investors behavior, namely that:

  1. Investors seek to maximize the expected return of total wealth.
  2. All investors have the same expected single period investment horizon.
  3. All investors are risk-adverse, that is they will only accept greater risk if they are compensated with a higher expected return.
  4. Investors base their investment decisions on the expected return and risk (i.e. the standard deviation of an assets historical returns).
  5. All markets are perfectly efficient (e.g. no taxes and no transaction costs).

The CAPM in addition to these assumptions also makes the following provisions:

  1. Lend excess capital at the Market Rate: The investor may lend money at the prevailing market rate. This constitutes the ability to hold within the portfolio a risk free asset which will provide the prevailing return available on cash. In practice, such assets are often referred to as a money market accounts and will yield a return in the region of LIBOR.
  2. Borrow capital at the Market Rate: The investor may borrow money from the market at the prevailing market rate in order to invest within (risky) assets. This will increase the expected return of the original capital base and also increase its risk. In practice, the rate at which money can be lent from the market by a fund will be in the region of LIBOR (at least if the fund structure the loan as a REPO type agreement).

Remark: Note that the rate of which money can be borrowed or lend from or to the market is the same.

Summary of Functionality provided

With this class we offer the following functionality:

Estimation/evaluation of non-observable parameters

A number of the parameters which are required by the Portfolio methods such as the covariance matrix are not directly observable from the market. However, the evaluation may be evaluated or estimated directly from market driven information such as historical asset prices. All methods related to the evaluation of such parameters have been collected or are referenced within the AssetParameters class.

In particular, the AssetParameters class contains the following procedures:

  1. Evaluation of the Covariance Matrix - AssetParameters.covarianceMatrix(double[], double[][]), AssetParameters.covarianceMatrix(double[][])
  2. Estimation of the Expected Return - AssetParameters.expectedReturns(double[][]), AssetParameters.expectedReturns(double[][])
  3. Estimation of the Volatility - Not directly used within this class but its estimated value can act of a reference point when judging the effects of diversification.
Which can be used for the evaluation of utility statistical and risk metrics which will be used in the application of the main portfolio analysis methods.

See Also:
Serialized Form

Constructor Summary
CapitalMarket()
          Creates a new CapitalMarket instance.
 
Method Summary
 void calculateEfficientFrontier(double[][] covarianceMatrix, double[] expectedReturns, int numberInterpolationPoints, double precision)
          This method calls the calculateEfficientFrontier by setting the range of the expected returns over which the Efficient Frontier is evaluated to be the entire range over which the (constrained) Efficient Frontier exists.
 void calculateEfficientFrontier(double minimumExpectedReturn, double maximumExpectedReturn, double[][] covarianceMatrix, double[] expectedReturns, int numberInterpolationPoints, double precision)
          Calculates the interpolation points used in order to construct the Efficient Frontier with a given range of expected returns for a collection of assets from which the optimal portfolio can be constructed.
 double[] getLowerConstraints()
          Returns the values of the lower bound constraints on the asset weights set by setConstraints.
 double[] getUpperConstraints()
          Returns the values of the upper bound constraints on the asset weights set by setConstraints.
 double[] marketPortfolio(double[][] covarianceMatrix, double[] expectedReturns)
          This method calls marketPortfolio on the entire range of the values of the expected returns in which the Market Portfolio could lie.
 double[] marketPortfolio(double minimumExpectedReturn, double maximumExpectedReturn, double[][] covarianceMatrix)
          Calculates the optimal portfolio which consists of a composition of assets which optimizes the portfolios risk/return profile.
 double marketPortfolioExpectedReturn(double[] weights, double[][] historicalReturns)
          Evaluates the expected return of the Market Portfolio when the asset weights of the Market Portfolio are known.
 double marketPortfolioRisk(double[] weights, double[][] covariance)
          Evaluates the total risk of the Market Portfolio.
 double maxFrontierReturn(double[] expectedReturns)
          Evaluates the expected return of the portfolio on the (constrained) Efficient Frontier with the highest value of the expected return.
 double[] maxFrontierReturnWeights(double[] expectedReturns)
          Returns the weights of the assets of the portfolio on the (constrained) Efficient Frontier with the highest value of the expected return.
 double minFrontierReturn(double[] expectedReturns)
          Returns the expected return of the portfolio on the Efficient Frontier with the lowest value of the expected return.
 double[] minFrontierReturnWeights(double[] expectedReturns)
          Returns the weights of the assets within the portfolio on the (constraints) Efficient Frontier which has the highest value of the expected return.
 double returnCML(double risk, double equityRisk, double equityExpected, double marketRate)
          Find the corresponding value of the expected return of the portfolio on the Capital Market Line (CML) when the total risk is known.
 double riskCML(double expectedReturn, double equityExpected, double marketRate, double equityRisk)
          Calculates the risk of the optimal Capital Market Line (CML) portfolio for a given expected return.
 void setConstraints(double[] lowerBounds, double[] upperBounds)
          Here we allow constraints to be placed on the weights of the assets from which the portfolios within the Efficient Frontier will be constructed.
 double weight2Risk(double weighting, double equityRisk)
          Evaluates the total risk of a portfolio on the CML when the weighting of the Market Portfolio within the portfolio selected for the CML is known.
 double weightCML(double expectedReturn, double equityExpected, double marketRate)
          For a given level of the expected return we evaluate the proportion of the investors wealth to invest in the Market Portfolio (as constructed in marketPortfolio) such that we have the Capital Market Line (CML) portfolio which offers to lowest risk for the given level of the expected return.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CapitalMarket

public CapitalMarket()
Creates a new CapitalMarket instance.

Method Detail

calculateEfficientFrontier

public void calculateEfficientFrontier(double minimumExpectedReturn,
                                       double maximumExpectedReturn,
                                       double[][] covarianceMatrix,
                                       double[] expectedReturns,
                                       int numberInterpolationPoints,
                                       double precision)
                                throws NoSolutionException,
                                       CapitalMarketDemoException
Calculates the interpolation points used in order to construct the Efficient Frontier with a given range of expected returns for a collection of assets from which the optimal portfolio can be constructed. Note that the weights of the assets from which the portfolio may be constructed may be subject to constraints (see notes below).

Overview

A constrained optimization algorithm is used each time to find the portfolios which have the least risk for a given set of expected returns. In fact, an optimization algorithm which is computational intensive will need to be called for each evaluation of an interpolation point. These interpolation points will then be interpolated in order to the construct the Efficient Frontier over the range of expected returns considered.

Constraining the Weights of the assets of the Efficient Frontier's Portfolios

With our implementation we offer the possibility to constrain the weights of the assets from which the portfolios on the Efficient Frontier are constructed. The constraints on the weights on the portfolios are set by using the method setConstraints. We illustrate the use constraints with the following example.

Say an investor requires a portfolio selected from n assets which has the lowest risk for a given expected return but also has the requirement that all of the assets must have a weight between 0.05 and 0.1 (i.e. between 5 and 10 percent). In this instance we would need to set the constraints on the assets to be:

lowerBounds = {0.05, 0.05, 0.05,...., 0.05}
upperBounds = {0.1, 0.1, 0.1, ......, 0.1}

where each of the arrays above has n terms, using the method setConstraints.

Remark: If the constraints are not set then they will take there default values which are 0 and 1, for the lower bound respectively upper bound of each asset. That is, they will remain as weights in the usual sense.

Selecting the range of the Expected Returns

We allow the user to restrict the range of expected returns over which the Efficient Frontier is evaluated since:

In short, the minimum and maximum of the expected return give a range over which the (possibly constrained) Efficient Frontier is evaluated. Once the range is set, the interpolation points (i.e. the set of expected returns) is used to equally divide up the range and the Efficient Frontier's interpolation points are evaluated (only) within this range. By excluding sections of the Efficient Frontier will allow more interpolation points to be evaluated within the range of expected returns of interest for a given computation effort.

Remark: For a given range the more interpolation points are evaluated the more accurately the Efficient Frontier will be represented which will result in to greater accuracy of the construction of the optimal portfolio.

Evaluating the Range of the expected returns on the Efficient Frontier

As mentioned before the points on the (constrained) Efficient Frontier correspond to portfolios which can be constructed from a given set of available assets where the sum of the weightings of the assets sum to 1. Therefore, (since the expected return is additive) the range of expected returns will lie within the range of expected returns of the assets. Below we consider the exact range of the value of the expected return for which the (constrained) Efficient Frontier exists.

Within this class we offer the two methods minFrontierReturn(double[]) and maxFrontierReturn(double[]) which evaluate the upper bounds and lower bounds respectively of the range of the expected returns over which the Efficient Frontier exists for the given set of asset considered. If you set the range of expected returned considered to lie outside this range then an exception will be thrown.

Remarks on the Range of expected returns of the Unconstrained Efficient Frontier

If the weights of the assets are not constrained then the range of expected returns (i.e. all possible optimal portfolios) will lie in the continuous range given by:

Remarks on the Range of expected returns of the Constrained Efficient Frontier

In the case where the weights of the assets from which the portfolios on the Efficient Frontier can be constructed are constrained. The range of the expected return for which the constrained Efficient Frontier may exist may not cover the full range of values of expected returns of the assets. The reason being that the asset with the highest (resp. lowest) expected return may have an upper bound in which case you are not able to construct the portfolio solely of this asset because at all time the weights of the assets must sum to 1.

The Range of the Expected Returns and Performance considerations

The way in which you set the range of expected returns considered will depend on the nature of the problem you are considering. If you are considering a portfolio optimization problem in which the portfolio is constructed from a relatively few number of assets (for example, less than 30) then each evaluation of another interpolation points will be very rapid and hence as long as the total number of interpolation points which you wish to use over the total range is reasonable (i.e. less than 30) then the evaluation of the Efficient Frontier will take a few seconds. However, if you are considering a larger number of assets (for example, more than 80) then you may wish to considered only a proportion of the Efficient Frontier (i.e. a smaller range of expected values) so that you will need to evaluate of fewer number of interpolation points in order to construct the Efficient Frontier over that range to the desired level of accuracy.

Remark: The computational time increase in proportion to the number interpolation points returned.

Number of Interpolation Points used to represent the Efficient Frontier

The Efficient Frontier is persisted (i.e. stored) as the collection of points around which it is interpolated. Therefore, the more interpolation points used within this method the more accurately it will be stored. However, within the construction of the Efficient Frontier the main optimization algorithm is called when each interpolation point is evaluated. Therefore, in terms of performance the computational time required for the construction of the Efficient Frontier will increase in proportion to the number of points used.

As a rule of thumb I would suggest that the number of interpolation points used is chosen within the range [5,20]. The rationale being that if less than five interpolation points are used then unreasonable amounts of qualitative information concerning the Efficient Frontier will be lost. Also, if more than twenty interpolation points are used then (generally speaking) no significant improvement in the accuracy will result.

Effect of this method on the CapitalMarket class

All methods within the CapitalMarket class are either directly or indirectly effected by the evaluation of the Efficient Frontier. The reason for this is that the returned values by all methods depend on the Efficient Frontier, moreover the Market Portfolio and then the optimal portfolios accordance to the CAMP require that the Efficient Frontier is constructed.

The methods within this class which are directly effected (in fact, require) the construction and setting of the private fields which make up the Efficient Frontier are:

  1. calculateEfficientFrontier - Each portfolio on the Efficient Frontier must satisfy the constraints on the assets.
  2. marketPortfolio - The Market Portfolio itself since selected from the portfolios on the Efficient Frontier must also satisfy the constraints on the assets by which these portfolios can be constructed.

The other methods (and the CAPM in general) of this class rely on the Market Portfolio and therefore are also effected (however indirectly) by the construction of the Efficient Frontier.

Evaluation of the Covariance matrix and Expected Returns

You are required to provide to this method the covariance matrix and the expected returns of the collection of asset from which the portfolio's on the Efficient Frontier are constructed. We provide within the AssetParameters class procedures which assist in there evaluation of the covariance matrix and the expected returns via either an historical or scenario approach.

Parameters:
minimumExpectedReturn - the minimum expected return for which the Efficient Frontier is evaluated. If you require the entire Efficient Frontier to be evaluated then you may set this parameter to be equal to the return of the assets with the minimum return. Note that this parameter should be given as a percentage (i.e. 1 percent = 1).
maximumExpectedReturn - the maximum expected return for which the Efficient Frontier is evaluated. If you require the entire Efficient Frontier to be evaluated then you may set this parameter to be equal to the return of the assets with the maximum return. Note that this parameter should be given as a percentage (i.e. 1 percent = 1).
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
covarianceMatrix - the covariance matrix of the assets from which the (optimal) portfolio can be constructed. The dimensions of the (symmetric) covariance matrix will be n X n, where n is the number of assets from which the (optimal) portfolio can be constructed.
numberInterpolationPoints - the number of interpolation points for which the Efficient Frontier is calculated. Note that these interpolation points lie within the interval bound by the minimum and maximum expected returns set and be equally dispersed within this interval. Moreover, in all case one of the interpolation points will lie of the minimum expected return set and another will lie on the maximum expected return set.
precision - this parameters allow the level of the precision required to be set, where the small the parameters the (generally) higher the precision. This variable should be chosen between the range 1E-2 and 1E-10. Note as with most numerical procedures the higher the precision the more computationally intensive the algorithm will become. The precision must be set to be a positive number less than 1; where a number of the magnitude 1E-6 will result in high precision and a number of the magnitude 1E-3 will result in rapid execution and acceptable precision for most purposes. Further details are provided within the Programmer's guide chapter of the PDF documentation.
Throws:
NoSolutionException - thrown if this method attempts to construct a portfolio on the Efficient Frontier for an expected return for which there does not exist such a portfolio. In such instances the range of expected returns over which the Efficient Frontier is constructed should be reduced. Please see the remarks above on the selection of a suitable range of expected returns.
CapitalMarketDemoException

calculateEfficientFrontier

public void calculateEfficientFrontier(double[][] covarianceMatrix,
                                       double[] expectedReturns,
                                       int numberInterpolationPoints,
                                       double precision)
                                throws CapitalMarketDemoException
This method calls the calculateEfficientFrontier by setting the range of the expected returns over which the Efficient Frontier is evaluated to be the entire range over which the (constrained) Efficient Frontier exists.

For more details concerning the issues effecting the constraints, efficiency, number of interpolation points use and so on...; we refer the reader to the documentation for the method calculateEfficientFrontier. As mentioned above the only difference with the aforementioned method at that here the range of expected returns have been set as detail below.

Range of Expected Returns

The range over which the (constrained) Efficient Frontier is evaluated can be evaluated by using the methods minFrontierReturn, maxFrontierReturn; in order to evaluate the minimum and maximum of the continuous range of the expected return over which the Efficient Frontier exists for the given set of assets considered. Note that with this procedure we have set the range over which the Efficient Frontier is constructed to be equal to this largest possible range.

Parameters:
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
covarianceMatrix - the covariance matrix of the assets from which the (optimal) portfolio can be constructed. The dimensions of the (symmetric) covariance matrix will be n X n, where n is the number of assets from which the (optimal) portfolio can be constructed.
numberInterpolationPoints - the number of interpolation points for which the Efficient Frontier is calculated. Note that these interpolation points lie within the interval bound by the minimum and maximum expected returns set and be equally dispersed within this interval. Moreover, in all case one of the interpolation points will lie of the minimum expected return set and another will lie on the maximum expected return set.
precision - this parameters allow the level of the precision required to be set, where the small the parameters the (generally) higher the precision. This variable should be chosen between the range 1E-2 and 1E-10. Note as with most numerical procedures the higher the precision the more computationally intensive the algorithm will become. The precision must be set to be a positive number less than 1; where a number of the magnitude 1E-6 will result in high precision and a number of the magnitude 1E-3 will result in rapid execution and acceptable precision for most purposes. Further details are provided within the Programmer's guide chapter of the PDF documentation.
CapitalMarketDemoException

setConstraints

public void setConstraints(double[] lowerBounds,
                           double[] upperBounds)
                    throws CapitalMarketDemoException
Here we allow constraints to be placed on the weights of the assets from which the portfolios within the Efficient Frontier will be constructed. All methods which depend on the construction of the Efficient Frontier, are effected by imposing the constraints on the assets of the Efficient Frontier.

Effect of Constraints on the CapitalMarket class

All methods within the CapitalMarket class are either directly or indirectly effected by the setting of constraints on the weights of the assets from which the portfolios on the Efficient Frontier are constructed by calculateEfficientFrontier. The reason for this is that the returned values by all methods depend on the Efficient Frontier which is in turn effected by the setting of asset weight constraints.

The methods within this class which are directly effected by the setting of constraints on the weights of the assets from which the portfolios on the Efficient Frontier are constructed are:

  1. calculateEfficientFrontier - Each portfolio on the Efficient Frontier must satisfy the constraints on the assets.
  2. marketPortfolio - The Market Portfolio itself since selected from the portfolios on the Efficient Frontier must also satisfy the constraints on the assets by which these portfolios can be constructed.

The other methods (and the CAPM in general) of this class rely on the Market Portfolio and therefore are also effected (however indirectly) by the setting of constraints.

Nature of the Constraints

We illustrate the nature of the constraints with the following example. Say an investor requires a portfolio selected from n asset which has the lowest risk for a given expected return but also has the requirement that all of the assets must have a weight between 0.05 and 0.1 (i.e. between 5 and 10 percent). In this instance we would set the constraints on the assets to be:

lowerBounds = {0.05, 0.05, 0.05,...., 0.05}
upperBounds = {0.1, 0.1, 0.1, ......, 0.1}

where each of the arrays above has n terms.

Constraints have Default Values

If the constraints are not set then they take there default values which are 0 and 1, for the lower and upper bound respectively for each asset weight.

Performance Issues

The introduction of constraints on the weights of the portfolios which form the Efficient Frontier will have the following consequences with regards to overall performance:

Remarks:

Motivation and Definition of Consistent Asset Constraints

Say that we wish to use place the following `Constraints' on a portfolio which can be constructed from 3 assets:

  1. lower bounds = {0.4, 0.4, 0.4}
  2. upper bounds = {0.5, 0.5, 0.5}
because the sum of the weights of a portfolio must be 1, there is no `consistent' portfolio which can be constructed which satisfies these constraints and the definition of the weight. Since even if we take the lower bounds for each of the three assets the sum of the weights is greater than 1 (i.e. 0.4 + 0.4 + 0.4 = 1.2 > 1).

Similarly, say we wish to use the following set of constraints:

  1. lower bounds = {0.2, 0.2, 0.2}
  2. upper bounds = {0.3, 0.3, 0.3}
as mentioned above since the sum of the weights of a portfolio must equal one, there are no portfolios which can be constructed which are `consistent' the definition that the weights must sum to 1. Since even if we take the upper bounds for each of the three assets the sum of the weights is less than 1 (i.e. 0.3 + 0.3 + 0.3 = 0.9 < 1).

For these reason reasons we introduce the following property of `consistent constraints':

Definition: A set of upper and lower bound asset constraints of a portfolio are said to be consistent if the sum of the lower bounds is less than or equal to 1, and the sum of the upper bounds is greater than or equal to 1.

Without the `consistent constraint' condition there will not exist any possible selections of the asset weights which satisfy the constraints and the definition of the asset weights, i.e. the domain of possible portfolios will be empty. Therefore this condition of consistency of the constraints is mandatory for any set of constraints used within the construction of the constrained Portfolios on the constrained Efficient Frontier.

Constraints on the Asset Weights effect on the range of the Expected Returns for which the Efficient Frontier exists

The placing of constraints on the weights of the assets effects the range of expected returns for which the resulting portfolios can be constructed. Since the (constrained) Efficient Frontier is just a collection of portfolios subject also subject to the constraints which minimize the risk for a given level of the expected return. The range of values over which the Efficient Frontier exists must correspond to the range of expected returns of the possible constructed portfolios.

Within the methods maxFrontierReturn(double[]), and minFrontierReturn(double[]) we allow the maximum and respectively minimum values of the expected return over which the (possibly constrained) Efficient Frontier exists. We also offer two associated methods maxFrontierReturnWeights(double[]) and minFrontierReturnWeights(double[]), which evaluate the assets weights of the portfolio at these two ends points. These methods which construct the Portfolios on the Efficient Frontier at its end points have the significant advantage of having almost no computational overhead, unlike the construction of the portfolios on the Efficient Frontier at other points.

Parameters:
lowerBounds - an array where the i-th term corresponds to the lower bound on the weights (i.e. lies in the closed interval [0,1]) of the i-th asset from the collection of assets from which the portfolios can be constructed. Note that the length of this array must equal the number of assets from which the portfolios can be constructed.
upperBounds - an array where the i-th term corresponds to the upper bound on the weights (i.e. lies in the closed interval [0,1]) of the i-th asset from the collection of assets from which the portfolios can be constructed. Note that the length of this array must equal the number of assets from which the portfolios can be constructed.
CapitalMarketDemoException

getLowerConstraints

public double[] getLowerConstraints()
                             throws CapitalMarketDemoException
Returns the values of the lower bound constraints on the asset weights set by setConstraints. We return an array where the k-th term of the array corresponds to the lower bound on the k-th asset's weight.

CapitalMarketDemoException

getUpperConstraints

public double[] getUpperConstraints()
                             throws CapitalMarketDemoException
Returns the values of the upper bound constraints on the asset weights set by setConstraints. We return an array where the k-th term of the array corresponds to the upper bound on the k-th asset's weight.

CapitalMarketDemoException

minFrontierReturn

public double minFrontierReturn(double[] expectedReturns)
                         throws CapitalMarketDemoException
Returns the expected return of the portfolio on the Efficient Frontier with the lowest value of the expected return.

Advantage of this approach

The distinct advantage of this approach is that in conjunction with the method minFrontierReturnWeights we are able to evaluate a point (at the lower end of the extremum of the expected returns) corresponding to a portfolio on the Efficient Frontier. Where unlike the situation with the optimization procedures calculateEfficientFrontier, we are able to do so with almost no computational overhead.

Parameters:
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
CapitalMarketDemoException
See Also:
minFrontierReturnWeights(double[])

minFrontierReturnWeights

public double[] minFrontierReturnWeights(double[] expectedReturns)
                                  throws CapitalMarketDemoException
Returns the weights of the assets within the portfolio on the (constraints) Efficient Frontier which has the highest value of the expected return.

Advantage of this approach

The distinct advantage of this approach is that in conjunction with the method minFrontierReturn we are able to evaluate a point (at the lower end of the extremum of the expected returns) corresponding to a portfolio on the Efficient Frontier. Where unlike the situation with the optimization procedures calculateEfficientFrontier, we are able to do so with almost no computational overhead.

Parameters:
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
CapitalMarketDemoException
See Also:
minFrontierReturn(double[])

maxFrontierReturn

public double maxFrontierReturn(double[] expectedReturns)
                         throws CapitalMarketDemoException
Evaluates the expected return of the portfolio on the (constrained) Efficient Frontier with the highest value of the expected return.

Advantage of this approach

The distinct advantage of this approach is that in conjunction with the method minFrontierReturnWeights we are able to evaluate a point (at the upper end of the extremum of the expected returns) corresponding to a portfolio on the Efficient Frontier. Where unlike the situation with the optimization procedures calculateEfficientFrontier, we are able to do so with almost no computational overhead.

Parameters:
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
CapitalMarketDemoException
See Also:
maxFrontierReturnWeights(double[])

maxFrontierReturnWeights

public double[] maxFrontierReturnWeights(double[] expectedReturns)
                                  throws CapitalMarketDemoException
Returns the weights of the assets of the portfolio on the (constrained) Efficient Frontier with the highest value of the expected return.

Advantage of this approach

The distinct advantage of this approach is that in conjunction with the method maxFrontierReturn we are able to evaluate a point (at the upper end of the extremum of the expected returns) corresponding to a portfolio on the Efficient Frontier. Where unlike the situation with the optimization procedures calculateEfficientFrontier, we are able to do so with almost no computational overhead.

Parameters:
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
CapitalMarketDemoException
See Also:
maxFrontierReturn(double[])

marketPortfolio

public double[] marketPortfolio(double minimumExpectedReturn,
                                double maximumExpectedReturn,
                                double[][] covarianceMatrix)
                         throws EfficientFrontierNotCalculatedException,
                                CapitalMarketDemoException
Calculates the optimal portfolio which consists of a composition of assets which optimizes the portfolios risk/return profile. The optimization occurs along the Efficient Frontier in a given range of the expected returns. We return an array of weights where the first term corresponds to the weight of the first asset from the collection of assets, the second term to the weight of the second asset and so on.

Dependency of this Construction

The Market Portfolio is found by searching along the (possibly constrained) Efficient Frontier and therefore before this methods is called and the Market Portfolio sort; the constraints on the assets should be set and the corresponding the Efficient Frontier should be constructed. You are able to set the constraints on the asset weights by calling setConstraints, and then the (possibly constrained) Efficient Frontier can be constructed by calling the following two methods: calculateEfficientFrontier over an interval, or calculateEfficientFrontier over entire range. Please note that if the Efficient Frontier is only constructed over an interval then the interval over which it is constructed must be at least as big as the interval over which the Market Portfolio is sort using this method.

Selection of the Minimum and Maximum Expected Returns

By carefully selecting the parameters for the minimum and maximum expected returns over which the Market Portfolio will be selected from the Efficient Frontier you will be able to increase efficient of this method. However, unless you have a good idea as to the likely range in which the Market Portfolio is likely lie we suggest that you take these parameters to define with widest possible range. The largest range is achieved by considering the same range over which the Efficient Frontier was evaluated.

Parameters:
minimumExpectedReturn - the minimum expected return of the portfolios on the Efficient Frontier over which the Market Portfolio will be sort. Note that, the minimum used here must be larger than or equal to the minimum used in the evaluation of the Efficient Frontier in calculateEfficientFrontier.
maximumExpectedReturn - the maximum expected return of the portfolios on the Efficient Frontier over which the Market Portfolio will be sort. Note that, the minimum used here must be less than or equal to the maximum used in the evaluation of the Efficient Frontier is calculateEfficientFrontier.
covarianceMatrix - the covariance matrix of the assets which can be used to construct the Market Portfolio (and all the other portfolios on the Efficient Frontier). Note that within applications when applying this method the covariance matrix will most likely already be evaluated in the construction of the Efficient Frontier using the method calculateEfficientFrontier.
Returns:
An array of weights of the assets from which the Market Portfolio can be constructed.
Throws:
EfficientFrontierNotCalculatedException - thrown if the Efficient Frontier has not been evaluated using calculateEfficientFrontier.
CapitalMarketDemoException

marketPortfolio

public double[] marketPortfolio(double[][] covarianceMatrix,
                                double[] expectedReturns)
                         throws EfficientFrontierNotCalculatedException,
                                CapitalMarketDemoException
This method calls marketPortfolio on the entire range of the values of the expected returns in which the Market Portfolio could lie. This range of values of the expected returns corresponds exactly to the range over which the Efficient Frontier exists.

For more details concerning the issues effecting the constraints, efficiency, number of interpolation points use and so on...; we refer the reader to the documentation for the method marketPortfolio. As mentioned above the only difference with the aforementioned method at that here the range of the expected returns have been set as detail below.

Range over which the Expected Returns are set

The range over which the expected returns are set and hence the (constrained) Efficient Frontier is evaluated can be evaluated by using the methods minFrontierReturn, maxFrontierReturn; in order to evaluate the minimum and maximum of the continuous range of the expected return over which the Efficient Frontier exists for the given set of assets considered. Note that with this procedure we have set the range over which the Efficient Frontier is constructed to be equal to this largest possible range.

Dependency of this Construction

The Market Portfolio is found by searching along the (possibly constrained) Efficient Frontier and therefore before this methods is called and the Market Portfolio sort; the constraints on the assets should be set and the corresponding the Efficient Frontier should be constructed. You are able to set the constraints on the asset weights by calling setConstraints, and then the (possibly constrained) Efficient Frontier over the entire possible range of values of the expected returns can be constructed by calling the method: calculateEfficientFrontier. Please note that if the Efficient Frontier most be constructed over the entire possible range of expected returns because the interval over which it is constructed must be at least as big as the interval over which the Market Portfolio is sort which here in the entire range.

Parameters:
covarianceMatrix - the covariance matrix of the assets from which the (optimal) portfolio can be constructed. The dimensions of the (symmetric) covariance matrix will be n X n, where n is the number of assets from which the (optimal) portfolio can be constructed.
expectedReturns - the array of the expected returns of the assets from which the portfolios can be constructed. Where the k-th term will correspond to the percentage return (i.e. 1 percent = 1) or the absolute return of the k-th asset from the set of assets from which the Portfolios (on the Efficient Frontier) can be constructed.
EfficientFrontierNotCalculatedException
CapitalMarketDemoException
See Also:
marketPortfolio(double, double, double[][]), minFrontierReturn(double[]), maxFrontierReturn(double[])

marketPortfolioExpectedReturn

public double marketPortfolioExpectedReturn(double[] weights,
                                            double[][] historicalReturns)
                                     throws CapitalMarketDemoException
Evaluates the expected return of the Market Portfolio when the asset weights of the Market Portfolio are known. The (possibly constrained) asset weights of the market portfolio should be evaluated prior to the application of this method user marketPortfolio.

Remark: The historical returns of the assets used here will correspond to the historical returns of the asset which was used in the evaluation of the (possibly constrained) Efficient Frontier.

Approach used here and other options

Within this method we evaluate the expected returns of the assets from there historical values using a historical approach. That is, the present expected return is estimated to be the arithmetic average of the previous historical expected returns. A weighted average is then used in order to estimate the expected return. This should be the default means by which the (present) expected return of the Market Portfolio is estimated. However, there are a number of competing approaches which you may wish to use; these include:

  1. Scenario Approach as provided within AssetParameters.expectedReturn(double[], double[])

Parameters:
weights - the (possibly constrained) weights of the (risky) assets from which the Market Portfolio was constructed. These weights can be evaluated by using the method marketPortfolio.
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.
Returns:
A double equal to the expected return of the Market Portfolio.
CapitalMarketDemoException

marketPortfolioRisk

public double marketPortfolioRisk(double[] weights,
                                  double[][] covariance)
                           throws CapitalMarketDemoException
Evaluates the total risk of the Market Portfolio. The (possibly constrained) asset weights of the Market Portfolio should be evaluated prior to the application of this method user marketPortfolio.

Remark: The covariance matrix of the assets from which the Market Portfolio can be constructed will correspond to the covariance matrix used in the evaluated of the Efficient Frontier which must be evaluated before the Market Portfolio can be constructed.

Application time span and approaches to estimating the Covariance Matrix

The portfolio risk is an instantaneous quantity and therefore the covariances between the asset used within this method (and the Efficient Frontier) should also be instantaneous. However, in practice it is difficult to estimate the instantaneous value of the covariance matrix. We provide within the Asset Parameters class the following two methods:

  1. AssetParameters.covarianceMatrix(double[][]) - Historical Estimate.
  2. AssetParameters.covarianceMatrix(double[], double[][]) - Scenario based estimate.

The first approach is backward looking using the historical values and the second approach is forward looking. However, both approaches will tend to estimate the mean covariances over a period rather than the instantaneous value. This may not cause significant problems since in practice it is often an estimate of the risk over a period which is considered. However, in order to obtain the most suitable estimate for a given application the user should match the estimation procedure with the time period over which the estimate is desired. For example, if we desire to estimate the gain which diversification could have brought if a portfolio was rebalanced one month ago then the use of the historical approach using asset prices from the last month would be appropriate in the evaluation of the covariance.

Parameters:
weights - the (possibly constrained) weights of the assets from which the Market Portfolio was constructed evaluated by using the method marketPortfolio. Note, that the first terms of this array is the weights of the first asset from the collection of asset from which the Market Portfolio can be constructed, the second term is the weight of the second asset and so on.
Returns:
A double equal to the risk of the Market Portfolio.
CapitalMarketDemoException

weightCML

public double weightCML(double expectedReturn,
                        double equityExpected,
                        double marketRate)
                 throws CapitalMarketDemoException
For a given level of the expected return we evaluate the proportion of the investors wealth to invest in the Market Portfolio (as constructed in marketPortfolio) such that we have the Capital Market Line (CML) portfolio which offers to lowest risk for the given level of the expected return.

Further Explanation

In order to evaluate the weighting of the Market Portfolio we are required to provide the expected return of the desired portfolio on the CML, the expected return of the Market Portfolio and the prevailing market rate at which cash can be borrowed or lent to the market. The market rate at which cash can by borrow or lend should be known but the expected return of the Market Portfolio should be evaluated using marketPortfolioExpectedReturn. Which in turn requires that the Market Portfolio in known, which can be constructed using marketPortfolio, which depends firstly the asset weights constraints (if applicable) being set using setConstraints before the Efficient Frontier is constructed using calculateEfficientFrontier.

Remark:

Completeness of the Methods: weightCML, returnCML, riskCML, weight2Risk

The portfolio on the CML can be selected from knowledge of its total risk, expected return or weight of the Market Portfolio. Then using the above mentioned methods we are able to evaluate the other quantities which are not given. For example, if the expected return of the portfolio is known then the weight of the market portfolio can be evaluated using weightCML and the risk can be evaluated using riskCML. If on the other hand the total risk of the portfolio is known then the corresponding expected return of the portfolio can be evaluated by returnCML, and then using this deduced value we are able to evaluated the weight of the Market Portfolio using weightCML. For completeness we include the method weight2Risk which evaluates the risk of a portfolio on the CML when the weight of the Market Portfolio within the CML portfolio is known. From knowledge of the risk of the CML portfolio we able to evaluate the corresponding value of the expected return using the method returnCML.

Therefore, using the three `...CML' methods along with `weight2Risk', which one of: total risk, expected return or weight of Market Portfolio, is used in order to selected the portfolio from the CML we are able to deduce the other two quantitative properties.

Remarks on time units and the percentage convention used

Within the application of this method you are required to provide a number of of parameters which are quoted within respect to a given period of time, such as `per year', `per month' and so on. Within the application of this method it is important to point out that the time unit used for each of these parameters should correspond. For instance the expected return of the desired portfolio, expected return of the Market Portfolio and the market rate at which money can be lent or borrowed which are each given in decimal format (i.e. 1 percent = 0.01) should be given with respect to the same unit of time. Moreover, the returned value of the expected return of the portfolio on the CML will also be expressed with respect to the same unit of time and in decimal format (i.e. 1 percent = 0.01).

Parameters:
expectedReturn - the expected return of the portfolio desired by the investor given in decimal format (i.e. 1 percent = 0.01)
equityExpected - the expected return from the Market Portfolio which is constructed by the method marketPortfolio, which can then be evaluated using the method marketPortfolioExpectedReturn. Note that the expected return should be given in decimal format (i.e. 1 percent = 0.01)
marketRate - the fixed rate at which the investor can borrow or lend money from the market given in decimal format (i.e. 1 percent = 0.01). Recall, that the CAPM assumes that the investor can borrow or lend cash at some prevailing market rate. Though in practice the lending and borrowing costs in general will differ, for large market players such as investment banks these two rates will be approximately the same and be approximately equal to the overnight rate offered between investment banks (i.e. LIBOR or similar). Smaller players can also obtain similar lending and borrow rates through the use of structured products such as REPOs and similar, offered by investments banks. Therefore, for most market participants this assumption is reasonable and does not lead to significant errors. Please note, that this rate refers to the rate the investor will receive on any cash held within the portfolio as well as the rate at which they are able to borrow cash from the market.
Returns:
The weighting of the Market Portfolio within a portfolio on the CML with a given expected return. The weighting of the Market Portfolio is the factor of the base capital which is invested within the Market Portfolio within the portfolio selected from the CML. Note that since the portfolio can borrow money from the market this weighting can be greater than 1.
CapitalMarketDemoException
See Also:
riskCML - allow the risk of a portfolio on the CML to be evaluated when the expected return of the portfolio is known.
, returnCML - allow the expected return of a portfolio on the CML to be evaluated when the total risk of the portfolio is known.
, weight2Risk - allows the risk of a portfolio on the CML to be evaluated when the weight of the Market Portfolio within the CML portfolio is known.

returnCML

public double returnCML(double risk,
                        double equityRisk,
                        double equityExpected,
                        double marketRate)
                 throws CapitalMarketDemoException
Find the corresponding value of the expected return of the portfolio on the Capital Market Line (CML) when the total risk is known.

Further Explanation

In order to evaluate the expected return total we are required to provide the total risk of the portfolio on the CML, the total risk and expected return of the Market Portfolio and the prevailing market rate at which cash can be borrowed or lent to the market. The market rate at which cash can by borrow or lend should be known but the expected return and the total risk of the Market Portfolio should be evaluated using marketPortfolioExpectedReturn and marketPortfolioRisk respectively. In order to evaluate these constants you will need to construct the Market Portfolio itself by using marketPortfolio, which in turn depends firstly the asset weights constraints (if applicable) being set using setConstraints before the Efficient Frontier is constructed using calculateEfficientFrontier.

Completeness of the Methods: returnCML, weightCML, riskCML, weight2Risk

The portfolio on the CML can be selected from knowledge of its total risk, expected return or weight of the Market Portfolio. Then using the above mentioned methods we are able to evaluate the other quantities which are not given. For example, if the expected return of the portfolio is known then the weight of the market portfolio can be evaluated using weightCML and the risk can be evaluated using riskCML. If on the other hand the total risk of the portfolio is known then the corresponding expected return of the portfolio can be evaluated by returnCML, and then using this deduced value we are able to evaluated the weight of the Market Portfolio using weightCML. For completeness we include the method weight2Risk which evaluates the risk of a portfolio on the CML when the weighting of the Market Portfolio within the CML portfolio is known. From knowledge of the risk of the CML portfolio we able to evaluate the corresponding value of the expected return using the method returnCML.

Therefore, using the three `...CML' methods along with `weight2Risk', which one of: total risk, expected return or weight of Market Portfolio, is used in order to selected the portfolio from the CML we are able to deduce the other two quantitative properties.

Remarks on time units and the percentage notation convention used

Within the application of this method you are required to provide a number of of parameters which are quoted within respect to a given period of time, such as `per year', `per month' and so on. Within the application of this method it is important to point out that the time unit used for each of these parameters should correspond. For instance the risk of the desired portfolio, risk of the Market Portfolio, expected return of the Market Portfolio and the market rate at which money can be lent or borrowed which are each given in decimal format (i.e. 1 percent = 0.01) should be given with respect to the same unit of time. Moreover, the returned value of the expected return of the portfolio on the CML will also be expressed with respect to the same unit of time and in decimal format (i.e. 1 percent = 0.01).

Parameters:
risk - the total risk in decimal format (i.e. 1 percent = 0.01) of the portfolio on the CML for which the expected return is being evaluate.
equityRisk - the risk given in decimal format (i.e. 1 percent = 0.01) of the market portfolio which can be evaluated using the method marketPortfolioRisk.
equityExpected - the expected return from the Market Portfolio given in decimal format (i.e. 1 percent = 0.01). The expected return of the Market Portfolio can be evaluated using the method marketPortfolioExpectedReturn.
marketRate - the fixed rate at which the investor can borrow or lend money from the market given in decimal format (i.e. 1 percent = 0.01). Recall, that the CAPM assumes that the investor can borrow or lend cash at some prevailing market rate. Though in practice the lending and borrowing costs in general will differ, for large market players such as investment banks these two rates will be approximately the same and be approximately equal to the overnight rate offered between investment banks (i.e. LIBOR or similar). Smaller players can also obtain similar lending and borrow rates through the use of structured products such as REPOs and similar, offered by investments banks. Therefore, for most market participants this assumption is reasonable and does not lead to significant errors. Please note, that this rate refers to the rate the investor will receive on any cash held within the portfolio as well as the rate at which they are able to borrow cash from the market.
Returns:
Expected return of a portfolio on the CML which has a given total risk.
CapitalMarketDemoException
See Also:
riskCML - allow the risk of a portfolio on the CML to be evaluated when the expected return of the portfolio is known.
, weightCML - allows the Market Portfolios weight to be evaluated for a portfolio on the CML with a given expected return.
, weight2Risk - allows the risk of a portfolio on the CML to be evaluated when the weight of the Market Portfolio within the CML portfolio is known.

riskCML

public double riskCML(double expectedReturn,
                      double equityExpected,
                      double marketRate,
                      double equityRisk)
               throws CapitalMarketDemoException
Calculates the risk of the optimal Capital Market Line (CML) portfolio for a given expected return.

Further Explanation

In order to evaluate the total risk we are required to provide the expected return and the risk of the Market Portfolio. These properties of the Market Portfolio can be evaluated by using marketPortfolioExpectedReturn and marketPortfolioRisk respectively. In order to evaluate these constants you will need to construct the Market Portfolio itself by using marketPortfolio, which in turn depends firstly the asset weights constraints (if applicable) being set using setConstraints before the Efficient Frontier is constructed using calculateEfficientFrontier.

Remark:

Completeness of the Methods: riskCML, weightCML, returnCML, weight2Risk

The portfolio on the CML can be selected from knowledge of its total risk, expected return or weight of the Market Portfolio. Then using the above mentioned methods we are able to evaluate the other quantities which are not given. For example, if the expected return of the portfolio is known then the weight of the market portfolio can be evaluated using weightCML and the risk can be evaluated using riskCML. If on the other hand the total risk of the portfolio is known then the corresponding expected return of the portfolio can be evaluated by returnCML, and then using this deduced value we are able to evaluated the weight of the Market Portfolio using weightCML. For completeness we include the method weight2Risk which evaluates the risk of a portfolio on the CML when the weight of the Market Portfolio within the CML portfolio is known. From knowledge of the risk of the CML portfolio we able to evaluate the corresponding value of the expected return using the method returnCML.

Therefore, using the three `...CML' methods along with `weight2Risk', which one of: total risk, expected return or weight of Market Portfolio, is used in order to selected the portfolio from the CML we are able to deduce the other two quantitative properties.

Remarks on time units and the percentage convention used

Within the application of this method you are required to provide a number of of parameters which are quoted within respect to a given period of time, such as `per year', `per month' and so on. Within the application of this method it is important to point out that the time unit used for each of these parameters should correspond. For instance the expected return of the desired portfolio, expected return of the Market Portfolio, the market rate at which money can be lent or borrowed and the risk of the Market Portfolio which are each given in decimal format (i.e. 1 percent = 0.01) should be given with respect to the same unit of time. Moreover, the returned value of the total risk of the portfolio on the CML will also be expressed with respect to the same unit of time and in decimal format (i.e. 1 percent = 0.01).

Parameters:
expectedReturn - the expected return of the portfolio on the CML for which the risk is evaluated given in decimal format (i.e. 1 percent = 0.01)
equityExpected - the expected return from the Market Portfolio given in decimal format (i.e. 1 percent = 0.01). The expected return of the Market Portfolio can be evaluated using the method marketPortfolioExpectedReturn.
marketRate - the fixed rate at which the investor can borrow or lend money from the market given in decimal format (i.e. 1 percent = 0.01)
equityRisk - the risk given in decimal format (i.e. 1 percent = 0.01) of the market portfolio which can be evaluated using the method marketPortfolioRisk.
Returns:
The total risk in decimal format (i.e. 1 percent = 0.01) of the portfolio on the CML which has a given expected return.
CapitalMarketDemoException
See Also:
weightCML - allows the Market Portfolios weight to be evaluated for a portfolio on the CML with a given expected return.
, returnCML - allows the expected return of a portfolio on the CML to be evaluated when the total risk of the portfolio is known.
, weight2Risk - allows the risk of a portfolio on the CML to be evaluated when the weight of the Market Portfolio within the CML portfolio is known.

weight2Risk

public double weight2Risk(double weighting,
                          double equityRisk)
                   throws CapitalMarketDemoException
Evaluates the total risk of a portfolio on the CML when the weighting of the Market Portfolio within the portfolio selected for the CML is known.

Further Explanation

Note that we are required to provide the risk of the Market Portfolio within the application of this method. This constant can be evaluated by using marketPortfolioRisk, which in turn requires that the Market Portfolios asset weights are known. The weights of the assets within the Market Portfolio can be evaluated using the marketPortfolio. The evaluation of these (possibly constrained) weights requires that the Efficient Frontier has already been evaluated using calculateEfficientFrontier, before which the constraints on the asset should have been set (if applicable) using setConstraints.

Completeness of the Methods: weight2Risk, riskCML, weightCML, returnCML

The portfolio on the CML can be selected from knowledge of its total risk, expected return or weight of the Market Portfolio. Then using the above mentioned methods we are able to evaluate the other quantities which are not given. For example, if the expected return of the portfolio is known then the weight of the market portfolio can be evaluated using weightCML and the risk can be evaluated using riskCML. If on the other hand the total risk of the portfolio is known then the corresponding expected return of the portfolio can be evaluated by returnCML, and then using this deduced value we are able to evaluated the weight of the Market Portfolio using weightCML. For completeness we include the method weight2Risk which evaluates the risk of a portfolio on the CML when the weight of the Market Portfolio within the CML portfolio is known. From knowledge of the risk of the CML portfolio we able to evaluate the corresponding value of the expected return using the method returnCML.

Therefore, using the three `...CML' methods along with `weight2Risk', which one of: total risk, expected return or weight of Market Portfolio, is used in order to selected the portfolio from the CML we are able to deduce the other two quantitative properties.

Remarks on time units and the percentage convention used

Within the application of this method you are required to provide the risk in decimal format (i.e. 1 percent = 0.01) of the Market Portfolio which will be quoted within respect to a given period of time, such as `per year', `per month' and so on. Moreover, the returned value of the total risk of the portfolio on the CML will also be expressed with respect to the same unit of time and in decimal format (i.e. 1 percent = 0.01).

Remarks concerning Constraints on the level of Cash Borrowed or Lent

As mentioned in the introduction of this class often in practice a given fund will have limits regarding:

  1. Maximum level of cash which should be help within the portfolio
  2. Maximum level of borrowing (i.e. gearing) which the portfolio use
We provide further motivation concerning the rational for such limits within the PDF documentation.

Within the context of our implementation these restrictions would translate into constraints on the level of cash, that is the weighting of the Market Portfolio within the portfolio on the CML. Within the class we are able to deal with such constraints of the level of cash borrow or lent from/to the market. In particular, within such instances we are able to evaluated the corresponding optimal portfolio's expected return, risk and Market Portfolio Weighting for the following schema:

  1. Express in terms of Weightings: Translated the restrictions on the borrow and lending into statements concerning the maximum and minimum weighting and the Market Portfolio.
  2. Evaluate the range of Total Risk: Evaluate the corresponding range of the Total Risk of the range of portfolios on the CML which have the given range of Market Portfolio weightings found in the previous step. We are able to evaluate this range by apply this method and observing that the Total Risk is monotonically increasing in risk as the Market Portfolio weighting increases.
  3. Evaluate the range of the Expected Return: Evaluate the corresponding range of the expected returns of the range of portfolios on the CML which have given range of Market Portfolio weightings. Since (by the previous step) the portfolios with a range of Market Portfolio Weightings corresponds to the collection of portfolios on the CML for a given range of the total risk, and the fact that the expected return increase monotonically as the total risk increase by using returnCML we are able to evaluate the range of expected returns which determines the portfolios with given constraints on the cash levels within the portfolio.

Remark: The key reason why this approach works is that if the weighting of the Market Portfolio increases continuously monotonically increases, the corresponding total risk and expected returns of the portfolio also continuously monotonically increases.

The only thing that needs to be established is how we can translate statements concerning the limits on borrowing and lending, and statements concerning the weighting of the market portfolio. We will illustrate how this is done by the following example:

Example: We know that the Market Portfolio of a collection of assets has an expected return of 10 percent per year and a risk of 20 percent per year. According to the CAPM if the portfolio manager can only leverage his portfolio by 20 percent, and must also never hold more than 30 percent of the funds capital in cash then what is the range of total risk and expected return of the (optimal) portfolios which the fund manager can hold?

Solution: Since the optimal portfolio will consist of the Market Portfolio with either excess money lent to the market or money borrowed from the market in order to purchase more baskets of the Market Portfolio. The optimal portfolios will can be constructed will range from borrowing 20 percent of the capital base and purchasing further baskets of the Market Portfolio, to lending 30 percent of the capital base and holding the remaining 70 percent of the capital base within the Market Portfolio. Therefore, the Weighting of the Market Portfolio can range from 1.2 (maximum gearing) to 0.7 (maximum lending). This completes step 1, in the above schema to evaluate range of the risk and expected return we just perform step 2 and 3, as describe above.

Note: We implement this exact instance as an examples called CapitalMarketClient_CashConstraints.

Parameters:
weighting - the weighting of the Market Portfolio within the CML portfolio. The weighting corresponds to the multiple of the base capital which is invested within the market portfolio. Recall that all portfolios on the CML consist of a weighting in the market portfolio which can be constructed using the method marketPortfolio and cash. The weighting in cash can be negative, that is money can be borrowed from the market in order to increase that amount of the Market Portfolio which is controlled by the underlying capital base. In this instance the weighting of the Market Portfolio will increase above 1 since more than 100 percent of the available (base) capital has been invested within the Market Portfolio.
Returns:
The total risk in decimal format (i.e. 1 percent = 0.01) of the portfolio on the CML which has a given weighting of the Market Portfolio.
CapitalMarketDemoException
See Also:
weightCML - allows the Market Portfolios weight to be evaluated for a portfolio on the CML with a given expected return.
, returnCML - allows the expected return of a portfolio on the CML to be evaluated when the total risk of the portfolio is known.
, riskCML - allow the risk of a portfolio on the CML to be evaluated when the expected return of the portfolio is known.

WebCab Portfolio Demo
v4.2
(J2SE Edition)