﻿

Accelerating the pace of engineering and science

# stockspec

Create stock structure

## Syntax

StockSpec = stockspec(Sigma, AssetPrice, DividendType,
DividendAmounts, ExDividendDates)

## Arguments

Sigma

NINST-by-1 decimal annual price volatility of underlying security.

AssetPrice

NINST-by-1 vector of underlying asset price values at time 0.

DividendType

(Optional) NINST-by-1 cell array of strings specifying each stock's dividend type. Dividend type must be either cash for actual dollar dividends, constant for constant dividend yield, or continuous for continuous dividend yield. This function does not handle stock option dividends.

 Note   Dividends are assumed to be paid in cash. Noncash dividends (stock) are not allowed. When combining two or more type of dividends, shorter rows should be padded with the value NaN.

DividendAmounts

(Optional) NINST-by-NDIV matrix of cash dividends or NINST-by-1 vector representing a constant or continuous annualized dividend yield.

ExDividendDates

(Optional) NINST-by-NDIV matrix of ex-dividend dates for cash type or NINST-by-1 vector of ex-dividend dates for constant dividend type. For continuous dividend type, this argument should be ignored.

## Description

StockSpec = stockspec(Sigma, AssetPrice, DividendType,
DividendAmounts, ExDividendDates)
creates a MATLAB® structure containing the properties of a stock.

 Note:   StockSpec handles other types of underliers when pricing instruments other than equities.

## Examples

expand all

### Create a StockSpec for Stocks With Cash Dividends

Consider a stock that provides four cash dividends of \$0.50 on January 3, 2008, April 1, 2008, July 5, 2008 and October 1, 2008. The stock is trading at \$50, and has a volatility of 20% per annum. Using this data, create the structure StockSpec:

```AssetPrice = 50;
Sigma = 0.20;

DividendType = {'cash'};
DividendAmounts = [0.50, 0.50, 0.50, 0.50];
ExDividendDates = {'03-Jan-2008', '01-Apr-2008', '05-July-2008', '01-Oct-2008'};

StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmounts, ExDividendDates)
```
```StockSpec =

FinObj: 'StockSpec'
Sigma: 0.2000
AssetPrice: 50
DividendType: {'cash'}
DividendAmounts: [0.5000 0.5000 0.5000 0.5000]
ExDividendDates: [733410 733499 733594 733682]

```

Examine the StockSpec structure.

```datedisp(StockSpec.ExDividendDates)
StockSpec.DividendType
```
```03-Jan-2008   01-Apr-2008   05-Jul-2008   01-Oct-2008

ans =

'cash'

```

The StockSpec structure encapsulates the information of the stock and its four cash dividends.

### Create a StockSpec for Stocks With Cash and Continuous Dividends

Consider two stocks that are trading at \$40 and \$35. The first one provides two cash dividends of \$0.25 on March 1, 2008 and June 1, 2008. The second stock provides a continuous dividend yield of 3%. The stocks have a volatility of 30% per annum. Using this data, create the structure StockSpec:

```AssetPrice = [40; 35];
Sigma = .30;

DividendType = {'cash'; 'continuous'};
DividendAmount = [0.25, 0.25 ; 0.03 NaN];

DividendDate1 = 'March-01-2008';
DividendDate2 = 'Jun-01-2008';

StockSpec = stockspec(Sigma, AssetPrice, DividendType, DividendAmount,...
{ DividendDate1, DividendDate2 ; NaN NaN})
```
```StockSpec =

FinObj: 'StockSpec'
Sigma: [2x1 double]
AssetPrice: [2x1 double]
DividendType: {2x1 cell}
DividendAmounts: [2x2 double]
ExDividendDates: [2x2 double]

```

Examine the StockSpec structure.

```datedisp(StockSpec.ExDividendDates)
StockSpec.DividendType
```
```01-Mar-2008   01-Jun-2008
NaN           NaN

ans =

'cash'
'continuous'

```

The StockSpec structure encapsulates the information of the two stocks and their dividends.