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. After ci.yml passes on main, release.yml runs python-semantic-release to create a tag and GitHub release, then dispatches publish.yml to build that tag and publish to PyPI with OIDC. Package versions come from Git tags; no version-bump commit is needed.
  3. Bump the pin in consumers (core, core-api pyproject.toml).

The PyPI trusted publisher for balabs-risk-kernel must authorize the publish.yml workflow. To retry a publish, manually run Publish with the existing release tag as its tag input.

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.1.0

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.1.0
File Size Uploaded Provenance Actions
balabs_risk_kernel-1.1.0.tar.gz 40.0 kB With provenance Details for balabs_risk_kernel-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 88.1 kB

Release files / balabs_risk_kernel-1.1.0.tar.gz

Download URL balabs_risk_kernel-1.1.0.tar.gz
Size 40.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c9c963d1faceb6d37cb7c816362e1bbb9b20851f89ad68e1bf5208dbb10d1ac5
BLAKE2b-256 checksum
How to use checksums
c98dd1f8fe9dfe9d19ec950ab26b84b33dfab5ad177439b608f49f5899bab7c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 28, 2026.

Transparency log

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

Download URL balabs_risk_kernel-1.1.0-py3-none-any.whl
Size 48.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7082b8207dddb95996a606cbfd676dcaf8df3b8e1b5e3179f70c9c55e0106a9e
BLAKE2b-256 checksum
How to use checksums
24f70a747b49466f9b634121d1ef6d35ba13d79c97795275b35e841f4c4e2a94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 28, 2026.

Transparency log

Security for balabs-risk-kernel 1.1.0

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.1.0.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 28, 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