Chapter 4 Laboratory — Module 4: State Prices, Completeness, and Bounds¶

Mathematical Foundations of Modern Finance · Part I · Week 4

Four panels: extraction (rank, completeness, the set $\Psi$), dictionary ($\psi\to q\to m$, price three ways), bounds (sub/super-replication), and Hansen–Jagannathan. Reproduces the running example of Examples 4.8 and 4.10 exactly ($t=0.28$, super-rep 147.01).

Seeds: 20260401–20260404.

In [1]:
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams.update({"figure.figsize": (7, 4.2), "axes.grid": True,
                     "grid.alpha": 0.3, "font.size": 11})
BRASS, INK = "#B4884A", "#0F1E3D"
import mfmf_engine_ch04 as eng

E1 — The state-price segment and the stake's bounds (supports LOS 4.2–4.3)¶

Two assets, three states: the prices determine not a single $\psi$ but a segment of internally consistent state-price vectors. A non-replicable claim is priced only to an interval.

In [2]:
r1 = eng.E1_segment()
lo, hi = r1['t_range']
print(f"State-price segment: t in ({lo}, {hi})")
print(f"psi at t={lo}: {[round(x,4) for x in r1['psi_at_lo']]}")
print(f"psi at t={hi}: {[round(x,4) for x in r1['psi_at_hi']]}")
print(f"Stake bounds: sub={r1['stake_bounds']['sub']:.2f}, super={r1['stake_bounds']['super']:.2f}")
State-price segment: t in (0.1154, 0.4915)
psi at t=0.1154: [0.1154, 0.8461, 0.0]
psi at t=0.4915: [0.4915, -0.0001, 0.4702]
Stake bounds: sub=22.69, super=24.57

E2 — Completing the market (supports LOS 4.4)¶

A recession-linked claim paying $(50,20,0)$ quoted at 23.52 intersects the segment at the single point $t=0.28$: the market becomes complete and $\psi^\*$ is pinned.

In [3]:
r2 = eng.E2_complete()
print(f"Pinned t   : {r2['t']:.4f}   (book: 0.28)")
print(f"psi*       : {[round(x,4) for x in r2['psi_star']]}   (book: 0.28, 0.4758, 0.2058)")
print(f"q          : {[round(x,4) for x in r2['q']]}")
print(f"m          : {[round(x,4) for x in r2['m']]}")
print(f"Recession reprices to: {r2['recession_reprice']:.2f}   (quote: 23.52)")
Pinned t   : 0.2808   (book: 0.28)
psi*       : [0.2808, 0.474, 0.2068]   (book: 0.28, 0.4758, 0.2058)
q          : [0.292, 0.493, 0.2151]
m          : [1.1232, 0.948, 0.8272]
Recession reprices to: 23.52   (quote: 23.52)

E3 — Price the stake three ways (supports LOS 4.5)¶

With $\psi^\*$ pinned, the state-price, risk-neutral, and SDF valuations agree to the cent.

In [4]:
r3 = eng.E3_stake_three_ways()
for k, v in r3['prices'].items():
    print(f"{k:8s}: {v:.4f}")
by_psi  : 88.7600
by_q    : 88.7600
by_m    : 88.7600

E4 — The Hansen–Jagannathan bound (supports LOS 4.6)¶

Plot $(E[m], \sigma(m))$ against the wedge set by the maximal traded Sharpe ratio: $\sigma(m)/E[m] \ge$ max Sharpe.

In [5]:
r4 = eng.E4_hansen_jagannathan()
print(f"E[m]              : {r4['E_m']:.4f}")
print(f"sigma(m)          : {r4['sigma_m']:.4f}")
print(f"HJ ratio          : {r4['hj_ratio']:.4f}")
print(f"Max traded Sharpe : {r4['max_traded_sharpe']:.4f}")
print(f"Bound satisfied   : {r4['bound_satisfied']}")
E[m]              : 0.9616
sigma(m)          : 0.1055
HJ ratio          : 0.1097
Max traded Sharpe : 0.1097
Bound satisfied   : True

Validation checks¶

Every laboratory report must reproduce these; a report whose checks do not pass is returned ungraded.

In [6]:
checks = eng.validation_checks()
for k, v in checks.items():
    if k.startswith("_"): continue
    print(f"[{'PASS' if v else 'FAIL'}] {k}")
assert checks["ALL_PASS"], "Validation failed — do not submit."
print("\nAll Module validation checks pass.")
[PASS] V1_bond_prices
[PASS] V2_equity_prices
[PASS] V3_t_is_0.28
[PASS] V4_psi_star
[PASS] V5_q_star
[PASS] V6_recession_reprices
[PASS] ALL_PASS

All Module validation checks pass.