Note
Go to the end to download the full example code.
TradLife_A: present values of cashflows#
Present values of liability cashflows of a simple whole life policy
projected by the annuallife TradLife_A model.
See also
The
annuallifelibrary

import modelx as mx
proj = mx.read_model("TradLife_A").Projection
vars = ['pv_premiums',
'pv_claims_surr',
'pv_claims_death',
'pv_exps_maint',
'pv_commissions',
'pv_exps_acq']
# PolicyID 171 in simplelife corresponds to idx 170 (0-based array index)
# in TradLife_A.
idx = 170
for cells in vars:
list(proj[idx].cells[cells](t) for t in range(50))
cfs = proj[idx].frame[vars].sort_index().dropna().droplevel(['x', 'y', 'basis'])
cfs.index = cfs.index.astype(int)
[proj[idx].pv_net_cf[t] for t in range(50)]
ncf = proj[idx].pv_net_cf.frame.sort_index()
import seaborn as sns
sns.set_theme(style="darkgrid")
axes = ncf.plot.line(marker='o', color='r')
cfs.plot(kind='bar', stacked=True, ax=axes)
Total running time of the script: (0 minutes 1.152 seconds)