financial

Monte Carlo simulation, options pricing routines, financial manipulation, plotting functions and additional date manipulation tools.

Select category:

Financial

cfconv
Calculate convexity CFCONV from given fixed-paid cash flow CF and period yield YIELD.
cfdur
Calculate duration DUR and modified duration MOD_DUR, from given fixed-paid cash flow CF and period yield YIELD.
corr2cov
Convert standard deviation SIGMA and correlation coefficients CORR to covariance COV.
cov2corr
Convert covariance COV from input to standard deviation SIGMA and correlation coefficients CORR.
effrr
Compute the effective rate of return based on a nominal RATE over a number of periods, NUMPERIODS.
fvl
Return the future value at the end of N periods of an initial lump sum investment L, given a per-period interest rate R.
fv
Return the future value at the end of period N of an investment which consists of N payments of P in each period, assuming an interest rate R.
hhigh
Compute the highest high value of DATA for the past NPERIODS (default: 14) across the dimension, DIM (default: 1).
irr
Return the internal rate of return of a series of payments P from an initial investment I (i.e., the solution of 'npv (r, p) = i'.
llow
Compute the lowest low value of DATA for the past NPERIODS (default: 14) across the dimension, DIM (default: 1).
macd
Calculate the Moving Average Convergence/Divergence (MACD) line of an asset from the vector of prices (DATA).
mirr
Compute the modified internal rate of return.
movavg
Calculate the LEADing and LAGging moving average of an ASSET.
negvolidx
Compute the negative volume index of a security based on its closing price (CLOSEPRICE) and VOLume.
nomrr
Compute the nominal rate of return based on a effective RATE over a number of periods, NUMPERIODS.
nper
Return the number of regular payments of P necessary to amortize A loan of amount A and interest R.
npv
Net present value of a series of payments.
onbalvol
Compute the on balance volume of a security based on its closing price (CLOSEPRICE) and VOLume.
pmt
Return the amount of periodic payment necessary to amortize a loan of amount a with interest rate R in N periods.
posvolidx
Compute the positive volume index of a security based on its closing price (CLOSEPRICE) and VOLume.
pvl
Return the present value V of an investment that will pay off P in one lump sum at the end of N periods, given the interest rate R.
pv
Returns the present value of an investment that will pay off P for N consecutive periods, assuming an interest R.
rate
Return the rate of return R on an investment of present value V which pays P in N consecutive periods.
rsindex
Compute the relative strength index (RSI) of an asset from the vector of closing prices (CLOSEPRICE).
taxedrr
Compute the taxed rate of RETURN based on a PRETAXRETURN rate and a TAXRATE.
vol
Return the volatility VOLAT of each column of the input matrix X.

Chart Financial Data

bolling
If no output is requested, plot the bollinger bands of the ASSET.
candle
Plot the HIGHPRICES, LOWPRICES, CLOSEPRICES and OPENPRICES of a security as a candlestick chart.
dateaxis
Convert the current axis tick labels (or the axis handle H) to a date format.
highlow
Plot the HIGH, LOW, and CLOSE of a security.
pointfig
Plot the point figure chart of an ASSET.
renko
Plots price changes using a Renko chart.

Price and Analyze Financial Instruments

binprice
Compute American call and put option prices using a binomial tree.
blkimpv
Compute implied volatility under the Black-Scholes model.
blkprice
Compute European call and put option price using the Black-76 model.
blsdelta
Computes the Black-Scholes delta, the rate of change of the option value with respect to the value of the underlying asset.
blsgamma
Compute Black-Scholes gamma.
blsimpv
Computes implied volatility under the Black-Scholes model.
blslambda
Computes elasticity of option under the Black-Scholes model.
blsprice
Compute European call and put option prices.
blsrho
Compute the Black-Scholes rho.
blstheta
Compute the Black-Scholes theta.
blsvega
Computes the Black-Scholes vega.
opprofit
Compute profit of an option.

Stochastic Differential Equation (SDE) Models

@diffusion/diffusion
Creates an object to represent the diffusion rate of a stochastic differential equation (SDE).
@drift/drift
Creates an object to represent the drift rate of a stochastic differential equation (SDE).
@sde/sde
Creates an object to represent a stochastic differential equation (SDE).
@sde/simByEuler
Simulates a stochastic differential equation (SDE) using Euler timestepping.
@sde/simulate
Simulates a stochastic differential equation (SDE).
sdeddo
Creates an object to represent a stochastic differential equation (SDE) using drift and diffusion objects.
sdeld
Creates an object to represent a stochastic differential equation (SDE) in linear drift-rate form.
sdemrd
Creates an object to represent a stochastic differential equation (SDE) in in mean-reverting drift-rate form.
bm
Creates an object to represent an arithmetic Brownian motion.
cev
Creates an object to represent a constant elasticity of variance (CEV) stochastic differential equation (SDE).
cir
Creates an object to represent a Cox-Ingersoll-Ross (CIR) mean-reverting square root diffusion.
gbm
Creates an object to represent a geometric Brownian motion (GBM).
heston
Creates an object to represent a Heston stochastic volatility model.
hwv
Creates an object to represent a Hull-White/Vasicek (HWV) diffusion.

Time

busdate
Return the datenum of the next or previous business day from REFDATE.
busdays
Generate a list of business dates at the end of the periods defined between (including) SDATE and EDATE.
datefind
Find any instances of the 'subset' in the 'superset' with the 'tol'erance.
day
Return hours of a date.
daysact
Calculates the number of days between two dates.
easter
Return the month (M) and day (D) of Easter in the Gregorial calendar on a given year or years.
eomdate
Return the last day of the month M for the year Y in datenum format.
fbusdate
Return the datenum of the first business day of the YEAR and MONTH.
holidays
List holidays and non-trading days.
hour
Return hours of a date.
isbusday
Return true if the REFDATE is a business date REFDATE.
lbusdate
Return the datenum of the last business day of the YEAR and MONTH.
lweekdate
Returns the last occurrence of WEEKDAY from the MONTH and YEAR.
m2xdate
Convert DATENUMS from the internal date format to the format used by Microsoft Excel.
minute
Return minutes of a date.
month
Return month of a date.
months
Return the number of whole months between STARTDATE and ENDDATE.
nweekdate
Returns the Nth occurrence of WEEKDAY from the MONTH and YEAR.
second
Return seconds of a date.
thirdwednesday
Find the third Wednesday of the month specified by the MONTH and YEAR.
today
Returns the current local date as the number of days since Jan 1, 0000.
weeknum
Return the week number of the year of a date
x2mdate
Convert DATENUMS from the Microsoft Excel date format to the format used by 'datenum'.
yeardays
Return the number of days in the year Y with an optional basis B.
year
Return year of a date.

Package: financial