23#include <ql/pricingengines/blackformula.hpp>
25#include <boost/make_shared.hpp>
26#include <boost/test/unit_test.hpp>
30using namespace boost::unit_test_framework;
34BOOST_AUTO_TEST_SUITE(ExactBachelierImpliedVolatilityTest)
38 BOOST_TEST_MESSAGE(
"Testing exact Bachelier implied volatility...");
40 Real tolerance = 1E-4;
43 for (Real strikeSpread = -0.10; strikeSpread < 0.10 + 1E-5; strikeSpread += 0.001) {
44 Real strike = forward + strikeSpread;
45 for (Real vol = 0.0; vol < 0.02 + 1E-5; vol += 0.001) {
46 for (Real tte = 0.001; tte < 51.0; tte += 0.1) {
47 Real stdDev = std::sqrt(tte) * vol;
48 Real call = bachelierBlackFormula(Option::Call, strike, forward, stdDev);
49 Real put = bachelierBlackFormula(Option::Put, strike, forward, stdDev);
50 if (std::abs(call) < 1E-12 || std::abs(put) < 1E-12)
54 BOOST_CHECK_CLOSE(vol, impliedVolCall, tolerance);
55 BOOST_CHECK_CLOSE(vol, impliedVolPut, tolerance);
61BOOST_AUTO_TEST_SUITE_END()
63BOOST_AUTO_TEST_SUITE_END()
implied bachelier volatility based on Jaeckel, Implied Normal Volatility, 2017
Real exactBachelierImpliedVolatility(Option::Type optionType, Real strike, Real forward, Real tte, Real bachelierPrice, Real discount)
BOOST_AUTO_TEST_CASE(testExactBachelierImpliedVolatility)
Fixture that can be used at top level.