CS 476/676 Assignment 3
Winter 2022
Office: DC3623
MW 4-5:20pm
Copyright By PowCoder代写 加微信 powcoder
OH: Tues 3-4pm
OH: Mar 4 11:30 am -12:30 pm OH: Mar 11 12 – 1pm
My Web Site: http://cs.www.uwaterloo.ca/yuying
Due: 4pm Mar 17, 2022
Programming Questions
IMPORTANT: In this and in future assignments, most of the marks for programming questions are allocated for explanations of algorithms (e.g. pseudo-code) and discussion of results. If all you hand in is the listing of the “Raw Code” or “Raw Output” by itself, you will get poor marks. All coding should be done in Matlab. All the plots should be appropriately labeled. You should submit all Matlab code used in your assignment. Be sure to document (i.e. add liberal comments) your code. The TA will take off marks for poor documentation.
1 [(10 marks) ] (Numerical Scheme for SDE)
Assume that the interest rate rt is modeled by the mean-reverting process below
drt = a(b − rt)dt + σ√rtdZt
where Zt is a stabdard Brownian motion, and a, b, σ are positive constants.
Let the time step ∆t be given. Assume that the interest rate rn at time tn = n∆t is given.
(a) Given rn at tn, write down the Euler-Maruyama formula for computing the interest rate rn+1 at tn+1. Assuming rn = b, write down the condition on the standard normal sample which leads to rn+1 < 0. Explain.
(b) Given rn at tn, write down the Milstein method for computing rn+1. Assumming rn = 0, provide an inequality using parameters a, b, σ, which guarantees that rn+1 is always positive.
2 [ (8 marks) ] (Numerical Scheme for SDE)
For a long time horizon, the following risk neutral CIR interest rate model can be considered
drt = a(b−rt) dt+σ√rt dZt
where a, b, r ̄, σ are positive constants, representing speed of mean reverting, average rate and volatility respectively. A zero coupon bond, paying off one dollar at t = T , has the following no-arbitrage value
BondValue = EQexp − r(t)dt . (1)
Provide a pseudo code for using a Monte Carlo method with M simulations, N time steps, and Milstein time-stepping to price the above zero coupon bond. Determine the value at t = t0, assuming r = r0 at t = t0 . Assume the existence of a function which returns a random variable φ ∼ N (0, 1). .
Instructor: Yuying Li Lecture Times: Yuying Li:
TA: Chendi Ni Chendi Ni
OH: Mar 15 1 - 2pm
Table 1: Data for Hedging Simulations Using a Binomial Lattice
Time to expiry T Initial asset price S(t0) Strike Price K
3 [(20 marks) ](Compute Delta from a Binomial Lattice) Assume that the (no dividend) underlying price follows
1 year $10 $0.95S(t0) 250
dSt =μdt+σdZt (2) St
where Zt is a standard Brownian, μ and σ are constants.
Consider the European straddle, whose payoff equals the sum of the call payoff and put payoff with
the same strike K, i.e., max(S − K, 0) + max(K − S, 0).
You are to conduct hedging effectiveness analysis for this power option using MC simulations of (2)
for the underlying price so that there is no time discretization error in the simulated price.
In addition, you will compute hedging positions by modifying your code for option pricing under a binomial lattice in Assignment 2.
Assume that the initial option price is computed from your binomial model. Specifically,
(a) Write a Matlab function [V0,S,δ] = binomialDeltaStraddle(S0,r,σ,T,N) which returns, the initial option value V0, S and δ, representing the underlying price and delta hedging positions on the binomial lattice nodes over equally spaced N time periods in [0,T]. The interest rate r and volatility σ are constants.
(b) Now consider a vector of (simulated) underlying price S (not necessarily equal to any binomial lattice price), using linear interpolation to determine the corresponding hedging positions δ(S) from the binomial lattice price vector Sn and delta δn as follows: When a simulated price in S does not equal to any lattice price Sn, interpolate using the hedging values at lattice nodes at each rebalancing time to approximate the hedging position (you can use matlab function interp1). To avoid potentially large extrapolation error, reset the hedging position equal to that of the nearest binomial price S n , if an underlying price exceeds the range of the price S n . Write a Matlab function δ=interpDelta(δn, Sn, S) to implement this interpolation.
(c) Using the data in Table 1, binomialDeltaStraddle, and interpDelta, write a matlab script to compute hedging positions at time tn, n = 0.8N, for a European straddle S = linspace(0.8S0, 1.4S0, 100) and plot the computed hedge position δ against S.
(d) Using the parameter values given in Table 1, determine the hedging error using discrete delta hedging for the straddle. Plot the histogram of the relative hedging error P&L, for no hedging, n=1:1:N (daily),n=5:5:N (weekly), n=20:20:N (monthly)respectively. assuming hedging positions are computed using binomialDeltaStraddle and interpDelta,. The Matlab functions histc, bar might prove useful. Use at least 50 bins in your histogram. Comment on your observations.
(e) Write a Matlab function [var,cvar]=dVaRCVaR(P&L, β) which returns VaR and CVaR for a discrete P&L distribution with M independent samples using the procedure described. In Matlab,
ordering can be done using sort. For the straddle, compute and report in a table, mean, standard deviation, VAR (95%), CVAR (95%), of P&L for no hedging, rebalancing monthly, weekly, and daily. Discuss how hedging performance changes with the rebalancing frequency.
(f) In general, a hedging rebalancing time trb may not coincide with the discrete time t nn
How would you change your code to implement the hedging analysis? .
4 [(10 marks)] (Trading simulation)
You think you have discovered an arbitrage dynamic trading strategy. Does it work?
Simulation can be used to analyze your strategy.
of the lattice.
Assume that it is possible to trade continuously in time, without transaction cost, and you can short sell stock, i.e., borrow stock to sell and return later without cost.
For simplicity, assume that the interest r = 0. Let St and Pt denote time t values of the stock and a European put with strike K and expiry T.
Suppose that today you sell the European put option with strike K and expiry T. Assume S0 < K. Let δtSt + Bt denote the value of the portfolio of the underlying and cash account at t. The cash
account Bt is used to balance the transactions.
At t = 0, you sell a share in the stock, i.e., δ0 = −1. Subsequently, for t > 0, you implement the following simple hypothetic trading strategy: As soon as St > K, buy a stock share. As soon as St < K, you sell the stock.
Att=0,thecashaccountissetsuchthat−P0+δ0S0+B0 =0.
(a) Write down a mathematical expression for your trading strategy δt, 0 < t < T, where δt denotes
the number of shares in the stock immediately after trading at t.
(b) Under specified assumptions, time t value of the hedging portfolio δtSt + Bt has two differential expressions in terms of St,K. Provide the precise expressions and conditions under which each expression is valid. Explain.
(c) Show that this is an arbitrage by analyze the distribution for the relative P&L, (−PT + δT ST + BT )/(P0 + S0).
(d) Now perform the following computation to investigate whether this is true. Assume that the underlying follows a Black-Scholes model, with the model parameters given in Table 1. Simulate your strategy above, assuming S0 = 100, K = 105. Compute the relative P&L (−PT + δT ST + BT )/(P0 + S0) by MC simulations. Assume P0 equals the initial call value computed by Black- Scholes formula. Use about 80,000 simulations. Use 100,200,400,800 rebalancing times (which are different from the value of N in Table 1). Show a table of results (mean, standard deviation, 95% VAR and CVAR) versus number of rebalancing times. Generate plot of the probability density of the relative P&L for the case of 800 rebalancing times.
What do you observe about the mean and variance of the hedging error?
(e) Bonus. Explain the discrepancy in the variance hedging error between the theoretical value under the continuous hedging assumption and the computed values using MC simulations.
5 [ (12 marks)] (MC Pricing Under Jump Model)
Assume that Zt is a standard Brownian motion. Let qt denotes a Poisson counting process where the change dqt is defined as
0 with probability 1 − λdt dqt = 1 with probability λdt,
Table 2: Model Parameter Data
Time to expiry
Strike Price
Initial asset price S(0)
Intensity of Poisson Process λ ∆t
1 years $95 $95 0.304 0.308 0.34 .1 1/1000
where λ > 0 denotes the jump intensity. Consider the following risk neutral jump-diffusion process dS(t) =(r−λκ)dt+σdZ+(J−1)dqt (3)
S(t) = S(t−)J
where J corresponds to the random jump amplitude. In Merton’s jump model, logJ has a normal distribution, see §9, 9.1, 9.2, 9.4, 9.5 in the course notes for discussions on the Merton’s jump diffusion model and its implementation.
In contrast to the original Merton’s jump process, here we assume, instead, a double exponential jump process. Specifically, assume that, when jump occurs, the up-jump occurs with a probability pu and down-jump occurs with a probability 1 − pu and the density function of the jump amplitude J is a double exponential, i.e., the density function f(y) of y = log(J) is
f(y) = puμu exp(−μuy)1y>=0 + (1 − pu)μd exp(μdy)1y<0 (4) where 1y>=0 is an indicator which equals 1 if y >= 0 and 0 otherwise.
(a) Verify that
κ=E[J−1]= puμu +(1−pu)μd −1 μu − 1 μd + 1
(b) Assuming the underlying follows a jump diffusion process (3) with the density of log jump ampli- tude log(J) given in (4), using Monte Carlo method with Euler time stepping., write a Matlab function to compute the fair value of a European capped-call
val = CappedCall(S0, σ, pu, μu, μd, λ, K, T, C)
with strike K and expiry T. The payoff of a European capped-call is
min max(ST − K, 0), C
Using parameter values in Table 2,, plot the computed option values with the number of (timesteps, simulations) = (800, 25000) for C = 20 : 10 : 100. How does the computed option value depend on the cap C ? Explain why your observation is reasonable. You can use the matlab function exprnd which generates a random sample from an exponential distribution in [0,+∞) with a probability density function
where the value S(t−) is the price just before jump and κ = E[J − 1]. Note that, if dqt = 1, then after
where μ > 0 is a parameter.
1e−μx fX (x) = μ
ifx∈[0,+∞) otherwise
(c) Use Matlab function blsimpv to plot the implied volatility of the standard option price using your CappedCall(S0,σ,pu,μu,μd,λ,K,T,C), by setting C = +∞, with (timesteps, simulations) = (800, 25000) against the strike, e.g., K=linspace(70, 120, 20) and T = 1.
(d) Discuss observed characteristics of the implied volatility from the assumed jump model. 6 [(Graduate Student Question)] (10 marks)
Practitioner’s BS delta hedging consists of a portfolio Π(t) with the following components at rebalancing time t = tn: an option position −Vn, δn shares at price Sn, and the dollar amount Bn in a risk-free cash account, where
δn = ∂VBS (Sn, tn; σ ̆n) (6) ∂S
and ∂VBS (Sn,tn;σ ̆n) is the BS delta at tn using the implied volatility σ ̆n computed from the market ∂S
option price Vn at the rebalancing time tn. In [Hull and White(2017)], hedging position function for the underlying is learned from the market price data 1. More specifically, the mean variance delta, δMV is modelled in a quadratic form
vegaBS 2
δMV =δBS + S√T a+b·δBS +c·δBS , (7)
see (5) in [Hull and White(2017)]. Your task is to read this paper to understand their proposed method and then conduct a comparative computational study on the data below.
You are given the S&P 500 index option data, in the file RawData.mat, from 01-Jan-2009 to 31-Dec- 2010 as the training data set and the data from 01-Jan – 2011 to 31-Dec-2011 as the testing data set. In RawData.mat, values of following additional variables are also provided for you to use for training and testing:
• CSTrain: Daily change of the market index price for the training set.
• CVTrain: Daily change of the market index option price for the training set.
• CSTest: Daily change of the market index price for the testing set.
• CVTest: Daily change of the market option price for the testing set.
• DeltaTrain: BS delta δBS computed using implied volatility σimp for the training set.
• DeltaTest: BS delta δBS computed using implied volatility σimp for the testing set.
• VegaTrain: BS vega vegaBS computed using implied volatility σimp for the training set. • VegaTest: BS vega vegaBS computed using implied volatility σimp for the testing set.
• STrain: market index price, S, for the training set.
• STest: market index price, S, for the testing set.
• TauTrain: time to expiry, τ, for the training set.
• TauTest: time to expiry, τ, for the testing set.
Consider daily hedging error ∆V −δ∆S, where ∆V = V (S(tn+1), tn+1)−V (S(tn), tn), ∆S = S(tn+1)− S(tn), δ is the position of the underlying at tn. Using the provided data, you are to
(a) For practitioner’s BS delta hedging defined in (6), plot the histogram of the hedging error ∆V − δ∆S, tabulate its mean, standard deviation, 95% VaR and CVaR when the hedging position δ = δBS using given training data and testing data respectively.
1Optimal delta hedging for options, Journal of Banking and Finance, 82, 180-190, 2017. 5
(b) Learn the MV hedging model (7), see (5) in [Hull and White(2017)] , using the training data.
(1) Report the ratio GAIN defined in (3) in [Hull and White(2017)] for the learned MV hedging model (7) using the training data and testing data respectively.
(2) In addition, plot the histogram of the hedging error ∆V − δ∆S, tabulate its mean, standard deviation, 95% VaR and CVaR with respect to the training data and testing data respectively, when the hedging position δ comes from the MV model (7) learned from the training data. How does the testing performance compare to training performance?
(c) Assume now that the hedging position function δ at time t has a different parametric form given below
δ=c +c ·S+c ·δ +c ·δ2 +c ·vega ·δ +c ·vega2 +c ·δ3 (8) 0 1 2 BS 3 BS 4 BS BS 5 BS 6 BS
where δBS denotes the BS delta and vegaBS denotes the BS vega. Learn this parametric function for the δ position by minimizing the MV error as defined in [Hull and White(2017)].
Repeat the same performance assessment as in (b) using the position in the underlying δ learned from training data using the parametric form (8). Compare results from (c) with the parameter- izations in (b). What do you observe? Is the observation reasonable? Why?
You can use Matlab function blsprice, blsimpv, blsdelta.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com