Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjam03/2eb0b3d4344444205f08781a2a6b577f to your computer and use it in GitHub Desktop.
Save mjam03/2eb0b3d4344444205f08781a2a6b577f to your computer and use it in GitHub Desktop.
fat_tails_and_their_impact_on_option_prices3
# set stock params
spot = 100
sigma = 0.20
n = 10000
# option strikes
ks = np.linspace(65, 165, 21)
eps = [0, 0.3, 0.6, 0.85]
# compute closing prices
pxs = {}
op_pxs = {}
for e in eps:
# init distribution class
dist = cust_dist(e=e)
# sample returns from dist
rets = sigma * dist.rvs(size=n)
# compute prices
px = spot * np.exp(rets)
# add pxs to price dict
pxs[e] = px
# compute option pxs
op_px = [np.mean([max(x - k, 0) if k > spot else max(k - x, 0) for x in px]) for k in ks]
# add to option price dict
op_pxs[e] = op_px
# plot them
fig, ax = plt.subplots(figsize=(25,10))
for e, op_px in op_pxs.items():
ax.plot(ks, op_px, label="e = {}".format(e))
ax.set_title("Time Value for Various Option Strikes", fontsize=24)
ax.set_xlabel("Option Strike, K", fontsize=20)
ax.set_ylabel("Time Value", fontsize=20)
ax.legend(fontsize=14);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment