Insurance portfolio management tools
Project description
PyInsurance
A Python library for insurance portfolio management, featuring advanced portfolio protection strategies.
Features
- TIPP Strategy: Time Invariant Portfolio Protection implementation
- High Performance: Cython-optimized core calculations
- Type Safety: Full type hints and static type checking
- Documentation: Comprehensive docstrings and examples
Installation
pip install pyinsurance
For development:
git clone https://github.com/yourusername/pyinsurance.git
cd pyinsurance
pip install -e ".[dev]"
Quick Start
import numpy as np
from pyinsurance.portfolio import TIPP
# Initialize parameters
capital = 100.0
multiplier = 10.0
rr = np.array([0.01, 0.02, -0.01]) # Return rates
rf = np.array([0.001, 0.002, 0.001]) # Risk-free rates
lock_in = 0.05 # 5% lock-in rate
min_risk_req = 0.40 # 40% minimum risk requirement
min_capital_req = 0.80 # 80% minimum capital requirement
# Create TIPP model
tipp = TIPP(
capital=capital,
multiplier=multiplier,
rr=rr,
rf=rf,
lock_in=lock_in,
min_risk_req=min_risk_req,
min_capital_req=min_capital_req
)
# Run the strategy
tipp.run()
# View results
print(tipp)
Documentation
TIPP Strategy
The Time Invariant Portfolio Protection (TIPP) strategy is designed to protect investment capital while maintaining upside potential. Key features:
- Dynamic floor adjustment
- Capital protection mechanism
- Risk allocation optimization
- Liquidity injection management
API Reference
TIPP Class
class TIPP:
def __init__(
self,
capital: float,
multiplier: float,
rr: NDArray[np.float64],
rf: NDArray[np.float64],
lock_in: float,
min_risk_req: float,
min_capital_req: float,
freq: float = 252
) -> None:
"""Initialize TIPP model with parameters."""
Properties
portfolio: Current portfolio valuesref_capital: Reference capital valuesmargin_trigger: Margin trigger valuesfloor: Floor valuesmin_risk_req: Minimum risk requirementmin_capital_req: Minimum capital requirementlock_in: Lock-in ratemultiplier: Risk multiplierrr: Return rate arrayrf: Risk-free rate array
Development
Setup
- Clone the repository
- Create a virtual environment
- Install development dependencies:
pip install -e ".[dev]"
Testing
pytest
Type Checking
mypy .
Code Style
black .
isort .
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and type checking
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Inspired by academic research in portfolio insurance
- Built with Python and Cython
- Uses NumPy for numerical computations
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyinsurance-2.0.0.tar.gz.
File metadata
- Download URL: pyinsurance-2.0.0.tar.gz
- Upload date:
- Size: 203.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78c7ac589d79a373660afc389ccd5c434a5b194e14f5fecca9bb67eb1dd56445
|
|
| MD5 |
1a874067bb3974f353030c51b3f2574f
|
|
| BLAKE2b-256 |
2d489a9f9f37f972c8950442f492ac39e2377de77d2a70535db983101773bfde
|
File details
Details for the file pyinsurance-2.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyinsurance-2.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 785.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d05259d922b0b31ee9463438b6f21e03d4ec3c4b056dc2a7a26d97a493923320
|
|
| MD5 |
b117ef56d1203ffefe9167e44b8fbc9b
|
|
| BLAKE2b-256 |
6a6f46507b74062e99dbbf3cac3276185c7c1ac654bf070c48738c41f1d43f8b
|
File details
Details for the file pyinsurance-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyinsurance-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 773.9 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3e66c3cd293097d6ffd26a89df578e7c1258af3dbdd0511067bce7d3cade0ce
|
|
| MD5 |
d63243d89d85bb27741ab910a2798215
|
|
| BLAKE2b-256 |
d88271aa1a55ce708a5196690afb3d31a49e82a3d974bceded70425ce728af1a
|