Skip to main content

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.

Release files for allocation-language 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for allocation-language 0.0.4
File Size Uploaded
allocation_language-0.0.4.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for allocation-language 0.0.4
File Interpreter ABI Platform
allocation_language-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / allocation_language-0.0.4.tar.gz

Download URL allocation_language-0.0.4.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6420cbac9adb2cc60041d532f5953e7054e847639014850524b0a88eec900813
BLAKE2b-256 checksum
How to use checksums
a9e2378cb9591a98e573ea8a8bcc68b87092c9dd283e2fa856c6a5f5340f00a7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / allocation_language-0.0.4-py3-none-any.whl

Download URL allocation_language-0.0.4-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b0019ef7ce02b6b3aed4a779c7ab6ca96a9b42a2bfcd0e00517ba7b1107c49d
BLAKE2b-256 checksum
How to use checksums
1adbe707f481e8666b9d014e719cf2704ea4a8f2268e04b6f42b2ccd423f8ec8
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page