Skip to content

Fix dividends and volatility in AnalyticBlackVasicekEngine - #2927

Merged
lballabio merged 2 commits into
lballabio:masterfrom
mahimn01:fix-black-vasicek-engine
Oct 27, 2026
Merged

lballabio merged 2 commits into
lballabio:masterfrom
mahimn01:fix-black-vasicek-engine

Conversation

@mahimn01

Copy link
Copy Markdown
Contributor

AnalyticBlackVasicekEngine had two problems.

  1. It ignored the dividend yield. It used the spot price where the formula needs the spot discounted by the dividend curve to the exercise date, so options on dividend-paying underlyings were mispriced. With deterministic rates and a 3% dividend yield, a one-year ATM call came out at 10.4506 instead of the 8.6525 given by AnalyticEuropeanEngine.
  2. It read the Black volatility at time zero instead of at maturity. With a volatility curve going from 10% at three months to 20% at one year, the same call came out at 6.8050 instead of 10.4506.

The fix discounts the spot by the dividend curve to the exercise date and reads the volatility at the exercise date and strike.

There were no tests for this engine, so I added two to europeanoption.cpp:

  • With a vanishing Vasicek volatility the short rate stays constant, so the engine must match AnalyticEuropeanEngine for calls and puts at three strikes, with a flat and a term-structure volatility. The dividend yield is a quote that changes after the first pricing, which also checks that the engine is notified.
  • With stochastic rates, the price is checked against blackFormula using the model's closed-form total variance, for correlations of -0.5, 0 and 0.5.

Both tests fail before the change and pass after it.

Two notes. As before, the engine computes the time to maturity with the risk-free curve's day counter and assumes the volatility uses the same one. And since the volatility is now read at maturity, the usual range checks on the volatility term structure apply there, which the lookup at time zero never triggered.

@CLAassistant

CLAassistant commented Oct 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@boring-cyborg

boring-cyborg Bot commented Oct 21, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! It might take a while before we look at it, so don't worry if there seems to be no feedback. We'll get to it.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 79.441%. remained the same — mahimn01:fix-black-vasicek-engine into lballabio:master

@lballabio
lballabio enabled auto-merge October 27, 2026 17:30
@lballabio
lballabio merged commit 3b5ab86 into lballabio:master Oct 27, 2026
45 checks passed
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.

4 participants