Overview of the Finance Package
Calling Sequence
Description
Finance:-command(arguments)
command(arguments)
The Financial Modeling package is a collection of tools for mathematical finance. This package builds on the functionality available in other packages such as LinearAlgebra, Statistics, Optimization, and CurveFitting. The package supports a wide range of common tasks such as date arithmetic, cash flow analysis, option pricing, term structure analysis, and simulation.
Cash Flow Analysis
The Financial Modeling package provides a number of tools for constructing cash flows and for performing basic sensitivity analysis.
AccruedAmount
-
calculate the accrued amount of a bond
BasisPointSensitivity
calculate the basis point sensitivity of future cash flows
CashFlows
return the set of cash flows for a bond or a swap
CleanPrice
calculate the clean price of a bond
Convexity
calculate the convexity of a bond or a set of cash flows
DirtyPrice
calculate the dirty price of a bond
Duration
calculate the duration of a bond or a set of cash flows
FixedRateCoupon
construct a fixed-rate coupon on a term structure
InArrearIndexedCoupon
construct an in-arrear indexed coupon
InternalRateOfReturn
calculate the internal rate of return of a set of cash flows or a bond
NetPresentValue
return the net present value of future cash flows
ParCoupon
construct a coupon at par on a term structure
SimpleCashFlow
construct a simple cash flow at a given date
UpFrontIndexedCoupon
construct an up-front indexed coupon on a term structure
More information and detailed examples can be found in Finance/Overview/CashFlowAnalysis.
Date Arithmetic
The Financial Modeling package provides various commands for performing date arithmetic. In particular, it supports over 20 different calendars and 15 day count conventions. In addition, the package provides tools for modifying existing calendars and creating non-standard calendars.
AddHoliday
add a holiday to the given calendar
AdjustDate
adjust a non-business day according to the given convention
AdvanceDate
advance a non-business day according to the given convention
Calendar
create a new calendar
DayCount
return the number of days between two dates according to a given convention
DayCounter
advance to the nth given day of the given month
DayOfWeek
return the day of the week on which the given date falls
EvaluationDate
return the global evaluation date
FormatDate
return a string containing formatted date
IsBusinessDay
check if a given date is a business day according to a given calendar
IsEndOfMonth
check if a given date corresponds to the end of a month according to a given calendar
IsHoliday
check if a given date is a holiday according to a given calendar
JoinBusinessDays
construct new calendar by joining business days from the given two calendars
JoinHolidays
construct new calendar by joining holidays from the given two calendars
NextWeekday
advance the given date to the next given day of the week
NthWeekday
ParseDate
parse a string containing date information
RemoveHoliday
remove a holiday from the given calendar
SetEvaluationDate
set the global evaluation date
Settings
return default settings
TimeGrid
return an object for time discretization
TodaysDate
return today's date according to the system clock
YearFraction
return the interval between two dates as a fraction of a year according to a given convention
More information and detailed examples can be found in Finance/Overview/Calendars and Finance/Overview/DayCounters.
Financial Instruments
The Financial Modeling package provides tools for constructing various financial instruments such as European-style and American-style options with any payoff function, bonds, as well as some interest rate instruments. In addition to this, the package provides tools for valuing these instruments and computing their market sensitivities (the Greeks). The following instruments are supported.
AmericanOption
construct an American-style option with the specified payoff function
AmericanSwaption
construct an American-style swaption
BermudanOption
construct a Bermudan-style option with the specified payoff function
BermudanSwaption
construct a Bermudan-style swaption
Cap
create new interest rate cap
Collar
create new interest rate collar
EuropeanOption
construct a European-style option with the specified payoff function
EuropeanSwaption
construct a European-style swaption
FixedCouponBond
create new fixed-coupon bond
FloatingRateBond
create new floating-rate bond
Floor
create new interest rate floor
InterestRateSwap
create new interest rate swap
Swap
create new cash-flow swap
ZeroCouponBond
create new zero-coupon bond
The following tools are available for working with the above instruments.
BlackPrice
calculate the price of an interest rate instrument using the Black model
BlackScholesCharm
calculate the Charm of a European-style option in the Black-Scholes model
BlackScholesColor
calculate the Color of a European-style option in the Black-Scholes model
BlackScholesDelta
calculate the Delta of a European-style option in the Black-Scholes model
BlackScholesGamma
calculate the Gamma of a European-style option in the Black-Scholes model
BlackScholesLambda
calculate the Lambda of a European-style option in the Black-Scholes model
BlackScholesPrice
calculate the price of a European-style option using the Black-Scholes model
BlackScholesRho
calculate the Rho of a European-style option in the Black-Scholes model
BlackScholesSpeed
calculate the Speed of a European-style option in the Black-Scholes model
BlackScholesTheta
calculate the Theta of a European-style option in the Black-Scholes model
BlackScholesUltima
calculate the Ultima of a European-style option in the Black-Scholes model
BlackScholesVanna
calculate the Vanna of a European-style option in the Black-Scholes model
BlackScholesVega
calculate the Vega of a European-style option in the Black-Scholes model
BlackScholesVera
calculate the Vera of a European-style option in the Black-Scholes model
BlackScholesVeta
calculate the Veta of a European-style option in the Black-Scholes model
BlackScholesVomma
calculate the Vomma of a European-style option in the Black-Scholes model
BlackScholesZomma
calculate the Zomma of a European-style option in the Black-Scholes model
BondOptionPrice
calculate the price of a discount bond option in the given affine short-rate model
calculate the convexity of a bond
DiscountBondPrice
calculate a discount bond price
calculate the duration of a bond
ImpliedVolatility
calculate the implied volatility of a European-style option in the Black-Scholes model
ImpliedVolatilitySurface
construct a volatility term structure
LatticePrice
calculate the price of a financial instrument using a binomial or a trinomial tree
LocalVolatility
calculate the local volatility of a European-style option
LocalVolatilitySurface
create new local volatility term structure
Schedule
define a new payment schedule
YieldFromCleanPrice
calculate the yield of a bond using its clean price
YieldFromDirtyPrice
calculate the yield of a bond using its dirty price
More information and detailed examples can be found in Finance/Examples/EuropeanOptions, and Finance/Examples/AsianOptions.
Interest Rates
The Finance package also provides tools for creating and manipulating term structures of interest rates as well as volatility term structures. Here is the list of relevant commands:
BenchmarkRate
calculate benchmark rate based on a specified calendar
CompoundFactor
return a compound factor for the specified date or time
DiscountCurve
construct a yield curve based on known discount rates
DiscountFactor
return a discount factor for the specified date or time
EquivalentRate
calculate equivalent interest rate
FairRate
return the fair rate of an interest rate swap
FairSpread
return the fair spread of an interest rate swap
ForwardRate
compute forward rates based on a given term structure
ForwardCurve
construct a yield curve based on known forward rates
ImpliedRate
calculate interest rate implied by a given compound factor
LoadHistory
load historic date for a given benchmark rate
ParRate
compute par rates based on a given term structure
ZeroCurve
construct a yield curve based on known zero rates
ZeroRate
compute zero rates based on a given term structure
More information and detailed examples can be found in Finance/Overview/TermStructures.
Lattice Methods
The Financial Modeling package also provides tools for constructing binomial and trinomial trees.
BinomialTree
construct a recombining binomial tree data structure
BlackScholesBinomialTree
create a recombining binomial tree for a Black-Scholes process
BlackScholesTrinomialTree
create a recombining trinomial tree for a Black-Scholes process
ImpliedBinomialTree
construct an implied Black-Scholes binomial tree
ImpliedTrinomialTree
construct an implied Black-Scholes trinomial tree
ShortRateTree
construct a trinomial tree for a short-rate process
TreePlot
plot a binomial or trinomial tree
TrinomialTree
construct a mutable recombining tree data structure
The following commands can be used to inspect/manipulate a tree data structure.
GetDescendants
return descendants for a node of a binomial or trinomial tree
GetLocalVolatility
return the local volatility node of a Black-Scholes binomial or trinomial tree
GetProbabilities
return probabilities for a node of a binomial or trinomial tree
GetSize
get the size of a binomial/trinomial tree at the given level
GetUnderlying
return the value of the underlying for a node of a binomial or trinomial tree
SetProbabilities
set probabilities for a node of a binomial or trinomial tree
SetUnderlying
set the value of the underlying for a node of a binomial or trinomial tree
More information and detailed examples can be found in Finance/Overview/LatticeMethods.
Personal Finance
amortization
-amortization table for a loan
annuity
-present value of an annuity
blackscholes
-present value of a call option
cashflows
-present value of a list of cash flows
effectiverate
-convert a stated rate to the effective rate
futurevalue
-future value of an amount
growingannuity
-present value of a growing annuity
growingperpetuity
-present value of a growing perpetuity
levelcoupon
-present value of a level coupon bond
perpetuity
-present value of a perpetuity
presentvalue
-present value of an amount
yieldtomaturity
-yield to maturity of a level coupon bond
More information and detailed examples can be found in the Personal Finance example worksheet.
Short Rate Models
The Financial Modeling package provides the following short rate models.
CoxIngersollRossModel
Cox-Ingersoll-Ross interest rate model
HullWhiteModel
Hull-White interest rate model
VasicekModel
Vasicek interest rate model
Stochastic Processes
The Financial Modeling package supports a wide range of stochastic processes used in Financial Engineering. This includes processes for modeling equity prices, mean-reverting processes, pure jump processes, jump diffusions as well as multivariate Ito processes. In addition, the package provides tools for building more complicated processes from simple ones. Below is the list of supported processes:
BlackScholesProcess
Black-Scholes process
BrownianMotion
uni- or multi-variate Brownian motion
CEVProcess
constant elasticity of variance (CEV) process
DeterministicProcess
deterministic time-dependent process
DynamicPortfolio
a portfolio of stochastic processes which can be dynamically rebalanced
MarkovChain
a finite state Markov chain
GammaProcess
gamma process
GaussMarkovProcess
Gaussian process for modeling short-term interest rate
GeometricBrownianMotion
geometric Brownian motion
HestonProcess
stochastic volatility process introduced by Heston
ItoDiffusion
general uni- or multi-variate Ito process defined by drift and diffusion
ItoProcess
Ito process
MertonJumpDiffusion
jump-diffusion process introduced by Merton
RegimeSwitchingProcess
stochastic process with multiple regimes
OrnsteinUhlenbeckProcess
Ornstein-Uhlenbeck process
PoissonProcess
Poisson process including the doubly-stochastic Poisson (Cox) process
ShortRateProcess
process that governs a short rate
SquareRootDiffusion
square-root diffusion
SVJJProcess
stochastic volatility with jumps (SVJJ) process
WienerProcess
uni- and multi-variate Wiener process including subordinated Wiener process
Here are some related commands.
Diffusion
compute the diffusion component of an Ito process
Drift
compute the drift component of an Ito process
ExpectedShortfall
calculate the expected shortfall
ExpectedValue
compute a Monte Carlo estimate of the specified expression
PathGenerator
create new path generator for the specified stochastic process
PathPlot
plot sample path(s) of the specified stochastic process
SamplePath
generate a sample path for the specified stochastic process
SampleValues
generate sample values for the specified stochastic process
ValueAtRisk
estimate value-at-risk for the specified expression
More information and detailed examples can be found in Finance/Overview/StochasticProcesses.
See Also
Finance/Examples/LocalVolatility
Finance Math Apps
Download Help Document