<jupyter_start><jupyter_text>Definitions Option priceAssuming underlying forward rate follows Normal distribution:$${\rm d} F_t = \mu dt + \sigma dW_t,$$The price for a call option can be described as below:$$C = \left( F - K \right) N \left( d \right) + \sigma \sqrt{\tau} n \left( d \right), \\d = \frac{F - K}{\sigma \sqrt{\tau}},$$where $N$ is c.d.f of Normal, $n$ is p.d.f of Normal, $F$ is forward rate, $K$ is strike, $\sigma$ is normal volatilityand $\tau$ is time to maturity. GreeksNow we are interested in how greeks behave as underlying forward rate moves. Focal greeks are:$$\begin{align}{\rm Gamma} &:= \frac{{\partial^2 C}}{\partial F^2} = \frac{1}{\sigma \sqrt{\tau}} n\left( d \right)\\{\rm Theta} &:= \frac{{\partial C}}{\partial \tau} = \frac{\sigma}{2 \sqrt{\tau}} n\left( d \right)\\{\rm Vega} &:= \frac{{\partial C}}{{\partial \sigma}} = \sqrt{\tau} n\left( d \right)\\{\rm Vanna} &:= \frac{{\partial^2 C}}{{\partial \sigma}{\partial F}} = -\frac{d}{\sigma} n\left( d \right)\\{\rm Volga} &:= \frac{{\partial^2 C}}{{\partial \sigma^2}} = \frac{d^2 \sqrt{\tau}}{\sigma}n\left( d \right)\\{\rm Veta \ (Vega \ decay)} &:= \frac{{\partial^2 C}}{{\partial \sigma}{\partial \tau}} = \frac{1}{2 \sqrt{\tau}}n\left( d \right) \left( 1-d^2 \right)\\\end{align}$$  Greeks vs forward rate Parameters<jupyter_code>strike = 3
sigma = 0.5
tau = 2<jupyter_output><empty_output><jupyter_text>Greeks<jupyter_code>data = pd.DataFrame(np.linspace(1, 5, 101), columns=["Forward"]).set_index("Forward")
data.head()
data = data.assign(
    d=lambda df: (df.index - strike) / (sigma * tau ** 0.5)
).assign(
    n_d=lambda df: (1/((2 * np.pi) ** 0.5)) * np.exp(-0.5 * df["d"] ** 2)
).assign(
    gamma=lambda df: (1/(sigma * tau ** 0.5)) * df["n_d"],
    theta=lambda df: (sigma/(2 * tau ** 0.5)) * df["n_d"],
    vega=lambda df: (tau ** 0.5) * df["n_d"],
    vanna=lambda df: -1 * df["d"] / sigma * df["n_d"],
    volga=lambda df: ((tau ** 0.5) * df["d"] ** 2)/sigma * df["n_d"],
    veta=lambda df: 1/(2 * tau ** 0.5) * df["n_d"] * (1 - df["d"] ** 2),
)

data.head()<jupyter_output><empty_output><jupyter_text>Gamma<jupyter_code>def plot_greeks(column, title):
    ax = data[column].plot(grid=True, title=title)
    ax.axhline(0, color="black")
plot_greeks("gamma", "Gamma")<jupyter_output><empty_output><jupyter_text>Theta<jupyter_code>plot_greeks("theta", "Theta")<jupyter_output><empty_output><jupyter_text>Vega<jupyter_code>plot_greeks("vega", "Veta")<jupyter_output><empty_output><jupyter_text>Vanna<jupyter_code>plot_greeks("vanna", "Vanna")<jupyter_output><empty_output><jupyter_text>Volga<jupyter_code>plot_greeks("volga", "Volga")<jupyter_output><empty_output><jupyter_text>Veta<jupyter_code>plot_greeks("veta", "Veta")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22697606961566352, 'fraction_numerical': 0.018129079042784626, 'mean_word_length': 4.820675105485232, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '568435', 'license': 'MIT', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1082, 'n_words': 230, 'path': 'Greeks_under_normal_model.ipynb', 'repo_name': 'nekopuni/notebooks', 'size': '2758'}