Risk model v2 liquidation kernel — pure compute, no DB access
Project description
risk-kernel
The risk model v2 liquidation-simulation kernel as a standalone package —
pure compute (numpy + stdlib), zero DB access, no write path. Powers the
on-demand LTV↔CRR estimator endpoint in core-api (office #490).
The kernel operates on in-memory PricePaths / SellOrderbook /
BorrowerPosition structures (risk_kernel.liquidator.types); loading those
inputs from a database is the consumer's job, never this package's.
Consumers
- core-api — installs this package from PyPI (
risk-kernel) and runs the kernel in-process for the estimator endpoint. - core — NOT hooked up yet, deliberately out of scope for now. core keeps
its own in-tree copy at
src/risk_model_v2/liquidator/and remains the production source of truth for kernel logic.
Source of truth & sync protocol
Until core itself consumes this package, this repo is a mirror of core's kernel, pinned to:
- source: blockanalitica/core
src/risk_model_v2/liquidator/ - commit:
c0bb2732e51cbb2338e0db5f49799088529e003c(main, 2026-07-03)
Kernel changes land in core first (production model), then get pulled here:
git -C ../core diff <pinned-commit>..main -- src/risk_model_v2/liquidator/
Apply the changes to src/risk_kernel/, bump the pin above and the package
version, then bump the pin in consumers. The divergences below are expected
diff noise; everything else must match, e.g.:
diff -r ../core/src/risk_model_v2/liquidator/ src/risk_kernel/liquidator/
There is no test guardrail — the pin is the only drift baseline.
Deliberate divergences from core (the ONLY ones allowed)
- Persistence stripped from
liquidator/pipeline/processors/liquidator.py: the_persist_market_crr/_persist_scenario_paths/_rewrite_market_crr_tiers/_prune_market_crr_snapshot24methods, their call sites insync(), therisk_model_v2.modelsimport block, and the imports only they used (asdict,timedelta,MARKET_CRR_SNAPSHOT24_RETENTION_DAYS,CapturedScenarioPaths,select_bands).sync()computes and returnsCRRSummaryobjects, nothing else.pipeline/scenario_paths.pyis unused after the strip but kept verbatim so the drift diff stays trivial. - Package renamed: core's
risk_model_v2.liquidator→risk_kernel.liquidator(mechanical import rewrite; tree structure is otherwise 1:1 so the diff above works). constants.pyis a 3-constant subset of core'ssrc/risk_model_v2/constants.py(FORECAST_STEP,N_MC,SEED) — the only values the kernel imports from outside the liquidator subtree.
Anything else diverging from core = drift = bug.
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 Distribution
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 balabs_risk_kernel-0.1.1.tar.gz.
File metadata
- Download URL: balabs_risk_kernel-0.1.1.tar.gz
- Upload date:
- Size: 36.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c601b35d22f845f09d25ffa04636d270005b8247e3144b4ba8aa70076f0f094
|
|
| MD5 |
b95e3d2135325361a279f586d08d671c
|
|
| BLAKE2b-256 |
81fd81eb7e0d9f90fbfa529d8d31846aec5d3fe0757495dede4a7398c46c839e
|
Provenance
The following attestation bundles were made for balabs_risk_kernel-0.1.1.tar.gz:
Publisher:
release.yml on blockanalitica/risk-kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
balabs_risk_kernel-0.1.1.tar.gz -
Subject digest:
5c601b35d22f845f09d25ffa04636d270005b8247e3144b4ba8aa70076f0f094 - Sigstore transparency entry: 2157884802
- Sigstore integration time:
-
Permalink:
blockanalitica/risk-kernel@bee504d5f74733787f71a7a5c7f906fc2794be78 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/blockanalitica
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bee504d5f74733787f71a7a5c7f906fc2794be78 -
Trigger Event:
push
-
Statement type:
File details
Details for the file balabs_risk_kernel-0.1.1-py3-none-any.whl.
File metadata
- Download URL: balabs_risk_kernel-0.1.1-py3-none-any.whl
- Upload date:
- Size: 41.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ed2a2fd2e6e50f04e625030835f053164cbfdee4ff36eef7b2325a0ebf1cbe4
|
|
| MD5 |
5fffe31a79bbddcd2171ab59c62117b0
|
|
| BLAKE2b-256 |
573d7361ad31edd77fedc1a11177f153c039b9156e79f826f33db43eac240cca
|
Provenance
The following attestation bundles were made for balabs_risk_kernel-0.1.1-py3-none-any.whl:
Publisher:
release.yml on blockanalitica/risk-kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
balabs_risk_kernel-0.1.1-py3-none-any.whl -
Subject digest:
1ed2a2fd2e6e50f04e625030835f053164cbfdee4ff36eef7b2325a0ebf1cbe4 - Sigstore transparency entry: 2157884859
- Sigstore integration time:
-
Permalink:
blockanalitica/risk-kernel@bee504d5f74733787f71a7a5c7f906fc2794be78 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/blockanalitica
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bee504d5f74733787f71a7a5c7f906fc2794be78 -
Trigger Event:
push
-
Statement type: