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("my_model")
Input
my_model/input.py
main = ModelPointSet(data=pd.read_csv("C:/my_data/main.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
my_model/model.py
@variable()
def age(t):
if t == 0:
return int(main.get("AGE"))
elif t % 12 == 0:
return age(t-1) + 1
else:
return age(t-1)
@variable()
def death_prob(t):
if age(t) == age(t-1):
return death_prob(t-1)
elif age(t) <= 100:
sex = main.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
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.4.1.tar.gz
(12.7 kB
view hashes)
Built Distribution
cashflower-0.4.1-py3-none-any.whl
(12.7 kB
view hashes)
Close
Hashes for cashflower-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51e0857bd9999b4c073e197825028071b55bf41adf0183213da6df949cf45251 |
|
MD5 | 4baf98afce307a43fd646de097b41219 |
|
BLAKE2b-256 | 27fe154ca93025e5300c8e9a0d13b2033d9be29b06145a15383b7594a4d797d1 |