Presentation is loading. Please wait.

Presentation is loading. Please wait.

Líkön og mælingar – Fjármálaafleiður 4.1 Financial derivatives Numerical methods.

Similar presentations


Presentation on theme: "Líkön og mælingar – Fjármálaafleiður 4.1 Financial derivatives Numerical methods."— Presentation transcript:

1 Líkön og mælingar – Fjármálaafleiður 4.1 Financial derivatives Numerical methods

2 Líkön og mælingar – Fjármálaafleiður 4.2 The Black-Scholes equation The value, f, of a derivative is: Dividing the possible values of t and S into a grid: t i =i  t and S j =j  S and using the explicit finite difference method, we write:

3 Líkön og mælingar – Fjármálaafleiður 4.3 Numerical equation Inserting into the BS equation, and rewriting, we get: where:

4 Líkön og mælingar – Fjármálaafleiður 4.4 Assignment 3 Write programs that calculate and display the value of an European call option according to the Black- Scholes model. Draw 3-D graphs for f as a function of t and S. Use the exact solution and the boundary conditions. Use K=40, r=0 and  = 0, 0.5 and 1.0 (3 graphs). Use 0  S  100 and 0  t*  1, (t*=T-t). What is the effect of  ?

5 Líkön og mælingar – Fjármálaafleiður 4.5 Tips (1) Boundary conditions: 1.If S(t)=0 for all t, then f(0,t)=0 for all t (or t*). $f[$j=0]=0 for all t*=$i*$dt. 2.When S , then f(S,t) . $f[$j=$jmax]=$jmax*$dS-$K where $jmax=$Smax/$Sdiv. 3.When t=T (t*=0), then f(S,T) = max(0,S-K) For (t*=0), we print out f(S,T) = max(0,S-K) We then use a temporary vector $f_next[$j]=&max(0,$j*$dS-$K); and calculate $f[$j] using $f_next and then set $f_next[$j]= $f[$j] for all $j to get a future value for $f.

6 Líkön og mælingar – Fjármálaafleiður 4.6 Tips (2) Warning: the terms in the parenthesis for the parameters a, b and c should not be negative. Choose the grid for S so that j does not become too large (and maybe different j max for different  ). Outer loop for t*, inner loop for S.

7 Líkön og mælingar – Fjármálaafleiður 4.7 Tips (3) Local PERL max function # Called by &max(a,b) sub max { $in1 = $_[0]; $in2 = $_[1]; if($in1 < $in2) { $tmp=$in2; } else { $tmp=$in1; } $res=$tmp }

8 Líkön og mælingar – Fjármálaafleiður 4.8 Tips (4) 3D graphs in Gnuplot set terminal postscript enhanced "Times-Roman" 22 set output "bs_3d.ps" set title "Value of an European call option" set xlabel "S (price/share)" 0,-1 set ylabel "t* (years)" set zlabel "f (value/share)" set border set parametric set dgrid3d 101,31,8 set data style lines set hidden3d set contour set nokey set zero 1e-10 set view 75, 10 splot "bs3d.dat" using 1:2:3 with lines lw 0.2


Download ppt "Líkön og mælingar – Fjármálaafleiður 4.1 Financial derivatives Numerical methods."

Similar presentations


Ads by Google