Spreadsheet Option Functions Available With Derivatives Markets
Spreadsheet Option Functions Available With Derivatives Markets
Contents
1 Introduction 2
1.1 Spreadsheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Using the Add-ins . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 A Note on Array Functions . . . . . . . . . . . . . . . . . . . . . 3
2 Black-Scholes Functions 3
2.1 Prices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Greeks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Black-Scholes Array Functions . . . . . . . . . . . . . . . . . . . 5
2.4 Black Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.5 Perpetual American Options . . . . . . . . . . . . . . . . . . . . 5
2.6 CEV Pricing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.7 Merton Jump Formula . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Binomial Functions 6
4 Exotic Options 7
4.1 “Vanilla” Barrier Options . . . . . . . . . . . . . . . . . . . . . . 7
4.2 Other Barrier Options . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2.1 Cash-or-Nothing . . . . . . . . . . . . . . . . . . . . . . . 9
4.2.2 Asset-or-Nothing . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Asian Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4 Compound Options . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.5 Exchange and Rainbow Options . . . . . . . . . . . . . . . . . . . 12
1
1 Introduction
This is documentation for the option-pricing functions available in the spread-
sheets accompanying the second edition of Derivatives Markets. All are user-
defined functions in Excel, written in VBA, with the code accessible and modi-
fiable via the Visual Basic editor built into Excel.
1.1 Spreadsheets
The following spreadsheets come with the book:
OptAll2.xls This provides examples of most (not all) of the pricing functions
described here. The
Data.xls This spreadsheet provides stock price and option price data for some
of the end-of-chapter problems.
You can place the add-in elsewhere, but you will then have to browse for it to
use it.
To install the add-in, select Tools|Add-ins and check the box for “OptAll2.xla”.
If the add-in you want does not appear in the list, you need to select “browse”
and locate it yourself. Once you install the add-in, you will have access to all
2
of the functions in this spreadsheet, without needing to open the spreadsheet
explicitly.
You can create your own add-in easily from any spreadsheet by selecting
File|Save As and then specifying “Excel add-in (*.xla)”.
Please note that when you use add-in functions in a spreadsheet, the func-
tions are not saved with your spreadsheet and do not move from computer to
computer with the spreadsheet. If you want to have a “portable” spreadsheet
you should start with one of the option pricing spreadsheets, modify it as you
please, and then save it under a different name.
Once you have completed these steps, you will notice that cells in the array
range exhibit the formula you entered surrounded by curly braces. Once an
array function is entered in a range, that range can only be edited or deleted as
a single entity. Excel will prohibit you from editing one cell of an array.
2 Black-Scholes Functions
The following symbol definitions are used in this section: “s” = stock price, “k”
= strike price, “v” = volatility (annualized), “r” = interest rate (continuously-
compounded, annualized), “t” = time to expiration (years), and “d” = dividend
yield (continuously-compounded, annualized).
2.1 Prices
Function Definition Function Description
BSCall(s, k, v, r, t, d) European call option price
3
2.2 Greeks
BSCallDelta(s, k, v, r, t, d) European call delta
4
2.3 Black-Scholes Array Functions
The functions in this section are all array functions (up to 16 × 16) and have an
extra string, “x ” as a parameter. This parameter controls the output, with a
“c” denoting “call” and “p” denoting “put”, and “d”, “g”, “r”, “v”, “t”, and “e”
denoting delta, gamma, rho, vega, theta, and elasticity. A“+” means continue
placing the output in the same row and a “/” means move to the next row.
For example, the string “cp+cd+cg/pp+pd+pg” will output a 2 row, 3 column
array containing a call price, delta, and gamma in the first row, with the same
information for a put in the second row.
BS(s,k,v,r,t,d,x) Black-Scholes prices and Greeks
5
2.6 CEV Pricing
The CEV model for the stock price specifies the instantaneous standard devia-
tion of the stock return as
Thus, the CEV pricing formula has two parameters in place of volatility: β and
σ̄. Setting these parameters appropriately requires care. If you observe a stock
to have a 30% volatility, then given a β, you would set σ̄ such that
σ̄ = 0.30 × S (2−β)/2
When β = 2, the CEV pricing model is the same as the Black-Scholes formula.
The CEV pricing functions are
CEVCall(s,k,σ̄,r,t,d,β) CEV call price
CEVPut(s,k,σ̄,r,t,d,β) CEV put price
3 Binomial Functions
The following symbol definitions are used in this section: “s” = stock price, “k”
= strike price, “v” = volatility (annualized), “r” = interest rate (continuously-
compounded, annualized), “t” = time to expiration (years), “d” = dividend
yield (continuously-compounded, annualized), “N” = number of binomial steps,
“opstyle” = option style (0 = European, 1 = American), and “vest” = the period
of time during which the option cannot be exercised (after this time, exercise is
permitted). If “N”, the number of binomial steps, is set less than or equal to 0,
then N is internally reset to be 100.
By default, all binomial calculations are done using the forward tree used
in Chapter 10. There is a constant in the VBA code called “TreeType”. If set
equal to 0 (the default), all calculations are done with a forward tree. If equal to
1, a CRR tree is used, and if equal to 2, a lognormal tree is used (see CSection
11.3).
6
The functions in this section are all array functions, returning the option
price, along with delta, gamma, and theta, in that order.
So, for example, if you just enter the BinomCall function in a single cell, it
will return the option price. If you enter it as an array function spanning two
cells, you will get the price and delta, etc... The array can be entered either
horizontally or vertically.
BinomCall(s, k, v, r, t, d, Binomial call
opstyle, N)
BinomPut(s, k, v, r, t, d, opstyle, Binomial put
N)
BinomCallBermudan(s, k, v, r, t, d, Binomial Bermudan call
opstyle, N, vest)
BinomPutBermudan(s, k, v, r, t, d, Binomial Bermudan put
opstyle, N, vest)
BinomOptFixedDivCall(s, k, v, r, t, Binomial call price when under-
div amt, div h, div next, opstyle, lying asset pays dollar dividends
N) in amount div amt, with the first
payment coming at time div next,
with dividends spaced div h apart.
The function
BinomOptFixedDivPut(s, k, v, r, t, Binomial put price when under-
div amt, div h, div next, opstyle, lying asset pays dollar dividends
N) in amount div amt, with the first
payment coming at time div next,
with dividends spaced div h apart.
4 Exotic Options
The following symbol definitions are used in this section: “s” = stock price, “k”
= strike price, “v” = volatility (annualized), “r” = interest rate (continuously-
compounded, annualized), “t” = time to expiration (years), “d” = dividend
yield (continuously-compounded, annualized), “rho” = correlation coefficient,
and “H” = barrier.
7
CallUpIn(s, k, v, r, t, d, h) Up-and-in call
Call in order for the payoff to be received, the asset price must be above
the strike at expiration
Put in order for the payoff to be received, the asset price must be below
the strike at expiration
8
For example, an option that pays $1 if the stock price exceeds the strike price
at expiration, provided that the barrier, below the inital stock price, has not
been hit would have the name
CashDOCall = |Cash
{z } + DO
|{z} + Call
|{z}
Payoff of $1 if the barrier, below and the stock price
the intial stock price, exceeds the strike
has not been hit at expiration
4.2.1 Cash-or-Nothing
9
CashUIPut(s, k, v, r, t, d, h) Cash-or-nothing up-and-in put
Receive $1 if st < k at expiration
and the barrier H > s has been
hit.
DR(s, v, r, t, d, h) Down rebate Receive $1 at the
time the barrier, H < s, is hit.
UR(s, v, r, t, d, h) Up rebate Receive $1 at the time
the barrier, H > s, is hit.
DRDeferred(s, v, r, t, d, h) Deferred down rebate Receive $1
at expiration if prior to expiration
the barrier, H < s, is hit.
URDeferred(s, v, r, t, d, h) Deferred up rebate Receive $1 at
expiration if prior to expiration
the barrier, H < s, is hit.
4.2.2 Asset-or-Nothing
Note that there is no difference between an option that pays H if the share price
hits H, and an option that pays a share if the share price hits H.
AssetCall(s, k, v, r, t, d) Asset-or-nothing call Receive one
unit of the asset if st > k at expi-
ration
AssetPut(s, k, v, r, t, d) Asset-or-nothing put Receive one
unit of the asset if st < k at expi-
ration
AssetDICall(s, k, v, r, t, d, h) Asset-or-nothing down-and-in call
Receive one unit of the asset if
st > k at expiration and the bar-
rier H < s has been hit.
AssetDOCall(s, k, v, r, t, d, h) Asset-or-nothing down-and-out
call Receive one unit of the asset
if st > k at expiration and the
barrier H < s has not been hit.
AssetDOPut(s, k, v, r, t, d, h) Asset-or-nothing down-and-out
put Receive one unit of the asset
if st < k at expiration and the
barrier H < s has not been hit.
AssetDIPut(s, k, v, r, t, d, h) Asset-or-nothing down-and-out
put Receive one unit of the asset
if st < k at expiration and the
barrier H < s has been hit.
10
AssetUICall(s, k, v, r, t, d, h) Asset-or-nothing up-and-in call
Receive one unit of the asset if
st > k at expiration and the bar-
rier H > s has been hit.
AssetUOCall(s, k, v, r, t, d, h) Asset-or-nothing up-and-out call
Receive one unit of the asset if
st > k at expiration and the bar-
rier H > s has not been hit.
AssetUOPut(s, k, v, r, t, d, h) Asset-or-nothing up-and-out put
Receive one unit of the asset if
st < k at expiration and the bar-
rier H > s has not been hit.
AssetUIPut(s, k, v, r, t, d, h) Asset-or-nothing up-and-in put
Receive one unit of the asset if
st < k at expiration and the bar-
rier H > s has been hit.
11
date at which the bought or sold option expires. The strike price for buying or
selling the underlying option at date t1 is denoted “x”.
CallOnCall(s, k, x, v, r, t1, t2, Compound call on call Call option
d) to buy a call option
PutOnCall(s, k, x, v, r, t1, t2, d) Compound put on call Put option
to sell a call option
CallOnPut(s, k, x, v, r, t1, t2, d) Compound call on put Call option
to buy a put option
PutOnPut(s, k, x, v, r, t1, t2, d) Compound put on put Put option
to sell a put option
where η = 0 for the Vasicek formula and η = 0.5 for the CIR formula. The
interest rate risk premium is φ.
12
Vasicek(a, b, φ, v, r, T) Vasicek interest rate function Ar-
ray function which returns the
price of a zero-coupon bond pay-
ing $1, the long-term yield, delta
and gamma with respect to the in-
terest rate, and the yield to matu-
rity.
CIR(a, b, φ, v, r, T) Cox-Ingersoll-Ross interest rate
function Array function which re-
turns the price of a zero-coupon
bond paying $1, the long-term
yield, delta and gamma with re-
spect to the interest rate, and the
yield to maturity.
13