This is a Python library for solving Hamilton-Jacobi-Bellman (HJB) equations using JAX. It provides a framework for numerical solutions to dynamic optimization problems in finance and economics.
Project description
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
Project details
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 finhjb-0.1.6.tar.gz.
File metadata
- Download URL: finhjb-0.1.6.tar.gz
- Upload date:
- Size: 30.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef19f42d347d3c3f27dc2edf63dd4e81f0dab29bd88ca5288b6f30080b67fbed
|
|
| MD5 |
227906d79fa69c7fb571a97b38cde0f2
|
|
| BLAKE2b-256 |
8dd1f838587659aaacce49a1862e6add09340b6029637c0cf4003a7dccd28bac
|
Provenance
The following attestation bundles were made for finhjb-0.1.6.tar.gz:
Publisher:
python-publish.yml on Su-luoya/FinHJB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
finhjb-0.1.6.tar.gz -
Subject digest:
ef19f42d347d3c3f27dc2edf63dd4e81f0dab29bd88ca5288b6f30080b67fbed - Sigstore transparency entry: 1199439132
- Sigstore integration time:
-
Permalink:
Su-luoya/FinHJB@014d886146a5be48b55dc0ccc8f89137b1429eb6 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/Su-luoya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@014d886146a5be48b55dc0ccc8f89137b1429eb6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file finhjb-0.1.6-py3-none-any.whl.
File metadata
- Download URL: finhjb-0.1.6-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83b0bccbf97dac5662dfd2846ee095053ff0595c4b642d8c9a6bfd1c0d5cd5a1
|
|
| MD5 |
a80fc6e781b610022e48b1f26a3ebf60
|
|
| BLAKE2b-256 |
232682807d107b953fbcfd9098c13464fa250b59a1a9ec599ee7c0e89cf7c5da
|
Provenance
The following attestation bundles were made for finhjb-0.1.6-py3-none-any.whl:
Publisher:
python-publish.yml on Su-luoya/FinHJB
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
finhjb-0.1.6-py3-none-any.whl -
Subject digest:
83b0bccbf97dac5662dfd2846ee095053ff0595c4b642d8c9a6bfd1c0d5cd5a1 - Sigstore transparency entry: 1199439155
- Sigstore integration time:
-
Permalink:
Su-luoya/FinHJB@014d886146a5be48b55dc0ccc8f89137b1429eb6 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/Su-luoya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@014d886146a5be48b55dc0ccc8f89137b1429eb6 -
Trigger Event:
release
-
Statement type: