Sys-Computation Finance
Implementing a dynamic delta hedging strategy.
Delta-hedging is a hedging strategy that aims to replicate the value of a financial derivative, such as a Call
option, written on a traded asset through dynamically buying (or selling) a proper number of shares of the
underlying asset and borrowing from (or lending to) a bank.
Description of the delta-hedging process:
1. Let the hedging period be from a start-date t0 to an end-date tN . At start date t0, assuming there is
an initial cash position in the amount of $0.
2. At t0, we sell a European call option contract with expiration date T, strike price K. Assume the
option contract is written on one share of stock and t0 < tN ≤ T.
3. To hedge the short position in the European call, we decide to buy δ shares of the underlying stock
at t0, where δ =
∂V
∂S is the rate of change of option value V with respect to changes in the underlying
price S.
4. As δ changes during the hedging period, we need to re-balance our portfolio (buy/sell stocks) everyday
to maintain a long position of δi shares of stock for each date ti
, i = 1, 2, ..., N. δi shall be calculated
using implied volatility for each date.
5. For each date ti
, i = 1, 2, ..., N, calculate the cumulative hedging error till ti
:
HEi = δi−1Si + Bi−1e
ri−1∆t − Vi
where Bi = δi−1Si + Bi−1e
ri−1δt − δiSi (i ≥ 1) and B0 = V0 − δ0S0. Si
, Vi
, ri respectively denote the
stock price, option price, risk-free rate at time ti
, i = 0, 1, ..., N. ∆t represents 1 business day, which is
1
252 year.
6. For each date ti
, two types of profit-and-loss (PNL) of selling a Call option at time 0 are defined as
follows. Assume no transaction costs.
• PNL = Call option market quote at time 0 – Call option market quote at time ti
.
• PNL with hedge = Cumulative hedging error.
Project tasks are:
1. Test your delta hedging implementation using the Black-Scholes model.
• Use the following model to simulate the price series {S0, S∆t, S2∆t, · · · , ST } at N equally-spaced
time points over time horizon [0, T] where ∆t =
T
N
:
St+∆t = St + µSt∆t + σSt
√
∆tZt,
where {Zt : t = 1, 2, · · · , N} are independent standard Normal random variables. Generate 1000
sample paths with the following set of parameters: S0 = 100, T = 0.4, µ = 0.05, σ = 0.24,
r = 0.025, N = 100. Plot any 100 of these paths.
• Apply Black-Scholes formula to obtain the option price series {C0, C∆t, C2∆t, · · · , CT } on each
stock price sample path.
• Assume S0 = 100, T = 0.4, µ = 0.05, σ = 0.24, r = 0.025, N = 100. Consider a European Call
option on ST with K = 105 and T = 0.4. Construct the delta-hedging portfolios for all N periods
using delta obtained from the B-S model. Repeat this for all 1000 sample paths and report/plot
the distribution of the hedging errors.
2. Use the real market data given in the project data files to test the validity of Black-Scholes model by
using the Black-Scholes formula to construct the delta-hedging portfolio.
(a) At each time ti
, calculate the total wealth if we sell a call without putting on any hedge.
(b) Given t0, tN , T and K, the program should output a file “result.csv” containing stock price,
option price, implied volatility, delta, hedging error, PNL, PNL with hedge.
For example, if t0=2011-07-05, tN =2011-07-29, T=2011-09-17, K = 500, the output should be
like:
date S V ... PNL PNL (with hedge)
2011-07-05 532.44 44.2
2011-07-06 535.36 46.9
...
2011-07-28 610.94
2011-07-29 603.69
(c) The following data files are provided. Data files should not be modified manually or by other
tools.
• “interest.csv” contains daily risk-free rates in 2011. When calculating implied volatility and
delta for each date, use the risk-free rate of corresponding date.
• “sec GOOG.csv” contains adjusted closing stock prices in 2011. Assume there is no dividend.
• “op GOOG.csv” contains option prices data in 2011. Option price=(best bid+best offer)/2.
cp flag is C for call option, P for put option. exdate is expiration date. For option at date
ti
, time to expiry = (number of business days between ti and T)/252.
Note: Feel free to modify the sample codes in the lab session to make it work. It is encouraged
to design your own Option classes and you are required to use OOP or generic
programming style to finish this project. Using only functions or trivial classes without any
member variables are not acceptable.
Project deliverables:
1. Ready-to-compile codes in one zip file
2. A project report which contains the following components:
• Problem addressed by the project and the model(s) used in the project
• The structure of the model implementation: functionality of each code block or each code piece.
• Unittest cases for the code
• Outcome of the implementation, present discussion on whether the outcome solves the practical
problem of hedging call/put options, and draw some conclusions.