.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples\solvency2\plot_scr_cashflows.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_solvency2_plot_scr_cashflows.py: solvency2: cashflows =========================== Net liability cashflows by SCR shock scenarios for selected policies .. seealso:: * The :mod:`~solvency2` library .. GENERATED FROM PYTHON SOURCE LINES 10-47 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /generated_examples/solvency2/images/sphx_glr_plot_scr_cashflows_001.png :alt: Net Cashflows, Policy ID: 41, Shock at 5 :srcset: /generated_examples/solvency2/images/sphx_glr_plot_scr_cashflows_001.png :class: sphx-glr-multi-img * .. image-sg:: /generated_examples/solvency2/images/sphx_glr_plot_scr_cashflows_002.png :alt: Net Cashflows, Policy ID: 171, Shock at 5 :srcset: /generated_examples/solvency2/images/sphx_glr_plot_scr_cashflows_002.png :class: sphx-glr-multi-img .. code-block:: default import modelx as mx import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="darkgrid") model = mx.read_model("model") def draw(polid, t0): fig, ax = plt.subplots() fig.suptitle('Net Cashflows') title = 'Policy ID: ' + str(polid) + ', Shock at ' + str(t0) data = {} for risk, shock in (('base', None), ('mort', None), ('longev', None), ('lapse', 'up'), ('lapse', 'down'), ('lapse', 'mass'), ('exps', None)): proj = model.SCR_life[t0, polid].Projection(risk, shock) last_t = proj.last_t() label = risk + ('(' + shock + ')' if shock else '') data[label] = [proj.NetInsurCF[t] for t in range(t0, last_t)] return pd.DataFrame( data, index=range(t0, last_t)).plot( ax=ax, kind='line', title=title) for polid, t0 in [(41, 5), (171, 5)]: draw(polid, t0) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.190 seconds) .. _sphx_glr_download_generated_examples_solvency2_plot_scr_cashflows.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_scr_cashflows.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_scr_cashflows.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_