WebCab Portfolio Web Services for .NET v5.0 Demo

EasyOptimal.CapmRisk Method 

For a given value of the risk find the weighting of the cash and (risky) assets of the optimal portfolio which can hold or lend cash at the prevailing market rate.

public double[] CapmRisk(
   double risk,
   double[][] historicalReturns,
   double[] lowerBounds,
   double[] upperBounds,
   double marketRate,
   int interpolationPoints,
   double precision
);

Parameters

risk
The value of the risk of the optimal portfolio (i.e. the portfolio with the lower risk) found.
historicalReturns
This array of dimension two is the historical returns in absolute (i.e. market price) or relative (i.e. percentage change) terms of the assets from which the optimal portfolio can be constructed. The n-th element of the 2-dimensional array is an array, where the k-th term on this array is the historical return of the n-th assets in the k-th period before the present periods return.
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.
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.
interpolationPoints
precision
This parameters allow the level of the precision required to be set, where the smaller the parameter the (generally) higher the precision. A reasonable value to take for the precision is 1E-4, or 0.0001.

Remarks

Structure of the Returned Array

The length of the array of doubles returned is n+1, where n is the number of (risky) assets from which the portfolio can be constructed. The first term of the array is the weighting of the cash element within the optimal portfolio, and the k+1 element is the weighting of the k (risky) asset available.

See Also

EasyOptimal Class | Portfolio Namespace