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.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.0.0
File Size Uploaded Provenance Actions
balabs_risk_kernel-1.0.0.tar.gz 38.9 kB With provenance Details for balabs_risk_kernel-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 85.8 kB

Release files / balabs_risk_kernel-1.0.0.tar.gz

Download URL balabs_risk_kernel-1.0.0.tar.gz
Size 38.9 kB
Tags Source
SHA-256 checksum
How to use checksums
76ed63e45b6115bb628d69095167c380934c869b1a4c26371423b25c2351a34b
BLAKE2b-256 checksum
How to use checksums
e0eaf0849d9b099f31c086579e7b84515f82ea671be9e3c9481822f4bc46b3a5
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 Sep 15, 2026.

Transparency log

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

Download URL balabs_risk_kernel-1.0.0-py3-none-any.whl
Size 46.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb157074957f5cc3307fa5060f1b1b9e555f6210ce07403188171c43a369f1ab
BLAKE2b-256 checksum
How to use checksums
4f099c179d88553732dc0b8358f29b4d1eb94f1c66ae61207a2984c479fd7a1b
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 Sep 15, 2026.

Transparency log

Security for balabs-risk-kernel 1.0.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.0.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 Sep 15, 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