FinHJB
简体中文 README | Documentation | 中文文档
FinHJB is a Python library for solving one-dimensional Hamilton-Jacobi-Bellman (HJB) equations with JAX.
This repository also ships a Codex skill, finhjb-model-coder, for turning continuous-time finance models, LaTeX notes, and paper excerpts into executable one-dimensional FinHJB code.
Install
uv add finhjb
pip install finhjb
Installation defaults to CPU. If you want GPU support, install the appropriate JAX backend separately.
Choose Your Path
1. Use FinHJB as a Python library
Use this path if you already know the model you want to implement and want to work directly with the package API.
Start here:
2. Learn FinHJB through the BCW examples
Use this path if you want to understand the package by reproducing and adapting the repository's four BCW examples.
This BCW path is now formula-first rather than result-first:
Getting Startedtells you how to run the repository examples and what headline magnitudes to expect.BCW2011 Case Studygives the common homogeneity reduction and notation map.- the four walkthroughs are the main derivation-to-code bridge from BCW equations into
Parameter/Boundary/PolicyDict/Policy/Model. - the supported execution contract is repository-root execution, for example
uv run python src/example/BCW2011Liquidation.py.
Start here:
- Getting Started
- BCW2011 Case Study
- BCW2011 Liquidation Walkthrough
- BCW2011 Refinancing Walkthrough
- BCW2011 Hedging Walkthrough
- BCW2011 Credit Line Walkthrough
- Adapting BCW to Your Model
3. Use finhjb-model-coder
Use this path if you want Codex to read equations, paper notes, or LaTeX and turn them into FinHJB code.
Before asking for runnable code, confirm that the target Python environment can actually run finhjb.
Start here:
The finhjb-model-coder workflow expects Codex to:
- decide whether the model fits the current one-dimensional FinHJB interface
- confirm that the target Python environment can actually run
finhjb - confirm the derivative scheme and boundary-search method before code generation
- stop and confirm baseline calibration values when symbols are defined but usable numbers are not
- split the deliverable into solve, data, and plotting files when the task combines sensitivity analysis with plotting
- stop and confirm the missing derivation steps when the mathematics does not yet map directly into FinHJB code
- generate code, run a post-generation test loop, and repair failures before delivery
Repository Notes
- The published
finhjbpackage is the right choice for downstream projects. - The BCW example scripts in
src/example/are repository files. They are not included in the published wheel. - The repository BCW path now includes Case I liquidation, Case II refinancing, Case IV hedging, and Case V credit line examples.
- The BCW scripts are maintained for repository-root execution with imports from
src.example.... - The
finhjb-model-coderskill also lives in the repository, not in the published wheel.
Install the skill from a repository checkout with:
python scripts/install_skill.py
Useful variants:
python scripts/install_skill.py --dry-run
python scripts/install_skill.py --dest ~/.codex/skills --force
python scripts/install_skill.py --mode link --force
Documentation Map
Metadata
Release files for finhjb 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| finhjb-0.1.6.tar.gz | 30.4 kB | With provenance | Details for finhjb-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| finhjb-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for finhjb-0.1.6-py3-none-any.whl |
Total release size: 71.9 kB
Release files / finhjb-0.1.6.tar.gz
| Download URL | finhjb-0.1.6.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef19f42d347d3c3f27dc2edf63dd4e81f0dab29bd88ca5288b6f30080b67fbed
|
|
BLAKE2b-256 checksum How to use checksums |
8dd1f838587659aaacce49a1862e6add09340b6029637c0cf4003a7dccd28bac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 30, 2026.
Transparency logRelease files / finhjb-0.1.6-py3-none-any.whl
| Download URL | finhjb-0.1.6-py3-none-any.whl |
|---|---|
| Size | 41.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83b0bccbf97dac5662dfd2846ee095053ff0595c4b642d8c9a6bfd1c0d5cd5a1
|
|
BLAKE2b-256 checksum How to use checksums |
232682807d107b953fbcfd9098c13464fa250b59a1a9ec599ee7c0e89cf7c5da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 30, 2026.
Transparency logSecurity for finhjb 0.1.6
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
Both files in this release have been uploaded with provenance metadata.
Attestation for finhjb-0.1.6.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 Mar 30, 2026.
Transparency logA 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.