Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Functions
blackswaptionenginedeltagamma.cpp File Reference
#include "toplevelfixture.hpp"
#include <boost/test/unit_test.hpp>
#include <qle/pricingengines/blackswaptionenginedeltagamma.hpp>
#include <ql/indexes/ibor/euribor.hpp>
#include <ql/instruments/makevanillaswap.hpp>
#include <ql/pricingengines/swaption/blackswaptionengine.hpp>
#include <ql/quotes/simplequote.hpp>
#include <ql/termstructures/yield/flatforward.hpp>
#include <ql/termstructures/yield/piecewisezerospreadedtermstructure.hpp>
#include <boost/make_shared.hpp>
#include <boost/timer/timer.hpp>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (testNpvDeltasGammaVegas)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( testNpvDeltasGammaVegas  )

Definition at line 342 of file blackswaptionenginedeltagamma.cpp.

342 {
343
344 TestData d;
345
346 QuantLib::ext::shared_ptr<PricingEngine> engineLn0 =
347 QuantLib::ext::make_shared<BlackSwaptionEngine>(d.discountCurve, Handle<Quote>(d.lnVol));
348 QuantLib::ext::shared_ptr<PricingEngine> engineSln0 =
349 QuantLib::ext::make_shared<BlackSwaptionEngine>(d.discountCurve, Handle<Quote>(d.slnVol), Actual365Fixed(), d.slnShift);
350 QuantLib::ext::shared_ptr<PricingEngine> engineN0 =
351 QuantLib::ext::make_shared<BachelierSwaptionEngine>(d.discountCurve, Handle<Quote>(d.nVol));
352
353 QuantLib::ext::shared_ptr<PricingEngine> engineLn =
354 QuantLib::ext::make_shared<BlackSwaptionEngineDeltaGamma>(d.discountCurve, Handle<Quote>(d.lnVol), Actual365Fixed(),
355 0.0, d.pillarTimes, d.pillarTimes, d.pillarTimes, true, true);
356 QuantLib::ext::shared_ptr<PricingEngine> engineSln = QuantLib::ext::make_shared<BlackSwaptionEngineDeltaGamma>(
357 d.discountCurve, Handle<Quote>(d.slnVol), Actual365Fixed(), d.slnShift, d.pillarTimes, d.pillarTimes,
358 d.pillarTimes, true, true);
359 QuantLib::ext::shared_ptr<PricingEngine> engineN =
360 QuantLib::ext::make_shared<BachelierSwaptionEngineDeltaGamma>(d.discountCurve, Handle<Quote>(d.nVol), Actual365Fixed(),
361 d.pillarTimes, d.pillarTimes, d.pillarTimes, true, true);
362
363 performTest(d, engineLn0, engineLn, false, 0.0, "lognormal model, payer");
364 performTest(d, engineSln0, engineSln, false, 0.0, "shifted lognormal model, payer");
365 performTest(d, engineN0, engineN, false, 0.0, "normal model, payer");
366
367 performTest(d, engineLn0, engineLn, true, 0.0, "lognormal model, receiver");
368 performTest(d, engineSln0, engineSln, true, 0.0, "shifted lognormal model, receiver");
369 performTest(d, engineN0, engineN, true, 0.0, "normal model, receiver");
370
371 // the tests with non-zero spread fail, fix it later in the engine, for now we check for zero spreads there
372
373 // performTest(d, engineLn0, engineLn, false, 0.01, "lognormal model, payer, spread");
374 // performTest(d, engineSln0, engineSln, false, 0.01, "shifted lognormal model, payer, spread");
375 // performTest(d, engineN0, engineN, false, 0.01, "normal model, payer, spread");
376
377 // performTest(d, engineLn0, engineLn, true, 0.01, "lognormal model, receiver, spread");
378 // performTest(d, engineSln0, engineSln, true, 0.01, "shifted lognormal model, receiver, spread");
379 // performTest(d, engineN0, engineN, true, 0.01, "normal model, receiver, spread");
380
381 BOOST_CHECK(true);
382}