Financial Toolbox |
 |
Function Reference
Functions by Category
This chapter contains detailed descriptions of all the functions in the Financial Toolbox. It first groups the functions in task categories and then explains each function in alphabetical order.
Handling and Converting Dates
Note:
The date functions datenum , datestr , datevec , eomday , now , and
weekday now ship with basic MATLAB. They originally shipped only with the
Financial Toolbox. Their descriptions remain in this manual for your
convenience.
|
|
Current Time and Date
|
now
|
Current date and time.
|
today
|
Current date.
|
|
Date and Time Components
|
datefind
|
Indices of date numbers in matrix.
|
datevec
|
Date components.
|
day
|
Day of month.
|
eomdate
|
Last date of month.
|
eomday
|
Last day of month.
|
hour
|
Hour of date or time.
|
lweekdate
|
Date of last occurrence of weekday in month.
|
minute
|
Minute of date or time.
|
month
|
Month of date.
|
months
|
Number of whole months between dates.
|
nweekdate
|
Date of specific occurrence of weekday in month.
|
second
|
Second of date or time.
|
weekday
|
Day of the week.
|
year
|
Year of date.
|
yeardays
|
Number of days in year.
|
|
Date Conversion
|
datedisp
|
Display date entries.
|
datenum
|
Create date number.
|
datestr
|
Create date string.
|
m2xdate
|
MATLAB serial date number to Excel serial date number.
|
x2mdate
|
Excel serial date number to MATLAB serial date number.
|
|
Financial Dates
|
busdate
|
Next or previous business day.
|
datemnth
|
Date of day in future or past month.
|
datewrkdy
|
Date of future or past workday.
|
days360
|
Days between dates based on 360-day year.
|
days365
|
Days between dates based on 365-day year.
|
daysact
|
Actual number of days between dates.
|
daysdif
|
Days between dates for any day-count basis.
|
fbusdate
|
First business date of month.
|
holidays
|
Holidays and non-trading days.
|
isbusday
|
True for dates that are business days.
|
lbusdate
|
Last business date of month.
|
wrkdydif
|
Number of working days between dates.
|
yearfrac
|
Fraction of year between dates.
|
|
|
Coupon Bond Dates
|
accrfrac
|
SIA
|
Fraction of coupon period before settlement.
|
cfamounts
|
SIA
|
Cash flow and time mapping for bond portfolio.
|
cfdates
|
SIA
|
Cash flow dates for a fixed-income security with periodic payments.
|
cfport
|
|
Portfolio form of cash flow amounts.
|
cftimes
|
SIA
|
Time factors corresponding to bond cash flow dates.
|
cpncount
|
SIA
|
Coupon payments remaining until maturity.
|
cpndaten
|
SIA
|
Next coupon date after settlement date.
|
cpndatenq
|
SIA
|
Next quasi coupon date for fixed income security.
|
cpndatep
|
SIA
|
Previous coupon date before settlement date.
|
cpndatepq
|
SIA
|
Previous quasi coupon date for fixed income security.
|
cpndaysn
|
SIA
|
Number of days between settlement date and next coupon date.
|
cpndaysp
|
SIA
|
Number of days between previous coupon date and settlement date.
|
cpnpersz
|
SIA
|
Number of days in coupon period containing settlement date.
|
The Securities Industry Association acronym, SIA, identifies SIA-compliant functions.
|
Formatting Currency
|
Currency Formats
|
cur2frac
|
Decimal currency value to fractional value.
|
cur2str
|
Bank formatted text.
|
frac2cur
|
Fractional currency value to decimal value.
|
Charting Financial Data
The Financial Toolbox provides a set of functions that create several of the most commonly-used types of financial charts. The Financial Time Series Toolbox provides additional charting capabilities. Using time series data as input, the Financial Time Series Toolbox can compute the value of various financial indicators and plot the results. Complete information may be found in the Financial Time Series User's Guide.
|
Financial Charts
|
bolling
|
Bollinger band chart.
|
candle
|
Candlestick chart.
|
dateaxis
|
Convert serial-date axis labels to calendar-date axis labels.
|
highlow
|
High, low, open, close chart.
|
movavg
|
Leading and lagging moving averages chart.
|
pointfig
|
Point and figure chart.
|
Analyzing and Computing Cash Flows
|
Annuities
|
annurate
|
Periodic interest rate of annuity.
|
annuterm
|
Number of periods to obtain value.
|
|
Amortization and Depreciation
|
amortize
|
Amortization.
|
depfixdb
|
Fixed declining-balance depreciation.
|
depgendb
|
General declining-balance depreciation.
|
deprdv
|
Remaining depreciable value.
|
depsoyd
|
Sum of years' digits depreciation.
|
depstln
|
Straight-line depreciation.
|
|
Present Value
|
pvfix
|
Present value with fixed periodic payments.
|
pvvar
|
Present value of varying cash flow.
|
|
Future Value
|
fvdisc
|
Future value of discounted security.
|
fvfix
|
Future value with fixed periodic payments.
|
fvvar
|
Future value of varying cash flow.
|
|
Payment Calculations
|
payadv
|
Periodic payment given number of advance payments.
|
payodd
|
Payment of loan or annuity with odd first period.
|
payper
|
Periodic payment of loan or annuity.
|
payuni
|
Uniform payment equal to varying cash flow.
|
|
Rates of Return
|
effrr
|
Effective rate of return.
|
irr
|
Internal rate of return.
|
mirr
|
Modified internal rate of return.
|
nomrr
|
Nominal rate of return.
|
taxedrr
|
After-tax rate of return.
|
xirr
|
Internal rate of return for nonperiodic cash flow.
|
|
Cash Flow Sensitivities
|
cfconv
|
Cash flow convexity.
|
cfdur
|
Cash flow duration and modified duration.
|
Fixed-Income Securities
|
Accrued Interest
|
acrubond
|
Accrued interest of security with periodic interest payments.
|
acrudisc
|
Accrued interest of discount security paying at maturity.
|
.
|
|
Prices
|
bndprice
|
SIA
|
Price a fixed income security from yield to maturity.
|
prdisc
|
|
Price of discounted security.
|
prmat
|
|
Price with interest at maturity.
|
prtbill
|
|
Price of Treasury bill.
|
|
Term Structure of Interest Rates
|
disc2zero
|
Zero curve given a discount curve.
|
fwd2zero
|
Zero curve given a forward curve.
|
prbyzero
|
Price bonds in a portfolio by a set of zero curves.
|
pyld2zero
|
Zero curve given a par yield curve.
|
tbl2bond
|
Treasury bond parameters given Treasury bill parameters.
|
tr2bonds
|
Term-structure parameters given Treasury bond parameters.
|
zbtprice
|
Zero curve bootstrapping from coupon bond data given price.
|
zbtyield
|
Zero curve bootstrapping from coupon bond data given yield.
|
zero2disc
|
Discount curve given a zero curve.
|
zero2fwd
|
Forward curve given a zero curve.
|
zero2pyld
|
Par yield curve given a zero curve.
|
|
|
Yields
|
beytbill
|
|
Bond equivalent yield for Treasury bill.
|
bndyield
|
SIA
|
Yield to maturity for fixed income security.
|
discrate
|
|
Bank discount rate of a money market security.
|
ylddisc
|
|
Yield of discounted security.
|
yldmat
|
|
Yield of security with interest at maturity.
|
yldtbill
|
|
Yield of Treasury bill.
|
|
|
Interest Rate Sensitivities
|
bndconvp
|
SIA
|
Bond convexity given price.
|
bndconvy
|
SIA
|
Bond convexity given yield.
|
bnddurp
|
SIA
|
Bond duration given price.
|
bnddury
|
SIA
|
Bond duration given yield.
|
Analyzing Portfolios
|
Portfolio Analysis
|
corr2cov
|
Convert standard deviation and correlation to covariance.
|
cov2corr
|
Convert covariance to standard deviation and correlation coefficient.
|
ewstats
|
Expected return and covariance from return time series.
|
frontcon
|
Mean-variance efficient frontier.
|
pcalims
|
Linear inequalities for individual asset allocation.
|
pcgcomp
|
Linear inequalities for asset group comparison constraints.
|
pcglims
|
Linear inequalities for asset group minimum and maximum allocation.
|
pcpval
|
Linear inequalities for fixing total portfolio value.
|
portalloc
|
Optimal capital allocation.
|
portcons
|
Portfolio constraints.
|
portopt
|
Portfolios on constrained efficient frontier.
|
portrand
|
Randomized portfolio risks, returns, and weights.
|
portstats
|
Portfolio expected return and risk.
|
portsim
|
Random simulation of correlated asset returns.
|
portvrisk
|
Portfolio value at risk
|
ret2tick
|
Price tick series from incremental returns and initial price.
|
tick2ret
|
Incremental return series from a tick price series.
|
Pricing and Analyzing Derivatives
|
Option Valuation and Sensitivity
|
bdtbond
|
Black-Derman-Toy pricing of option-embedded bonds.
|
bdttrans
|
Translate a tree returned by bdtbond .
|
binprice
|
Binomial put and call pricing.
|
blkprice
|
Black's option pricing.
|
blsdelta
|
Black-Scholes sensitivity to underlying price change.
|
blsgamma
|
Black-Scholes sensitivity to underlying delta change.
|
blsimpv
|
Black-Scholes implied volatility.
|
blslambda
|
Black-Scholes elasticity.
|
blsprice
|
Black-Scholes put and call pricing.
|
blsrho
|
Black-Scholes sensitivity to interest rate change.
|
blstheta
|
Black-Scholes sensitivity to time-until-maturity change.
|
blsvega
|
Black-Scholes sensitivity to underlying price volatility.
|
opprofit
|
Option profit.
|
GARCH Processes
The Financial Toolbox provides these representative functions to help you familiarize yourself with Generalized Autoregressive Conditional Heteroskedasticity (GARCH) in the MATLAB context. The GARCH Toolbox provides a more comprehensive and integrated computing environment that includes maximum likelihood parameter estimation, volatility forecasting, Monte Carlo simulation, diagnostic and hypothesis testing, graphical analysis, and data manipulation. For information see the GARCH Toolbox User's Guide or the financial products Web page at http://www.mathworks.com/products/finprod/.
|
Univariate GARCH Processes
|
ugarch
|
GARCH parameter estimation.
|
ugarchllf
|
Log-likelihood objective function.
|
ugarchpred
|
Forecast conditional variance.
|
ugarchsim
|
Simulate GARCH process.
|
Obsolete Bond Price and Yield Functions
The functions listed in this table are obsolete, and their descriptions have been removed from the documentation. They have been replaced with the SIA-compliant functions bndprice
and bndyield
. For compatibility purposes, the obsolete functions remain in the product. Type help function_name
at the MATLAB command line for a description.
|
Obsolete Functions
|
prbond
|
Price of security with regular periodic interest payments.
|
proddf
|
Price with odd first period.
|
proddfl
|
Price with odd first and last periods and settlement in first period.
|
proddl
|
Price with odd last period.
|
yldbond
|
Yield to maturity of bond.
|
yldoddf
|
Yield of security with odd first period.
|
yldoddfl
|
Yield of security with odd first and last periods and settlement in first period.
|
yldoddl
|
Yield of security with odd last period.
|
| Reference | | Alphabetical List of Functions |  |