快速开始#

这一页是一份 BCW 仓库示例的执行清单。环境准备好以后,先把四个脚本跑通,再去读后面的推导页,会更容易把数值对象和论文对象对起来。

目标很直接:在仓库根目录运行四个案例,并用一组 headline number 判断结果是否大体正常。

第一步:准备仓库环境#

在仓库根目录执行:

uv sync
uv run python -c "import finhjb as fjb; print(fjb.__all__[:5])"

如果你在无图形界面的环境里运行,再加上:

export MPLBACKEND=Agg

这套 BCW 脚本的正式使用方式,是在仓库根目录执行:

uv run python src/example/BCW2011Liquidation.py

而不是切到 src/example/ 里本地直跑。

第二步:运行 Case I#

MPLBACKEND=Agg uv run python src/example/BCW2011Liquidation.py

先看 w_bar 0.22p'(0) 30,以及低现金区域投资显著为负。

第三步:运行 Case II#

MPLBACKEND=Agg uv run python src/example/BCW2011Refinancing.py

先看:

  • phi=1%w_bar 0.19m 0.06

  • phi=0w_bar 0.14m 0

第四步:运行 Case IV#

MPLBACKEND=Agg uv run python src/example/BCW2011Hedging.py

对 costly-margin 那条线,先看 w_- 0.07w_+ 0.11w_bar 0.14,以及 psi 落在 [-5, 0]

第五步:运行 Case V#

MPLBACKEND=Agg uv run python src/example/BCW2011CreditLine.py

先看 w_bar 0.08c+m 0.10,以及有 credit line 时 p'(0) 大约在 1.01

第六步:带着目的读结果#

跑完以后,先看:

print(bundle["artifact_paths"])
print(bundle["results"])

如果你想直接看某个场景的求解结果:

result = bundle["results"]["fixed-cost"]
print(result["summary"])
print(result["grid"].df.head())
print(result["grid"].df.tail())

相关页面#

如果你想从论文公式一路追到 Parameter / Boundary / PolicyDict / Policy / Model,应该从这些 walkthrough 继续往下读。