How is the simulation done of the black scholes model?
This post contains additional questions from:
How do I implement the Euler scheme for this SDE?
I think it is more appropriate to start a new post.
In an assignment the following SDE needs to be simulated:
\begin{array}{l} d S_{t}=\alpha S_{t} d t+\sigma_{i} S_{t} d w_{t}^{1} \\ d \sigma_{t}=-\left(\sigma_{t}-\xi_{t}\right) d t+p \sigma_{t} d w_{t}^{2} \\ d \xi_{t}=\frac{1}{\alpha}\left(\sigma_{z}-\xi_{i}\right) d t \end{array}with $S_{0}=€ 50, \quad \sigma_{0}=0.20, \quad \xi_{0}=0.20 \quad$ and $\alpha=0.10$
For $p=0($ and $\alpha \neq 0)$ the well-known Black-Scholes model is obtained: $$ d S_{t}=\alpha S_{i} d t+\sigma_{0} S_{i} d w_{i}^{1} $$
On page 17 and 18 of the document the same SDE is solved: https://beta.vu.nl/nl/Images/werkstuk-dmouj_tcm235-91341.pdf
In the previous post as well in the document the stockprise the following conversion is done:
$S_t=\exp(X_t)$ or $X_t=\ln(S_t)$.
My first question is: Why is this done?
The solution of the SDE is:
$S_{t}=S_{t-1} e^{\left(\mu-\frac{1}{2} \sigma^{2}\right) d t+\sigma \varepsilon \sqrt{d t}}$
In the previous post the following solutions were given
$$\newcommand{\D}{\mathit{\Delta}} \begin{align} X_{t+\D t}&=X_t+(α-\tfrac12σ_t^2)\D t+σ_tz^1_t\sqrt{\D t}\\ σ_{t+\D t}&=σ_t−(σ_t−ξ_t)\D t+pσ_tz^2_t\sqrt{\D t}\\ ξ_{t+\D t}&=ξ_t+\frac1α(σ_t−ξ_t)\D t \end{align} $$
I'm a bit confused on how to plot the stockprice vs the time now. It's more that I'm not really sure about the approach. I want to do this in Python. I would first discretize my time interval in N intervals of $dt$. Then I would fill an array with ξ for each timestep. I would do the same for σ. At last I would calculate $X$ for each timestep. Since I know Xt, but want to plot $S_t$ v.s the time. I need to do a $Exp()$ converserion on the array.
Or is it better to only calculate ξ and σ for each timestep and then fill it in the exact formula of $S_t$. I think the result will be the same(apart from the randomness), but I'm not really sure about that
Questions:
- Why is the conversion $X_t$ from $S_t$ done and why specifically $ln()$?
- It the outline of simulation I described above OK?
Tim
If you discretize the equation for $S_t$ directly, then there is a non-zero chance that you get negative values during the integration, especially for larger time steps. You would need some mechanism to catch that in a way that does not change the statistics of the process (too much).
Parametrizing $S_t=e^{X_t}$ forces $S$ to be positive, that the equations additionally simplify under the transformation is welcome but not the primary reason. Now the discretization of the equation for $X_t$ allows an unconstrained integration.
The formula $$ S_{t_{k+1}}=S_{t_k} e^{\left(\mu-\frac{1}{2} \sigma^{2}\right)\,d t_k+\sigma \zeta_k \,\sqrt{d t_k}} $$ just translates the effect of the $X$ discretization back into an evolution formula for $S$, it makes not much difference which formulations of the two you use.
You could carry out the integration of $(σ_t,ξ_t)$ first, as they do not contain $S_t$ or $X_t$, but I do not see why that would be helpful, update $(X_t,σ_t,ξ_t)$ simultaneously in one time loop.