WebCab Portfolio Demo
v4.2
(J2EE Edition)

com.webcab.ejb.finance.portfolio
Interface VolatilityLocal

All Superinterfaces:
EJBLocalObject

public interface VolatilityLocal
extends EJBLocalObject

Local interface of Volatility. This interface provides the same functionality as the Volatility remote interface.

See Also:
Volatility

Method Summary
 double archVolatilityEstimate(double longTermVolatility, double weightOfVolatility, double[] observations, double[] weights)
          Method archVolatilityEstimate(double, double, double[], double[]) as defined in the Volatility remote interface.
 double daysYearRescaling(double volPerPeriod, double daysInPeriod, int convention)
          Method daysYearRescaling(double, double, int) as defined in the Volatility remote interface.
 double ewmaVolatilityEstimate(double weightRatio, double i_1thDayEstimateOfVolatility, double endi_1thDay, double starti_1thDay)
          Method ewmaVolatilityEstimate(double, double, double, double) as defined in the Volatility remote interface.
 double ewmaVolatilityEstimateInduction(double weightRatio, double firstDaysVolatilityEstimate, double[] endOfDay, double[] startOfDay)
          Method ewmaVolatilityEstimateInduction(double, double, double[], double[]) as defined in the Volatility remote interface.
 double garchVolatilityEstimate(double longTermVariance, double longTermVarianceWeight, double ithDayVolatilityEstimate, double ithDayVolatilityEstimateWeight, double ithDayAssetPrice, double i_1thDayAssetPrice, double assetPriceWeight)
          Method garchVolatilityEstimate(double, double, double, double, double, double, double) as defined in the Volatility remote interface.
 double historicalEstimate(double[] assetPrices)
          Method historicalEstimate(double[]) as defined in the Volatility remote interface.
 double historicalEstimateStandardError(double numberOfDays, double volatilityEstimate)
          Method historicalEstimateStandardError(double, double) as defined in the Volatility remote interface.
 double historicalEstimateWithDividends(double[] assetPrices, double[] dividendsPaid)
          Method historicalEstimateWithDividends(double[], double[]) as defined in the Volatility remote interface.
 double returnDuringithDay(double ithDayAssetPrice, double i_1thDayAssetPrice)
          Method returnDuringithDay(double, double) as defined in the Volatility remote interface.
 double variance(double[] historicalReturns)
          Method variance(double[]) as defined in the Volatility remote interface.
 double variance(double[] probability, double[] returns)
          Method variance(double[], double[]) as defined in the Volatility remote interface.
 double yearDaysRescaling(double volPerAnnum, double daysRescaledTo, int convention)
          Method yearDaysRescaling(double, double, int) as defined in the Volatility remote interface.
 
Methods inherited from interface javax.ejb.EJBLocalObject
getEJBLocalHome, getPrimaryKey, isIdentical, remove
 

Method Detail

yearDaysRescaling

public double yearDaysRescaling(double volPerAnnum,
                                double daysRescaledTo,
                                int convention)
                         throws OptionsException,
                                VolatilityDemoException
Method yearDaysRescaling(double, double, int) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Calculates the value of the volatility over a given number of days when the annual volatility is known. The annual volatility may be given with respect to either the 252, 360 or 365 days convention.

Parameters:
volPerAnnum - is the volatility per annum
daysRescaledTo - is the number of days which the volatility is rescaled to. In particular, the doubled returned with represent volatility per d days.
convention - One of the day count conventions listed inside the OptionsConstants class: ANNUAL_DAY_COUNT_252, ANNUAL_DAY_COUNT_360, or ANNUAL_DAY_COUNT_365.
Throws:
OptionsException - thrown when the day count convention is not correctly specified
VolatilityDemoException
See Also:
OptionsConstants.ANNUAL_DAY_COUNT_252, OptionsConstants.ANNUAL_DAY_COUNT_360, OptionsConstants.ANNUAL_DAY_COUNT_365, Volatility.yearDaysRescaling(double, double, int)

daysYearRescaling

public double daysYearRescaling(double volPerPeriod,
                                double daysInPeriod,
                                int convention)
                         throws OptionsException,
                                VolatilityDemoException
Method daysYearRescaling(double, double, int) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Evaluates the annual volatility when the volatility of a given number of days is known. The annual volatility may be evaluated with respec to either the 252, 360 or 365 days convention.

Parameters:
volPerPeriod - the volatility over the given number days considered.
daysInPeriod - the number of days in period over which volatility is known. In the case that the daily volatility is given this parameter will be 1.
convention - One of the day count conventions listed inside the OptionsConstants class: ANNUAL_DAY_COUNT_252, ANNUAL_DAY_COUNT_360, or ANNUAL_DAY_COUNT_365.
Throws:
OptionsException - thrown when the day count convention is not correctly specified
VolatilityDemoException
See Also:
OptionsConstants.ANNUAL_DAY_COUNT_252, OptionsConstants.ANNUAL_DAY_COUNT_360, OptionsConstants.ANNUAL_DAY_COUNT_365, Volatility.daysYearRescaling(double, double, int)

historicalEstimate

public double historicalEstimate(double[] assetPrices)
                          throws VolatilityDemoException
Method historicalEstimate(double[]) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Evaluates the historical estimate of the present volatility. This procedure uses the price data at the end of equal time intervals of an investment asset which does not pay dividends or interest payments in order to estimate its present volatility per interval. The number returned is the estimated (present) volatility per interval expressed in decimal format (i.e. 1 percent = 0.01). Hence if daily values of the assets price where used then this method will return the historical estimate of the daily volatility.

Choosing the number of historical points used

The historical estimate is evaluated using a given number of historical values of the assets market price. Care should be taken when deciding on the number of historical values to use within the historical estimate of the present volatility. A balance needs to be made between using a large sample (resulting in the small standard error) and a smaller sample which does not take too distant historical values which may not fully reflect the present market dynamics. As a rule of thumb the number of days used in order to historical estimate the present daily volatility should (in generally) be between 90 and 180 days.

Parameters:
assetPrices - an array of the assets price at the end of each interval. Note that if we use daily values of the asset price then this methods will return an estimate of the daily volatility.
VolatilityDemoException
See Also:
historicalEstimateWithDividends(double[], double[]), Volatility.historicalEstimate(double[])

historicalEstimateWithDividends

public double historicalEstimateWithDividends(double[] assetPrices,
                                              double[] dividendsPaid)
                                       throws OptionsException,
                                              VolatilityDemoException
Method historicalEstimateWithDividends(double[], double[]) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Calculates the historical estimate of the present volatility taking into account the dividends or interest payments of the underlying asset.

Choosing the number of historical points used

The historical estimate is evaluated using a given number of historical values of the assets market price. Care should be taken when deciding on the number of historical values to use within the historical estimate of the present volatility. A balance needs to be made between using a large sample (resulting in the small standard error) and a smaller sample which does not take too distant historical values which may not fully reflect the present market dynamics. As a rule of thumb the number of days used in order to historical estimate the present daily volatility should (in generally) be between 90 and 180 days.

Parameters:
assetPrices - an array of the assets market value at the end of each interval. Note that if we use daily values of the asset price then this method will return an estimate of the daily volatility.
dividendsPaid - an array of the dividends (or interest payments) from the asset within each period. If we are estimating the daily volatility then the periods considered will correspond to days. The length of the array corresponding to the dividends (or interest payments) must have the same length as the array of asset prices used. If no payment is made within the i-th interval then the i-th element of the array in zero.
Throws:
OptionException - thrown when the number of asset prices is not equal to the number of dividends
OptionsException
VolatilityDemoException
See Also:
historicalEstimate(double[]), Volatility.historicalEstimateWithDividends(double[], double[])

historicalEstimateStandardError

public double historicalEstimateStandardError(double numberOfDays,
                                              double volatilityEstimate)
                                       throws VolatilityDemoException
Method historicalEstimateStandardError(double, double) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Returns the estimate of the standard error of the standard historical estimation given by the functions volatilityHistoricalEstimate and volatilityHistoricalEstimateWithDividends.

Recall that the standard error is the standard deviation of the sampling distribution of that statistic. Standard errors are important because they reflect how much sampling fluctuations effect the reliability of the statistic, in this case the estimate of the volatility. The standard error of a statistic will depend on the sample size where generally the larger the sample size the smaller the standard error will be.

Parameters:
numberOfDays - the number of days over which the historical data is taken
volatilityEstimate - estimate of the volatility per annum
VolatilityDemoException
See Also:
Volatility.historicalEstimateStandardError(double, double)

archVolatilityEstimate

public double archVolatilityEstimate(double longTermVolatility,
                                     double weightOfVolatility,
                                     double[] observations,
                                     double[] weights)
                              throws OptionsException,
                                     VolatilityDemoException
Method archVolatilityEstimate(double, double, double[], double[]) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Returns the estimate of the volatility according to the ARCH model. If the sum of the weights is not within 0.1 of 1, or the number of weights does not correspond to the number of observations them the method will throw an exception. Note that for the input arrays the first value observations[0] is the latest observation and observation[1] is the previous observation and so on.

Parameters:
observations - an array of historical observations
weights - an array of weights associated to the historical observations
longTermVolatility - this is the long term volatility
weightOfVolatility - this is the weight assigned to the volatility
Throws:
OptionsException - thrown when the number of observations is not equal to the number of weights
VolatilityDemoException
See Also:
Volatility.archVolatilityEstimate(double, double, double[], double[])

ewmaVolatilityEstimate

public double ewmaVolatilityEstimate(double weightRatio,
                                     double i_1thDayEstimateOfVolatility,
                                     double endi_1thDay,
                                     double starti_1thDay)
                              throws VolatilityDemoException
Method ewmaVolatilityEstimate(double, double, double, double) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

This method returns the estimate of the volatility for the ith day made at the end of the previous (i-1)th day, using an estimate of the volatility on the (i-1)th day according to the EWMA model with respect to changes in the market variable. The EWMA model is a special case of the ARCH model, where the weights assigned to the historical volatility measure decreases by a constant factor.

Remarks:

Parameters:
weightRatio - this constant between one and zero, is the ratio between the ith weight and the (i-1)th weight. The smaller the value used the more sensitive the model is to resent changes in the volatility.
i_1thDayEstimateOfVolatility - this is the previous reading or estimate of the volatility on the (i-1)th day
endi_1thDay - the market variable (for example, asset price) at the close of the (i-1)th day
starti_1thDay - the market variable (for example, asset price) at the start of the (i-1)th day
VolatilityDemoException
See Also:
ewmaVolatilityEstimateInduction(double, double, double[], double[]), Volatility.ewmaVolatilityEstimate(double, double, double, double)

ewmaVolatilityEstimateInduction

public double ewmaVolatilityEstimateInduction(double weightRatio,
                                              double firstDaysVolatilityEstimate,
                                              double[] endOfDay,
                                              double[] startOfDay)
                                       throws VolatilityDemoException
Method ewmaVolatilityEstimateInduction(double, double, double[], double[]) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Estimates of the volatility for the ith day made at the end of the previous (i-1)th day, using an estimate of the volatility on the 0th day, according to the EWMA model with respect to changes in the market variable. The EWMA model is a special case of the ARCH model, where the weights assigned to the historical volatility measure decreases by a constant factor.

Remarks:

Parameters:
weightRatio - this constant between one and zero, is the ratio between the kth weight and the (k-1)th weight, for all k. The smaller the value used the more sensitive the model is to resent changes in the volatility.
firstDaysVolatilityEstimate - this is the estimate of the volatility on the 0th day
endOfDay - this is an array of length i+1, where the first term is the closing value of the market variable (for example, the asset price) on the 0th day, the second element is the closing value of the market variable on the 1st day and so on...
startOfDay - this is an array of length i+1, where the first term is the opening value of the market variable (for example, the asset price) on the 0th day, the second element is the opening value of the market variable on the 1st day and so on...
VolatilityDemoException
See Also:
ewmaVolatilityEstimate(double, double, double, double), Volatility.ewmaVolatilityEstimateInduction(double, double, double[], double[])

returnDuringithDay

public double returnDuringithDay(double ithDayAssetPrice,
                                 double i_1thDayAssetPrice)
                          throws VolatilityDemoException
Method returnDuringithDay(double, double) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

This function returns the continuously compounded return of an asset over one day which is required by the method garchVolatilityEstimate.

Parameters:
ithDayAssetPrice - this in the asset price at the close of business on the ith day
i_1thDayAssetPrice - this is the asset price at the close of business on the i-1th day excelFunction return
VolatilityDemoException
See Also:
Volatility.returnDuringithDay(double, double)

variance

public double variance(double[] probability,
                       double[] returns)
                throws VolatilityDemoException
Method variance(double[], double[]) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Calculates the variance of the expected returns of an asset given the assets returns in given market states and the probability of those market states occurring.

Parameters:
probability - probability[s] is the probability of the state s occurring
returns - returns[s] is the return (increase in market value) for the asset in the state s
VolatilityDemoException
See Also:
Volatility.variance(double[], double[])

variance

public double variance(double[] historicalReturns)
                throws VolatilityDemoException
Method variance(double[]) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Evaluates the variance of the historical returns of an asset.

Parameters:
historicalReturns - historicalReturns[t] is the return of the asset in the tth period
VolatilityDemoException
See Also:
Volatility.variance(double[])

garchVolatilityEstimate

public double garchVolatilityEstimate(double longTermVariance,
                                      double longTermVarianceWeight,
                                      double ithDayVolatilityEstimate,
                                      double ithDayVolatilityEstimateWeight,
                                      double ithDayAssetPrice,
                                      double i_1thDayAssetPrice,
                                      double assetPriceWeight)
                               throws OptionsException,
                                      VolatilityDemoException
Method garchVolatilityEstimate(double, double, double, double, double, double, double) as defined in the Volatility remote interface.

Description copied from the Volatility interface:

Estimates of the volatility according to the GARCH(1,1) model for the (i+1)th day. Note that the sum of the weights associated with the long term variance, previous estimate of the volatility and asset price should add up to one.

Parameters:
longTermVariance - long term average variance
longTermVarianceWeight - the weight given to the long term variance
ithDayVolatilityEstimate - the estimate of the volatility for the ith day
ithDayVolatilityEstimateWeight - the weight given to the estimate of the volatility from the ith day
ithDayAssetPrice - the market price of the asset at the close on the ith day
i_1thDayAssetPrice - the market price of the underlying asset at the open of the previous business day
assetPriceWeight - the weight associated within the model to the influence of the return on the asset over the last day.
Throws:
OptionsException - thrown when the sun of the weights associated with the long term variance, previous estimate of the volatility and the asset price are not equal to 1.
VolatilityDemoException
See Also:
Volatility.garchVolatilityEstimate(double, double, double, double, double, double, double)

WebCab Portfolio Demo
v4.2
(J2EE Edition)