Skip to main content

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 Started tells you how to run the repository examples and what headline magnitudes to expect.
  • BCW2011 Case Study gives 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:

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 finhjb package 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-coder skill 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

finhjb-0.1.6.tar.gz (30.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

finhjb-0.1.6-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

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

Hashes for finhjb-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ef19f42d347d3c3f27dc2edf63dd4e81f0dab29bd88ca5288b6f30080b67fbed
MD5 227906d79fa69c7fb571a97b38cde0f2
BLAKE2b-256 8dd1f838587659aaacce49a1862e6add09340b6029637c0cf4003a7dccd28bac

See more details on using hashes here.

Provenance

The following attestation bundles were made for finhjb-0.1.6.tar.gz:

Publisher: python-publish.yml on Su-luoya/FinHJB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for finhjb-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 83b0bccbf97dac5662dfd2846ee095053ff0595c4b642d8c9a6bfd1c0d5cd5a1
MD5 a80fc6e781b610022e48b1f26a3ebf60
BLAKE2b-256 232682807d107b953fbcfd9098c13464fa250b59a1a9ec599ee7c0e89cf7c5da

See more details on using hashes here.

Provenance

The following attestation bundles were made for finhjb-0.1.6-py3-none-any.whl:

Publisher: python-publish.yml on Su-luoya/FinHJB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page