Framework for actuarial cash flow models
Project description
Info
Cashflower is an open-source Python framework for actuarial cash flow models.
Prerequisities
Python version >=3.9
Usage
Installation
terminal
pip install cashflower
Create model
python console
from cashflower import create_model
create_model("wol")
Input
wol/input.py
policy = ModelPoint(data=pd.read_csv("C:/my_data/policy.csv"))
assumption = dict()
assumption["interest_rates"] = pd.read_csv("C:/my_data/interest_rates.csv")
assumption["mortality"] = pd.read_csv("C:/my_data/mortality.csv", index_col="age")
Model
wol/model.py
age = ModelVariable(modelpoint=policy)
death_prob = ModelVariable(modelpoint=policy)
@assign(age)
def age_formula(t):
if t == 0:
return int(policy.get("AGE"))
elif t % 12 == 0:
return age(t-1) + 1
else:
return age(t-1)
@assign(death_prob)
def death_prob_formula(t):
if age(t) == age(t-1):
return death_prob(t-1)
elif age(t) <= 100:
sex = policy.get("SEX")
yearly_rate = assumption["mortality"].loc[age(t)][sex]
monthly_rate = (1 - (1 - yearly_rate)**(1/12))
return monthly_rate
else:
return 1
Calculate
Run run.py
Quick start
Watch how to create a cash flow model on a YouTube video:
Contribution
The cashflower package is open-source. Everyone can use it and contribute to its development.
GitHub repository:
https://github.com/acturtle/cashflower
Documentation:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cashflower-0.2.12.tar.gz
(12.8 kB
view hashes)
Built Distribution
Close
Hashes for cashflower-0.2.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8f67f37d790410b7e32fff0e160b14d18f091e0a9a9e86f739e2da36d24042f |
|
MD5 | 8869b8a57388184b5c9188edac2c76dc |
|
BLAKE2b-256 | 45b0262a5a8a25c8e989223605902c96311231fdaa6c54af35fc8d7bc81d1096 |