Language intented to construct the financial behaviour of (re)insurance contracts.
Project description
allocation_language
Language intented to construct the financial behaviour of (re)insurance contracts. Complete documentation of all methods is still pending because this is still in development.
Installation
$ pip install allocation_language
Examples
import random
from allocation_language import make_contract
from allocation_language.alloc_lang_data_containers import converters
contract = make_contract.make_contract_from_text("alloc @'claim' $name_1 @'liable';")
contract.update('name_1', 50)
def loss_data():
for i in range(10):
yield {
'id': i,
'claim': random.randint(1, 1e3),
'liable': 0,
}
losses = converters.dict_iter_to_event_iter(loss_data())
results = contract.evaluate_stream(losses)
for x in results:
print(x)
The above code is an example to feed a generator of loss data into a contract. The "alloc @'claim' $name_1 @'liable';" command translates in english to 'move as much as possible, limited to name_1's value, from the claim field into the liable field'. This means it applies an occurence limit equal to name_1. The contract.update method allows modification of any named variables in a contract. There can be multiple.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file allocation_language-0.0.4.tar.gz
.
File metadata
- Download URL: allocation_language-0.0.4.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6420cbac9adb2cc60041d532f5953e7054e847639014850524b0a88eec900813 |
|
MD5 | da752c9e5e808c3ec9a91141b7649070 |
|
BLAKE2b-256 | a9e2378cb9591a98e573ea8a8bcc68b87092c9dd283e2fa856c6a5f5340f00a7 |
File details
Details for the file allocation_language-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: allocation_language-0.0.4-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b0019ef7ce02b6b3aed4a779c7ab6ca96a9b42a2bfcd0e00517ba7b1107c49d |
|
MD5 | 0c344c736cc0a8d5866e97b445215ee8 |
|
BLAKE2b-256 | 1adbe707f481e8666b9d014e719cf2704ea4a8f2268e04b6f42b2ccd423f8ec8 |