Skip to main content

Insurance portfolio management tools

Project description

PyInsurance

A Python library for insurance portfolio management, featuring advanced portfolio protection strategies.

Python Version License Code Style Type Checker

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 values
  • ref_capital: Reference capital values
  • margin_trigger: Margin trigger values
  • floor: Floor values
  • min_risk_req: Minimum risk requirement
  • min_capital_req: Minimum capital requirement
  • lock_in: Lock-in rate
  • multiplier: Risk multiplier
  • rr: Return rate array
  • rf: Risk-free rate array

Development

Setup

  1. Clone the repository
  2. Create a virtual environment
  3. Install development dependencies:
    pip install -e ".[dev]"
    

Testing

pytest

Type Checking

mypy .

Code Style

black .
isort .

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and type checking
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyinsurance-2.0.0.tar.gz (203.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyinsurance-2.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (785.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pyinsurance-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (773.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

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

Hashes for pyinsurance-2.0.0.tar.gz
Algorithm Hash digest
SHA256 78c7ac589d79a373660afc389ccd5c434a5b194e14f5fecca9bb67eb1dd56445
MD5 1a874067bb3974f353030c51b3f2574f
BLAKE2b-256 2d489a9f9f37f972c8950442f492ac39e2377de77d2a70535db983101773bfde

See more details on using hashes here.

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

File hashes

Hashes for pyinsurance-2.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d05259d922b0b31ee9463438b6f21e03d4ec3c4b056dc2a7a26d97a493923320
MD5 b117ef56d1203ffefe9167e44b8fbc9b
BLAKE2b-256 6a6f46507b74062e99dbbf3cac3276185c7c1ac654bf070c48738c41f1d43f8b

See more details on using hashes here.

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

File hashes

Hashes for pyinsurance-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c3e66c3cd293097d6ffd26a89df578e7c1258af3dbdd0511067bce7d3cade0ce
MD5 d63243d89d85bb27741ab910a2798215
BLAKE2b-256 d88271aa1a55ce708a5196690afb3d31a49e82a3d974bceded70425ce728af1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page