Skip to content

feat(american-option): log-spot Dynamic Chebyshev variant (Stage F1 front-fixing)#228

Merged
0xC000005 merged 3 commits into
mainfrom
feature/log-spot-dynamic-chebyshev
Jun 7, 2026
Merged

feat(american-option): log-spot Dynamic Chebyshev variant (Stage F1 front-fixing)#228
0xC000005 merged 3 commits into
mainfrom
feature/log-spot-dynamic-chebyshev

Conversation

@0xC000005

@0xC000005 0xC000005 commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #227 (base = feature/american-boundary-split). Stage F1 of the front-fixing track: a default-off LogSpot build option that interpolates the continuation in x = log(S) instead of linear Sand it retires the naive BoundarySplit experiment from #227 now that log-spot supersedes it.

This answers the open question from #227's negative result: the boundary Gamma error was resolution-limited, not intrinsic.

Why log-spot

The GBM transition S' = S·exp(drift + √2·σ√dt·z) becomes additive in x = log(S): x' = x + drift + √2·σ√dt·z. So the Gauss–Hermite images stay bounded, and the grid is narrow ([log5, log250], ~24× tighter span) and uniform-in-x, hence far better conditioned than the wide linear [5,250] grid.

Measured (StandardPut, oracle Γ(82) = 0.033689)

n linear Γ(82) err log-spot Γ(82) err linear status
81 0.007993 0.009807 ok
161 0.033689 (Γ→0, spot 82 in exercise region) 0.005922 ok-but-wrong
321 NaN 0.002755 throws
  • Robustness: log-spot is finite at n=321 where the linear build throws "function returned non-finite values".
  • Accuracy: the spot-82 Gamma error converges monotonically (0.0098 → 0.0059 → 0.0028), more than halving it. Honest caveat: at low n=81 log-spot trails linear near the boundary, where its Type-I nodes cluster at the domain ends.

This makes the heavyweight F2 (boundary-tracked Landau transform) optional.

Also retires the BoundarySplit experiment (from #227)

Now that log-spot is the real boundary-aware path, this PR retires the naive BoundarySplit flag — it split a smooth continuation at a non-singularity and only relocated the Gamma query onto the ill-conditioned piece edge (non-physical negative Gamma).

  • Removed: the flag, the split branch, BuildContinuationSpline/EvaluateSpline, dead plumbing, and the two split tests.
  • Kept: FindExerciseBoundary (Brent, reusable) + its test (renamed AmericanOptionBoundaryFinderTests).
  • Docs: the negative-result section keeps the finding and now shows the concrete global-vs-split Gamma-ringing table (evidence preserved without shipping the footgun); fixed a stale "quadrature overflow" → "high-n grid ill-conditioning".

Net: published main (after the stack merges) gets the log-spot fix and the documented lesson, not the broken flag.

Implementation

  • LogSpot flag (default off); the OFF path is bit-identical (additive branch — regression-locked).
  • Greeks by chain rule from u(x) = V(e^x): Δ = u'(x)/S, Γ = (u''(x) − u'(x))/S² (the −u' term is required).
  • Keeps per-step 8-pt Gauss–Hermite (scope-fence preserved).

Tests / gates

OFF bit-identical lock; log-spot ATM price vs oracle; chain-rule Greeks vs linear baseline; finite-at-high-n where linear throws; spot-82 Gamma convergence measurement; boundary-finder test. Full suite 1804 passed, dotnet format clean, docfx 0/0.

Sequencing

Stacked on #227. Merge order: #226#227 → this. GitHub retargets this to main once #227 merges.

🤖 Generated with Claude Code

0xC000005 and others added 2 commits June 6, 2026 00:02
…ront-fixing)

Add a default-off LogSpot build option that interpolates the continuation in x = log(S) instead of linear S. The GBM transition is additive in x, so the Gauss-Hermite images stay bounded, and the narrow uniform-in-x grid is far better conditioned than the wide linear [5,250] grid at high node counts.

Two measured wins vs the linear grid (StandardPut, oracle Gamma(82)=0.033689): (1) Robustness - log-spot stays finite at n=321 where the linear build throws 'function returned non-finite values', and at n=161 the linear spot-82 row wrongly collapses into the exercise region (Gamma 0) while log-spot gives 0.027767. (2) Accuracy - the spot-82 Gamma error converges monotonically with n (0.009807 -> 0.005922 -> 0.002755), more than halving it, so the boundary Gamma error was resolution-limited, not intrinsic. At low n=81 log-spot is marginally behind linear near the boundary, where its nodes cluster at the domain ends.

Greeks use the chain rule from u(x)=V(e^x): Delta = u'(x)/S, Gamma = (u''-u')/S^2 (the -u' term is required). The OFF path is bit-identical (additive branch; existing linear code verbatim in the else arm). This recovers most of the boundary Gamma without the heavyweight boundary-tracking (Landau) re-architecture, now optional.

Docs: case-study subsection 'A log-spot variant recovers the boundary Gamma'. Tests: OFF bit-identical lock; log-spot ATM price vs oracle; chain-rule Greeks vs linear baseline; finite-at-high-n where linear throws; spot-82 Gamma convergence measurement.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…the boundary finder

Now that the log-spot variant is the real boundary-aware path, retire the naive BoundarySplit flag. It splits a smooth continuation at a non-singularity and only relocates the Gamma query onto the ill-conditioned Chebyshev piece edge (non-physical negative Gamma). The documented finding stays in the case study; the reusable FindExerciseBoundary (Math.NET Brent) is kept.

Removed: the BoundarySplit settings flag, the split branch in Build, BuildContinuationSpline, EvaluateSpline, the now-unused firstContinuationFunction/firstFunc plumbing, and the two split-specific tests.

Kept: FindExerciseBoundary + its test (renamed AmericanOptionBoundaryFinderTests). Docs: added the concrete global-vs-split Gamma-ringing table to the negative-result note (preserving the evidence now that the runnable flag is gone), and fixed the high-n failure description (ill-conditioning of the wide grid, not quadrature overflow).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@0xC000005 0xC000005 changed the base branch from feature/american-boundary-split to main June 7, 2026 18:36
@0xC000005 0xC000005 enabled auto-merge June 7, 2026 18:37
@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...AmericanOptionDynamicChebyshev/DynamicChebyshev.cs 95.00% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@0xC000005 0xC000005 merged commit b8480b5 into main Jun 7, 2026
6 checks passed
@0xC000005 0xC000005 deleted the feature/log-spot-dynamic-chebyshev branch June 7, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant