.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/time_value/annuities/plot_02_consol_perpetuity.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_time_value_annuities_plot_02_consol_perpetuity.py: Consols and the perpetuity ========================== In 1751 Henry Pelham consolidated several British government debts into a single issue of "3 per cent consolidated annuities", which were never to be repaid: the holder received 3 a year per 100 of face value forever. A perpetuity paying :math:`P` is worth :math:`P/i` at yield :math:`i`, so a consol's price moves inversely with long-term rates and at a 3% yield it trades at par. This script prices consols across yields and compares them with long but finite annuities. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from financialkit.time_value import annuity_present_value, perpetuity_present_value .. GENERATED FROM PYTHON SOURCE LINES 21-23 Consol prices ------------- .. GENERATED FROM PYTHON SOURCE LINES 23-27 .. code-block:: Python for y in (0.025, 0.03, 0.035, 0.05): print(f"yield {y:.1%}: consol price {perpetuity_present_value(3.0, y):6.2f}") .. rst-class:: sphx-glr-script-out .. code-block:: none yield 2.5%: consol price 120.00 yield 3.0%: consol price 100.00 yield 3.5%: consol price 85.71 yield 5.0%: consol price 60.00 .. GENERATED FROM PYTHON SOURCE LINES 28-30 A long annuity is nearly a perpetuity ------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 30-49 .. code-block:: Python yields = np.linspace(0.02, 0.08, 121) fig, axes = plt.subplots(1, 2, figsize=(11, 4)) axes[0].plot(100 * yields, perpetuity_present_value(3.0, yields), "k", lw=2, label="consol (perpetuity)") for n in (20, 50, 100): axes[0].plot(100 * yields, annuity_present_value(3.0, yields, n), label=f"{n}-year annuity") axes[0].axhline(100.0, color="gray", ls=":") axes[0].set_xlabel("yield (%)") axes[0].set_ylabel("price per 100 face") axes[0].legend() n = np.arange(1, 301) axes[1].plot(n, annuity_present_value(3.0, 0.03, n) / perpetuity_present_value(3.0, 0.03)) axes[1].set_xlabel("years of payments") axes[1].set_ylabel("fraction of consol value") axes[1].set_title("Annuity / perpetuity at 3%") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/time_value/annuities/images/sphx_glr_plot_02_consol_perpetuity_001.png :alt: Annuity / perpetuity at 3% :srcset: /api/gallery/time_value/annuities/images/sphx_glr_plot_02_consol_perpetuity_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.064 seconds) .. _sphx_glr_download_api_gallery_time_value_annuities_plot_02_consol_perpetuity.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/time_value/annuities/plot_02_consol_perpetuity.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_consol_perpetuity.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_consol_perpetuity.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_consol_perpetuity.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_