Skip to content

Commit

Permalink
asian opt refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelmagnu committed Dec 16, 2024
1 parent 187b096 commit 9a69d98
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/PyMPDATA_examples/asian_option/Mkhize_2007.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import numpy as np
from scipy.stats import norm

def geometric_mkhize(s_t=100, K=100, r=0.008, sigma=0.2, T=30, T_0=0):
d_1 = (np.log(s_t / K) + 0.5 * (r + (sigma ** 2) / 6) * (T - T_0)) / (sigma * np.sqrt((T - T_0) / 3))
d_2 = d_1 - sigma * np.sqrt((T - T_0) / 3)
C_0 = s_t * np.exp(-0.5 * (r + (sigma ** 2) / 6) * (T - T_0)) * norm.cdf(d_1) - K * np.exp(
-r * (T - T_0)) * norm.cdf(d_2)
P_0 = K * np.exp(-r * (T - T_0)) * norm.cdf(-d_2) - s_t * np.exp(
-0.5 * (r + (sigma ** 2) / 6) * (T - T_0)) * norm.cdf(-d_1)
return C_0

0 comments on commit 9a69d98

Please sign in to comment.