43 blackVol_(QuantLib::ext::make_shared<SimpleQuote>(0.0)) {
44
45 QuantLib::ext::shared_ptr<PricingEngine> cdsEngine =
46 QuantLib::ext::make_shared<QuantExt::MidPointCdsEngine>(probability, recoveryRate, termStructure);
47
48 QuantLib::ext::shared_ptr<CreditDefaultSwap> tmp;
49 if (upfront == Null<Real>())
50 tmp = QuantLib::ext::shared_ptr<CreditDefaultSwap>(
51 new CreditDefaultSwap(side, 1.0, 0.02, schedule, paymentConvention, dayCounter, settlesAccrual,
52 protectionPaymentTime, protectionStart, claim));
53 else
54 tmp = QuantLib::ext::shared_ptr<CreditDefaultSwap>(
55 new CreditDefaultSwap(side, 1.0, upfront, 0.02, schedule, paymentConvention, dayCounter, settlesAccrual,
56 protectionPaymentTime, protectionStart, upfrontDate, claim));
57 tmp->setPricingEngine(cdsEngine);
58
59 Real strike = spread == Null<Real>() ? tmp->fairSpreadClean() : spread;
60 if (upfront == Null<Real>())
61 cds_ = QuantLib::ext::shared_ptr<CreditDefaultSwap>(
62 new CreditDefaultSwap(side, 1.0, strike, schedule, paymentConvention, dayCounter, settlesAccrual,
63 protectionPaymentTime, protectionStart, claim));
64 else
65 cds_ = QuantLib::ext::shared_ptr<CreditDefaultSwap>(
66 new CreditDefaultSwap(side, 1.0, upfront, strike, schedule, paymentConvention, dayCounter, settlesAccrual,
67 protectionPaymentTime, protectionStart, upfrontDate, claim));
68
69 cds_->setPricingEngine(cdsEngine);
70
71 QuantLib::ext::shared_ptr<Exercise> exercise = QuantLib::ext::make_shared<EuropeanExercise>(exerciseDate);
72
73 option_ = QuantLib::ext::make_shared<CdsOption>(
cds_, exercise,
true);
74 Handle<BlackVolTermStructure> h(
75 QuantLib::ext::make_shared<BlackConstantVol>(0, NullCalendar(), Handle<Quote>(
blackVol_), Actual365Fixed()));
76
77 blackEngine_ = QuantLib::ext::make_shared<BlackCdsOptionEngine>(
78 probability, recoveryRate, termStructure, Handle<CreditVolCurve>(QuantLib::ext::make_shared<CreditVolCurveWrapper>(h)));
79}
QuantLib::ext::shared_ptr< QuantExt::CdsOption > option_
QuantLib::ext::shared_ptr< CreditDefaultSwap > cds_
QuantLib::ext::shared_ptr< PricingEngine > blackEngine_
QuantLib::ext::shared_ptr< SimpleQuote > blackVol_
Handle< YieldTermStructure > termStructure_