Repository Public Research preview
1"""Exact option-implied asymmetry in the transition-jump model of Section 3.23Log exchange rate of currency i under Q over horizon tau:4 s_tau = (mu - sigma^2/2 - lam*psi) tau + sigma W_tau - x * N_tau, N ~ Poisson(lam*tau),5with a deterministic log depreciation x on each arrival (psi = exp(-x) - 1). Option prices are6Poisson mixtures of Garman-Kohlhagen prices (Merton 1976), so risk reversals and butterflies7can be computed exactly and compared with the cumulant approximation of Proposition 2.8"""9import numpy as np10from scipy.optimize import brentq11from scipy.stats import norm, poisson121314def bs_fwd(F, K, vol, tau, call=True):15 sd = vol * np.sqrt(tau)16 d1 = (np.log(F / K) + 0.5 * sd ** 2) / sd17 d2 = d1 - sd18 return F * norm.cdf(d1) - K * norm.cdf(d2) if call else K * norm.cdf(-d2) - F * norm.cdf(-d1)192021def price(K, sigma, lam, x, tau, call=True, nmax=40):22 """Undiscounted forward price of an option on S_tau/F_0 (forward normalised to 1)."""23 psi = np.exp(-x) - 1.024 n = np.arange(nmax)25 w = poisson.pmf(n, lam * tau)26 Fn = np.exp(-lam * psi * tau - n * x) # conditional forward given n jumps27 return float(np.sum(w * bs_fwd(Fn, K, sigma, tau, call)))282930def implied_vol(K, p, tau, call=True):31 return brentq(lambda v: bs_fwd(1.0, K, v, tau, call) - p, 1e-4, 5.0)323334def strike_for_delta(delta, sigma, lam, x, tau, call=True):35 """Strike whose Black forward delta (at its own implied vol) equals `delta` in absolute value."""36 def f(k):37 K = np.exp(k)38 iv = implied_vol(K, price(K, sigma, lam, x, tau, call), tau, call)39 d1 = (-k + 0.5 * iv ** 2 * tau) / (iv * np.sqrt(tau))40 return (norm.cdf(d1) if call else norm.cdf(-d1)) - delta41 lo, hi = (0.0, 1.5) if call else (-1.5, 0.0)42 return np.exp(brentq(f, lo, hi))434445def smile(sigma, lam, x, tau, delta=0.25):46 Kp = strike_for_delta(delta, sigma, lam, x, tau, call=False)47 Kc = strike_for_delta(delta, sigma, lam, x, tau, call=True)48 ivp = implied_vol(Kp, price(Kp, sigma, lam, x, tau, False), tau, False)49 ivc = implied_vol(Kc, price(Kc, sigma, lam, x, tau, True), tau, True)50 atm = implied_vol(1.0, price(1.0, sigma, lam, x, tau, True), tau, True)51 return dict(cr=ivp - ivc, bf=0.5 * (ivp + ivc) - atm, atm=atm)525354def dcr_dlam_exact(sigma, lam, x, tau, delta=0.25, h=1e-4):55 return (smile(sigma, lam + h, x, tau, delta)["cr"] - smile(sigma, max(lam - h, 0.0), x, tau, delta)["cr"]) / (h + min(h, lam))565758def dcr_dlam_approx(sigma, lam, x, tau, delta=0.25):59 """Proposition 2: CR = (z/3) lam x^3 / (v sqrt(tau)), v = sigma^2 + lam x^2 (annualised variance).6061 (The first draft carried sqrt(tau) in the numerator; corrected after the first review round.)"""62 z = norm.ppf(1 - delta)63 v = sigma ** 2 + lam * x ** 264 return (z / 3) / np.sqrt(tau) * x ** 3 * (v - lam * x ** 2) / v ** 2656667if __name__ == "__main__":68 for tau in (1 / 12, 1.0):69 for x in (0.05, 0.10, 0.20):70 for lam in (0.0, 0.02, 0.10):71 e, a = dcr_dlam_exact(0.11, lam, x, tau), dcr_dlam_approx(0.11, lam, x, tau)72 print(f"tau={tau:.3f} x={x:.2f} lam={lam:.2f} exact dCR/dlam={e:.4f} approx={a:.4f} ratio={e/a:.2f}")73