Skip to main content

risk-kernel

The risk model liquidation kernels as a standalone package — pure compute (numpy + stdlib), zero DB access, no write path. This package is the source of truth for kernel logic: both core and core-api install it and run the kernels in-process.

One model namespace plus one shared:

  • risk_kernel.common — model-version-neutral vocabulary shared by every consumer: the liquidator dataclass contract (BorrowerPosition, MarketDescriptor, MarketContext, PricePaths, SellOrderbook, CRRSummary, …) and slippage_for_amount.
  • risk_kernel.v3 — the v3 market-clearing kernel: clearing kernel, impact law, CRR stats, liquidation-wall curve math, FHS residuals/simulator. Entry points risk_kernel.v3.kernel.run_clearing_kernel / run_multi_asset_kernel on KernelInputs / MultiAssetKernelInputs.

The Laniakea concentration engine (risk_kernel.concentration, 0.3.0–0.7.x) moved into core in office #1329 (core ADR 0006): its September 2026 methodology is portfolio-dependent per position and reads history series at run time, so it no longer fits a pure-constants kernel.

Loading inputs from a database is the consumer's job, never this package's.

Consumers

Both install balabs-risk-kernel from PyPI and run the kernels in-process:

  • core — the production risk model. Consumes the pure kernel here and keeps only the impure orchestration in-tree (src/core_model/: datasources, pipelines, tasks, models, persistence, calibration). The pure compute modules were removed from core in office #553 — they live here now.
  • core-api — runs the kernels for the on-demand LTV↔CRR estimator endpoint (office #490 / #537).

Both pin an exact balabs-risk-kernel release in their pyproject.toml.

Change flow

Kernel logic changes land here first. Release, then bump consumers:

  1. Make the change in src/risk_kernel/.
  2. Merge with a conventional-commit message — release.yml runs python-semantic-release, which bumps the version and publishes to PyPI.
  3. Bump the pin in consumers (core, core-api pyproject.toml).

There is no per-model commit pin and no diff-against-core sync step: this repo no longer mirrors core. core is a consumer, not the origin.

What the package deliberately excludes

The kernels here are pure compute only — the impure layers that live in core (datasources, pipelines, persistence, tasks, calibration, forecasters, wall fetchers/sources) are intentionally not vendored.

Metadata

Release files for balabs-risk-kernel 1.0.1

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

Source distribution (sdist)

Source distribution for balabs-risk-kernel 1.0.1
File Size Uploaded Provenance Actions
balabs_risk_kernel-1.0.1.tar.gz 38.9 kB With provenance Details for balabs_risk_kernel-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for balabs-risk-kernel 1.0.1
File Interpreter ABI Platform Actions
balabs_risk_kernel-1.0.1-py3-none-any.whl Python 3 none any Details for balabs_risk_kernel-1.0.1-py3-none-any.whl

Total release size: 85.9 kB

Release files / balabs_risk_kernel-1.0.1.tar.gz

Download URL balabs_risk_kernel-1.0.1.tar.gz
Size 38.9 kB
Tags Source
SHA-256 checksum
How to use checksums
33beea51071de342ec4c0e5f986c53c937c37a9113a9652abdce99ce5c7c4ff4
BLAKE2b-256 checksum
How to use checksums
0ff2be714b29e8b2ccf5f35cf07d277751f29e72d6ae208e1c28ca4bcbd52f7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / balabs_risk_kernel-1.0.1-py3-none-any.whl

Download URL balabs_risk_kernel-1.0.1-py3-none-any.whl
Size 47.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71e71eb4a3760334ec10ab008ab838fdeacd902291e0e878d6effa91cd38b60f
BLAKE2b-256 checksum
How to use checksums
393826053d9c415570f93700248c2c3caf627413d57897e70c51a9839868ad89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for balabs-risk-kernel 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for balabs_risk_kernel-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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