Repository navigation
Grow the FX digital Monte Carlo forward from the spot date to delivery - #494
Open
hereiszepedro wants to merge 2 commits into
Open
hereiszepedro wants to merge 2 commits into
hereiszepedro wants to merge 2 commits into
Conversation
FXDigitalOption.value builds the forward from the spot date to the delivery date and discounts the payment from delivery (FinancePy-Org#475). value_mc still measured time from the spot date to expiry, discounted over that shorter period as if it started today, and drifted the rate with the zero rates to expiry. With a spot lag the Monte Carlo price therefore did not converge to the analytic one: a digital call plus a digital put paying USD was worth 0.970685 instead of the 0.970366 discount factor to delivery. Use the same forward, discount factor and expiry time as value(). With spot_days=0, the default, the discounting is unchanged and prices on flat curves are identical.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#475 made
FXDigitalOption.valuegrow the forward from the spot date to the delivery date and discount the payment from delivery, asFXVanillaOptiondoes.value_mcwas left on the old convention: it measured time from the spot date to expiry, discounted over that shorter period as if it started today, and drifted the rate with the zero rates to expiry. So withspot_days > 0the Monte Carlo price does not converge to the analytic one.EURUSD, value 9 Mar 2026, expiry 8 Mar 2027, r_d = 3%, r_f = 5%, vol 12%, S = K = 1.10, 2,000,000 paths, MC minus analytic:
spot_daysThis change uses the same forward, delivery discount factor and expiry time in
value_mcas invalue. Withspot_days=0, the default, the discounting is unchanged and prices on flat curves are identical. The regression script does not callvalue_mc, so no golden log changes.The first commit adds a test that fails without the fix. A digital call plus a digital put at the same strike pays one unit for sure, so their Monte Carlo sum must equal the analytic sum. On master, the USD pair sums to 0.970685 instead of 0.970366, the discount factor to delivery.
AI-assisted (Claude Code). I checked the numbers above and ran the full unit suite locally.