0% found this document useful (0 votes)
25 views4 pages

Python & MATLAB Solutions for Finance Modeling

This document provides solutions to exercises from Chapter 4 of the book "Mathematical Modeling and Computation in Finance" by C.W. Oosterlee & L.A. Grzelak. It includes solutions to 10 exercises involving option pricing models, Greeks, arbitrage conditions, and the independence of asset prices. Computer code solutions are provided in Python and MATLAB. Plots are included to illustrate volatility smiles and arbitrage conditions under different interpolation methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

Python & MATLAB Solutions for Finance Modeling

This document provides solutions to exercises from Chapter 4 of the book "Mathematical Modeling and Computation in Finance" by C.W. Oosterlee & L.A. Grzelak. It includes solutions to 10 exercises involving option pricing models, Greeks, arbitrage conditions, and the independence of asset prices. Computer code solutions are provided in Python and MATLAB. Plots are included to illustrate volatility smiles and arbitrage conditions under different interpolation methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mathematical Modeling and Computation in Finance

With Exercises and Python and MATLAB Computer Codes

C.W. Oosterlee & L.A. Grzelak

Solutions to exercises from Chapter 4

[Link]

Ex. 4.1. a. The code can be found under the Python icon.

b. The following code under the Python icon provides us with the solution.

Based on the 3D scatter plot diagram of the implied volatility versus the strike price, one
can clearly observe the volatility smile. The volatility smile becomes more pronounced
when the time to maturity is close to 0.

Figure 1: Results for Exercise 4.1b

Ex. 4.3. a. Remember that,

log(S/K) + (r ± σ 2 /2)(T − t)
d1,2 = √
σ T −t
 
XF t∗
= ± .
t∗ 2

b. The condition XF ≤ 0 implies Ser(T −t) ≤ K. This can be interpreted as the defi-
nition of forward moneyness. It provides information about the forward value of the
underlying, as compared to the strike price.

1
c. We obtain,

Vp (t, S(t)) Ke−r(T −t)


p= = FN (0,1) (−d2 ) − FN (0,1) (−d1 )
S(t) S(t)
= e−XF FN (0,1) (−d2 ) − FN (0,1) (−d1 ).

d. We find,
   
∂p XF 1 XF 1
= e−XF fN (0,1) (−d2 ) + − fN (0,1) (−d1 ) − .
∂t∗ t2∗ 2 t2∗ 2

Note that d2 = d1 + t∗ and fN (0,1) (−d1 ) = fN (0,1) (−d2 )e−XF . Substituting this, gives
us,
∂p
= fN (0,1) (−d1 ).
∂t∗
This derivative has a probabilistic interpretation, as it is equal to the probability density
function of the standard normal distribution evaluated at −d1 . It is the sensitivity of
a scaled put with respect to a scaled time.
Ex. 4.5. a. We have,
∂2c ∂d1 ∂c
= −d1
∂y∂w ∂y ∂w
 
∂c 1 y
= − .
∂w 2 w

b. We start with,
∂c
= c − S0 FN (0,1) (d1 ),
∂y
∂2c ∂c S0
= + √ fN (0,1) (d1 )
∂y 2 ∂y w
∂c ∂c
= +2 .
∂y ∂w

Ex. 4.7. The following computer code provides us with the requested answers.

As output, we obtain,

a. value1 = 0.13688917293214575,
b. value2 = 0.024216392555889792,
c. value3 = 0.747197522225466,
d. value4 = 2.6582099178678.

For payoffs 2 and 3 we are able to determine prices analytically,

value2 = 0.023877663895613327 and value3 = 0.7465691813081832.

Ex. 4.9. We have the following code, providing us with the desired plots.

The butterfly arbitrage appears only in the nearest neighbor interpolation. Although the lin-
ear and cubic spline interpolation routines appear to be free of butterfly arbitrage, the linear
interpolation does not give rise to a differentiable probability distribution. It is clear that
smoothening the interpolation by preserving the slope will reduce arbitrage. See Figure 2.

2
Figure 2: Results for Exercise 4.9 for different interpolation routines. Upper left figure:
linear. Upper right figure: cubic spline. Lower figure: nearest neighbor interpolation.

Ex. 4.11. a. We start with the first expression,


EQ [log(S1 (T ))S2 (T ) |F0 ] = EQ [log(S1 (T ))|F0 ]EQ [S2 (T )|F0 ],
which is based on the independence of the assets S1 and S2 . The Feynman-Kac theorem
relates the expected value of a payoff to the value of an option at time t. Therefore,
EQ [H(S, T )|F0 ] = er(T −t0 ) V (t0 , S).
We can determine the value at the right-hand side by using the Breeden-Litzenberger
model, for which the value is determined as,
Z SF
∂ 2 H(T, S)
V (t0 , S0 ; K, T ) = e−r(T −t0 ) H(SF , T ) + Vp (t0 , S0 ; y, T ) dy
0 ∂y 2
Z ∞
∂ 2 H(T, S)
+ Vc (t0 , S0 ; y, T ) dy.
SF ∂y 2
To be able the compute the first expectation, consider the payoff function H(T, S(T )) =
S(T ). Both integrals vanish due to the vanishing second derivative of the payoff func-
tion. So,
V (t0 , S0 ; K, T ) = e−r(T −t0 ) H(SF , T ) = S0 ,
since SF = S(t0 )er(T −t0 ) . And,
EQ [S2 (T )|F0 ] = S2 (t0 )er(T −t0 ) .
For the other expectation, the payoff becomes H(T, S(T )) = log(S(T )). Hence,
Z SF
1
EQ [log(S1 (T ))|F0 ] =r(T − t0 ) log(S1 (t0 )) − er(T −t0 ) Vp (t0 , S0 ; y, T ) 2 dy
0 y
Z ∞
r(T −t0 ) 1
−e Vc (t0 , S0 ; y, T ) 2 dy.
SF y

3
b. We rewrite the expression as the expected value over a logarithm, as follows,
N
Y S1 (ti+1 ) S2 (ti+1 )
EQ [log |F (t0 )] = EQ [log(S1 (ttN ))|F (t0 )] − EQ [log(S1 (tt1 ))|F (t0 )]
i=1
S1 (ti ) S2 (ti )
+EQ [log(S2 (ttN ))|F (t0 )] − EQ [log(S2 (tt1 ))|F (t0 )].

Each of these terms can be calculated via the expression, which was derived in part a).

Common questions

Powered by AI

Spline interpolation plays a vital role in reducing arbitrage by offering a smooth curve that maintains continuity and differentiability, unlike methods such as linear interpolation which may not achieve a differentiable probability distribution. As compared to nearest neighbor interpolation, which may introduce butterfly arbitrage, splines provide smoother transitions, thus minimizing arbitrage opportunities and enhancing the model's accuracy in financial applications .

Utilizing the standard normal distribution density function in analyzing option sensitivities enhances understanding by providing a probabilistic interpretation of model metrics. It allows for recognizing the sensitivities like \( \frac{\partial p}{\partial t^*} \) as a reflection of the probability density at specific points (-d1), thus extending insight into how option prices respond to changes in underlying variables, supported by a mathematical probability framework .

The choice of interpolation methods in financial modeling can significantly impact the presence of arbitrage opportunities. For instance, the nearest neighbor interpolation can result in butterfly arbitrage, while linear and cubic spline interpolations do not exhibit this issue. However, linear interpolation may not provide a differentiable probability distribution, and smoothening techniques that preserve the slope help in minimizing arbitrage, thus ensuring more stable and reliable modeling outcomes .

Forward moneyness interprets the condition where the forward price of the underlying asset is compared to the strike price. It is defined when XF ≤ 0, implying that the forward value of the underlying (Ser(T−t)) is less than or equal to the strike price. This provides insights into how expected future prices relate to current agreed-upon strike prices, influencing investment strategies and hedging decisions .

The Feynman-Kac theorem establishes a relationship between the expected value of a payoff and the option's value at the initial time. Specifically, the theorem implies that the expected payoff value, \( EQ[H(S,T)|F_0] \), is related to the option value \( V(t_0, S) \) through the exponential of the risk-free rate, demonstrating a fundamental linkage between stochastic processes and partial differential equations in option pricing .

The volatility smile is a crucial concept in financial modeling as it reflects discrepancies between the Black-Scholes model assumptions and observed market behaviors. The smile becomes more pronounced when the time to maturity approaches zero, indicating that market participants expect higher volatility for certain strike prices as compared to others. This observation suggests that the Black-Scholes model, which assumes constant volatility, may not adequately capture market realities, thus necessitating alternative models or adjustments .

Exercise 4.1 reveals that the implied volatility's market representation is depicted through a 3D scatter plot diagram, showing the relationship between volatility and strike prices. This exercise highlights the existence of the volatility smile, which becomes more visible when the time to maturity is near zero, indicating that volatility and option prices are influenced by maturity and strike price variations, deviating from constant volatility assumptions .

When assuming independence of assets \(S_1\) and \(S_2\), their expected joint distribution can be expressed as the product of their individual expectations, \( EQ[\log(S_1(T))S_2(T)|F_0] = EQ[\log(S_1(T))|F_0]EQ[S_2(T)|F_0] \). This simplifies the computation of expected values, facilitating financial analysis and modeling, but also assumes no interaction or correlation between the assets .

The partial derivative \( \frac{\partial p}{\partial t^*} \) for a scaled put option has a probabilistic interpretation: it equals the probability density function of the standard normal distribution evaluated at \(-d_1\). This represents the sensitivity of the option with respect to changes in scaled time, providing a direct link to probabilistic outcomes in option pricing .

The Breeden-Litzenberger model assists in determining the value of an option at the initial time by evaluating the payoff through integrals that vanish due to the payoffs' second derivative being zero. This simplification leads to the determination of the option’s value as a present value of the expected future payoff, discounted at the risk-free rate, illustrating a nuanced approach in option pricing when considering the risk-neutral measure .

You might also like