stockspec
Create stock structure
Syntax
Description
creates
a MATLAB® structure containing the properties of a stock.StockSpec
= stockspec(Sigma
,AssetPrice
)
Note
StockSpec
handles other types of underliers
when pricing instruments other than equities.
adds
optional arguments for StockSpec
= stockspec(___,DividendType
,DividendAmounts
,ExDividendDates
)DividendType
, DividendAmounts
,
and ExDividendDates
.
Examples
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 = struct with fields:
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)
03-Jan-2008 01-Apr-2008 05-Jul-2008 01-Oct-2008
StockSpec.DividendType
ans = 1x1 cell array
{'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 = struct with fields:
FinObj: 'StockSpec'
Sigma: [2x1 double]
AssetPrice: [2x1 double]
DividendType: {2x1 cell}
DividendAmounts: [2x2 double]
ExDividendDates: [2x2 double]
Examine the StockSpec
structure.
datedisp(StockSpec.ExDividendDates)
01-Mar-2008 01-Jun-2008 NaN NaN
StockSpec.DividendType
ans = 2x1 cell
{'cash' }
{'continuous'}
The StockSpec
structure encapsulates the information of the two stocks and their dividends.
Input Arguments
Sigma
— Annual price volatility of underlying security
decimal
Annual price volatility of underlying security, specified as
a NINST
-by-1
decimal.
Data Types: double
AssetPrice
— Underlying asset price values at time 0
vector
Underlying asset price values at time 0, specified as a NINST
-by-1
vector.
Data Types: double
DividendType
— Stock dividend type
cell array of date character vectors
(Optional) Stock dividend type, specified as a NINST
-by-1
cell
array of character vectors.
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 types of dividends,
shorter rows should be padded with the value NaN
.
Data Types: char
| cell
DividendAmounts
— Dividend amounts
matrix | vector
(Optional) Dividend amounts, specified as a NINST
-by-NDIV
matrix
of cash dividends or NINST
-by-1
vector
representing a constant or continuous annualized dividend yield.
Data Types: double
ExDividendDates
— Ex-dividend dates
matrix | vector
(Optional) Ex-dividend dates, specified as a NINST
-by-NDIV
matrix
of ex-dividend dates for a cash
DividendType
or NINST
-by-1
vector
of ex-dividend dates for constant
DividendType
.
For continuous
DividendType
,
this argument should be ignored.
Data Types: double
| cell
Output Arguments
StockSpec
— Properties of stock structure
structure
Properties of stock structure, returned as a structure encapsulating the properties of a stock.
Version History
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)