Example #1
0
def test_annuity_due():
    renda = ac.Annuities_Certain(interest_rate=5, frequency=1)
    r1 = renda.annuity_due(10)
    assert 8.107821675644 == pytest.approx(r1, rel=1e-12)
Example #2
0
mt_lst = [
    rst.SoaTable('../../soa_tables/' + name + '.xml') for name in table_names
]
lt_lst = [mortality_table.MortalityTable(mt=mt.table_qx) for mt in mt_lst]
ct_lst = [
    commutation_table.CommutationFunctions(i=interest_rate,
                                           g=0,
                                           mt=mt.table_qx) for mt in mt_lst
]
ages = np.linspace(start=20, stop=40, num=5, dtype=int)
'''
Prepare the solution for Equal Instalments
'''
capital = 100000
terms = 25
ac = annuities_certain.Annuities_Certain(interest_rate=interest_rate,
                                         frequency=1)
ac_certain = ac.annuity_immediate(terms=terms)
equal_instalments_dict = {
    'table': [],
    'x': [],
    'annuity_certain': [],
    'annuity': [],
    'premium': []
}

for id_ct, ct in enumerate(ct_lst):
    for id_x, x in enumerate(ages):
        equal_instalments_dict['table'].append(table_names[id_ct])
        equal_instalments_dict['x'].append(x)
        equal_instalments_dict['annuity_certain'].append(ac_certain)
        annuity = ct.nax(x=x, n=terms, m=1)
Example #3
0
def test_annuity_immediate_m2():
    renda = ac.Annuities_Certain(interest_rate=5, frequency=4)
    r1 = renda.annuity_immediate(10)
    assert 7.865045862098 == pytest.approx(r1, rel=1e-12)
Example #4
0
def test_annuity_due_m2():
    renda = ac.Annuities_Certain(interest_rate=5, frequency=4)
    r1 = renda.annuity_due(10)
    assert 7.961567548713 == pytest.approx(r1, rel=1e-12)
Example #5
0
def test_annuity_immediate_m():
    renda = ac.Annuities_Certain(interest_rate=5, frequency=12)
    r1 = renda.annuity_immediate(10)
    assert 7.897132548452 == pytest.approx(r1, rel=1e-12)
Example #6
0
def test_annuity_due_m():
    renda = ac.Annuities_Certain(interest_rate=5, frequency=12)
    r1 = renda.annuity_due(10)
    assert 7.929306443990 == pytest.approx(r1, rel=1e-12)
Example #7
0
def test_annuity_immediate():
    renda = ac.Annuities_Certain(interest_rate=5, frequency=1)
    r1 = renda.annuity_immediate(10)
    assert 7.721734929185 == pytest.approx(r1, rel=1e-12)