.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples\savings\plot_ex1_option_value.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_savings_plot_ex1_option_value.py: Monte Carlo vs Black-Scholes-Merton =========================================== Time values of options and guarantees for various in-the-moneyness are calculated using Monte Carlo simulations and the Black-Scholes-Merton pricing formula for European put options. The Black-Scholes-Merton pricing formula for European put options can be expressed as below, where :math:`X` and :math:`S_{0}` correspond to the sum assured and the initial account value in this example. .. math:: p=Xe^{-rT}N\left(-d_{2}\right)-S_{0}N\left(-d_{1}\right) d_{1}=\frac{\ln\left(\frac{S_{0}}{X}\right)+\left(r+\frac{\sigma^{2}}{2}\right)T}{\sigma\sqrt{T}} d_{2}=d_{1}-\sigma\sqrt{T} The graph below shows the results obtained from the Monte Carlo simulations with 10,000 risk neutral scenarios, and from the Black-Scholes-Merton formula. Reference: *Options, Futures, and Other Derivatives* by John C.Hull .. seealso:: * :doc:`/libraries/savings/savings_example1` notebook in the :mod:`~savings` library .. GENERATED FROM PYTHON SOURCE LINES 35-59 .. image-sg:: /generated_examples/savings/images/sphx_glr_plot_ex1_option_value_001.png :alt: TVOG by ITM :srcset: /generated_examples/savings/images/sphx_glr_plot_ex1_option_value_001.png :class: sphx-glr-single-img .. code-block:: default import modelx as mx import pandas as pd import matplotlib.pyplot as plt from scipy.stats import norm, lognorm import numpy as np model = mx.read_model("CashValue_ME_EX1") proj = model.Projection proj.model_point_table = proj.model_point_moneyness monte_carlo = pd.Series(proj.pv_claims_over_av('MATURITY'), index=proj.model_point().index) monte_carlo = list(np.average(monte_carlo[i]) for i in range(1, 10)) S0 = proj.model_point_table['premium_pp'] * proj.model_point_table['policy_count'] fig, ax = plt.subplots() ax.scatter(S0, monte_carlo, s= 10, alpha=1, label='Monte Carlo') ax.scatter(S0, proj.formula_option_put(120), alpha=0.5, label='Black-Scholes-Merton') ax.legend() ax.grid(True) fig.suptitle('TVOG by ITM') .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.652 seconds) .. _sphx_glr_download_generated_examples_savings_plot_ex1_option_value.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ex1_option_value.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ex1_option_value.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_