.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/exotic_options/compound/plot_01_geske_compound.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_exotic_options_compound_plot_01_geske_compound.py: Geske compound options ====================== Robert Geske (1979) priced an option on an option. His motivation was corporate finance: if equity is a call on the firm's assets, a stock option is a call on a call, and its implied volatility should rise as the stock falls and leverage grows. The compound call is exercised at :math:`T_1` only if the underlying option is worth more than the compound strike, which happens above a critical spot :math:`I`, and the joint law of the price at :math:`T_1` and :math:`T_2` brings in the bivariate normal distribution with correlation :math:`\sqrt{T_1/T_2}`. .. GENERATED FROM PYTHON SOURCE LINES 16-26 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from financialkit.exotic_options import compound_option_price, critical_price from financialkit.options import black_scholes_price K1, K2, T1, T2, r, sigma = 5.0, 100.0, 0.25, 1.0, 0.05, 0.3 S = np.linspace(60.0, 150.0, 200) print(f"Haug (2007), 4.6, put on call: {compound_option_price(500.0, 50.0, 520.0, 0.25, 0.5, 0.08, 0.35, q=0.03, option_type='put'):.4f}") .. rst-class:: sphx-glr-script-out .. code-block:: none Haug (2007), 4.6, put on call: 21.1964 .. GENERATED FROM PYTHON SOURCE LINES 27-29 The four compound options ------------------------- .. GENERATED FROM PYTHON SOURCE LINES 29-42 .. code-block:: Python fig, axes = plt.subplots(1, 2, figsize=(12, 4)) for underlying in ("call", "put"): I = critical_price(K1, K2, T2 - T1, r, sigma, underlying_type=underlying) for option_type in ("call", "put"): axes[0].plot( S, compound_option_price(S, K1, K2, T1, T2, r, sigma, option_type=option_type, underlying_type=underlying), label=f"{option_type} on {underlying}" ) axes[0].axvline(I, color="C0" if underlying == "call" else "C2", ls=":", lw=1) axes[0].set_xlabel("spot S (dotted: critical spots I)") axes[0].set_ylabel("value") axes[0].legend() .. image-sg:: /api/gallery/exotic_options/compound/images/sphx_glr_plot_01_geske_compound_001.png :alt: plot 01 geske compound :srcset: /api/gallery/exotic_options/compound/images/sphx_glr_plot_01_geske_compound_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 43-47 Compound put-call parity ------------------------ Call on call minus put on call is the call minus the discounted compound strike, whatever the spot. .. GENERATED FROM PYTHON SOURCE LINES 47-56 .. code-block:: Python cc = compound_option_price(S, K1, K2, T1, T2, r, sigma) pc = compound_option_price(S, K1, K2, T1, T2, r, sigma, option_type="put") axes[1].plot(S, cc - pc, lw=3, label="call on call - put on call") axes[1].plot(S, black_scholes_price(S, K2, T2, r, sigma) - K1 * np.exp(-r * T1), "k--", label=r"$c(S) - K_1 e^{-rT_1}$") axes[1].set_xlabel("spot S") axes[1].legend() fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.071 seconds) .. _sphx_glr_download_api_gallery_exotic_options_compound_plot_01_geske_compound.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/exotic_options/compound/plot_01_geske_compound.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_geske_compound.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_geske_compound.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_geske_compound.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_