• No results found

= µc dt = r dt (9.73)

where r is the risk free rate.

The stochastic process in the risk neutral world is then dSt

St

= (r − λQκQ) dt + σ dZ + (JtQ− 1) dq , (9.74)

where λQ, κQ, JtQare all risk adjusted quantities.

9.5 Matlab Code: Jump Diffusion

We give Matlab code for simulation jump diffusions, assuming process (9.72), with jump size given by (9.64) in (9.76).

We are assuming that

λ∆t  1 (9.75)

so that the probability of having more than one jump in [t, t + dt] is negligible.

Note that there are more efficient ways of simulating jump diffusions, for special cases (i.e. volatility constant), but algorithm (9.76) is very simple and can be easily generalized.

Vectorized M file For Jump Diffusion randn(’state’,100);

rand(’state’, 10);

T = 1.00; % expiry time

sigma = 0.25; % volatility mu = .10; % P measure drift S_init = 100; % initial value

% jump size: log normal distribution lambda = .1 ; %jump size arrival rate jump_vol = .40; ; %stdrd dev of jump size jump_mean = -.9; %mean of jump size N_sim = 100000; % number of simulations N = 250; % number of timesteps delt = T/N; % timestep

%

% compensated drift E[J-1]

%

kappa = exp(.5*jump_vol*jump_vol + jump_mean) - 1.;

%

% compensated drift for X = log(S)

drift = (mu - sigma*sigma/2.0 - lambda*kappa);

%

% X = log(S)

%

X_old(1:N_sim,1) = log(S_init);

X_new(1:N_sim,1) = zeros(N_sim, 1);

jump_chek = zeros(N_sim, 1);

jump_size = zeros(N_sim, 1);

jump_mask = zeros( N_sim, 1);

for i=1:N % timestep loop

jump_chek(:,1) = rand(N_sim,1);

jump_mask(:,1) = ( jump_chek(:,1) <= lambda*delt);

jump_size(:,1) = jump_mean + jump_vol*randn(N_sim,1);

jump_size = jump_size.*jump_mask;

X_new(:,1) = X_old(:,1) + drift(:,1)*delt +sigma*sqrt(delt)*randn(N_sim,1) +...

jump_size(:,1);

X_old(:,1) = X_new(:,1);

end % timestep loop

S(:,1) = exp( X_new(:,1) );

n_bin = 200;

hist(S, n_bin);

stndrd_dev = std(S);

disp(sprintf(’standard deviation: %.5g\n’,stndrd_dev));

mean_S = mean(S);

disp(sprintf(’mean: %.5g\n’,mean_S));

86

10 Regime Switching

Of course, volatility is not constant in the real world. It is possible to combine jumps in the asset price with jumps in volatility and stochastic volatility. This leads to a two factor pricing PIDE for the option price.

A simpler approach is to assume that the volatility jumps between a number of regimes or volatility states. Let the value of a contingent claim be given by F (σ, S, t), where we have allowed the volatility σ to vary. Suppose

dS = a dt + b dZ + (JS− 1)S dq

dσ = (Jσ− 1)σ dq , (10.1)

where dq is a Poisson process and dZ is the increment of a Weiner process. Here a = a(σ, S, t), b = b(σ, S, t).

Note that the same dq drives the jump in S and the jump in σ. Following the same steps as in deriving equation (9.27) we obtain

dF = µ dt + σ dZ + ∆F dq µ = aFS+b2

2FSS+ Ft

σ= bFS

∆F = [F (Jσσ, JSS, t) − F (σ, S, t)] . (10.2) We follow the same steps as in the derivation of the jump diffusion PIDE in equations (9.29-9.36), i.e. we construct a hedge portfolio with three contracts F1, F2, F3, and we do not assume that we can trade in the underlying. Eliminating the random terms gives rise to the analogue of equation (9.33) and hence a solution exists only if one of the equations is a linear combination of the other equations, which results in

(µ − rF ) = λBσ− λJ∆F (10.3)

and substituting the definitions of σ, µ from equation (10.2) gives

Ft+b2

2FSS+ (a − λBb)FS− rF + λJ[F (Jσσ, JSS, t) − F (σ, S, t)] = 0 . (10.4) In the event that, say, F3= S is a traded asset, we note that in this case

σ3 = b µ3 = a

∆F3 = (JS− 1)S . (10.5)

Substituting equation (10.5) into equation (10.3) gives

a − λBb = rS − λJ(JS− 1)S . (10.6)

Substituting equation (10.6) into equation (10.4) gives

Ft+b2

2FSS+ [r − λJ(JS− 1)]SFS− rF + λJ[F (Jσσ, JSS, t) − F (σ, S, t)] = 0 . (10.7) Note that if JS = 1 (no jump in S, but a regime switch) then the term λJ(JS− 1) disappears in the drift term.

We can repeat the above arguments with jumps from a given regime with volatility σ to several possible regimes Jσiσ, i = 1, . . . , p. Each possible transition σ → Jσiσ is driven by a Poisson process dqi. We assume

that dqi and dqj are independent. In this case, we have

dS = a dt + b dZ +

i=p

X

i=1

(JSi − 1)S dqi

dσ =

i=p

X

i=1

(Jσ− 1)σ dqi , (10.8)

Following the by now familiar steps, we obtain Ft+b2

2FSS+ (a − λBb)FS− rF +X

i

λiJ[F (Jσiσ, JSiS, t) − F (σ, S, t)] = 0 . (10.9)

Note that in general λiJ = λiJ(σ, S), Jσi = Jσi(σ, S), JSi = JSi(σ, S), and λB = λB(σ, S). Now, suppose we have only a finite number of possible regimes σk, k = 1, . . . , p. Let

b(σk, S, t) = bk λkBk, S) = λkB(S)) F (σk, S, t) = Fk(S, t) λiJk, S, t) = λk→iJ Jσik, S, t) = Jσk→i

JSik, S, t) = JSk→i. (10.10)

Rewriting equation (10.9) using equation (10.10) gives Ftk+b2k

2FSSk + (ak− λkBbk)FSk− rFk+X

i

λk→iJ [Fi(JSk→iS, t) − Fk(S, t)] = 0 . (10.11)

If we can hedge with the underlying, then the usual arguments give ak− λkBbk = rS −X

i

λk→iJ (JSk→i− 1)S . (10.12)

Substituting equation (10.12) into equation (10.11) gives Ftk+b2k

2FSSk + (r −X

i

λk→iJ (JSk→i− 1))SFSk− rFk+X

i

λk→iJ [Fi(JSk→iS, t) − Fk(S, t)] = 0 . (10.13)

If we have only a small number of regimes, we are effectively solving a small number of coupled 1-d PDEs.

In principle, the JSk→i, σk are P measure parameters, while the λk→iJ is a Q measure parameter. Often, we choose

b(σ, S, t) = σS

bk= σkS . (10.14)

We can also determine the σk, JSk→i, λk→iJ by calibration to market prices.

11 Mean Variance Portfolio Optimization

An introduction to Computational Finance would not be complete without some discussion of Portfolio Optimization. Consider a risky asset which follows Geometric Brownian Motion with drift

dS

S = µ dt + σ dZ , (11.1)

where as usual dZ = φ√

dt and φ ∼ N (0, 1). Suppose we consider a fixed finite interval ∆t, then we can write equation (11.1) as each asset at t, to form the portfolio P

P =

In other words, we divide up our total wealth W = Pi=N

i=1 xiSi into each asset with weight wi. Note that Pi=N

i=1 wi= 1.

To summarize, given some initial wealth at t, we suppose that an investor allocates a fraction wi of this wealth to each asset i. We assume that the total wealth is allocated to this risky portfolio P , so that

i=N

while the variance of Rp in [t, t + ∆t] is

Suppose the assets all have zero correlation with one another, i.e. ρij ≡ 0, ∀i 6= j (of course ρii = 1). Then equation (11.8) becomes

so that in this special case, if we diversify over a large number of assets, the standard deviation of the portfolio tends to zero as N → ∞.

Consider another case: all assets are perfectly correlated, ρij = 1, ∀i, j. In this case

V ar(Rp) =

so that if sd(R) =pV ar(R) is the standard deviation of R, then, in this case

sd(Rp) =

j=N

X

j=1

wjσj0 , (11.12)

which means that in this case the standard deviation of the portfolio is simply the weighted average of the individual asset standard deviations.

In general, we can expect that 0 < |ρij| < 1, so that the standard deviation of a portfolio of assets will be smaller than the weighted average of the individual asset standard deviation, but larger than zero.

This means that diversification will be a good thing (as Martha Stewart would say) in terms of risk versus reward. In fact, a portfolio of as little as 10 − 20 stocks tends to reap most of the benefits of diversification.

Related documents