25#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
50 const Handle<BlackVolTermStructure>& vol2,
51 const Handle<CorrelationTermStructure>& rho,
const bool staticVol2 =
false)
52 : BlackVolatilityTermStructure(vol1->businessDayConvention(), vol1->dayCounter()),
vol1_(vol1),
vol2_(vol2),
57 enableExtrapolation(
vol1_->allowsExtrapolation() &&
vol2_->allowsExtrapolation());
67 void update()
override { notifyObservers(); }
72 Real
maxStrike()
const override {
return QL_MAX_REAL; }
76 virtual void accept(AcyclicVisitor&)
override;
80 Real c =
rho_->correlation(t);
81 Volatility v1 =
vol1_->blackVol(t, Null<Real>());
82 Real v2 = Null<Real>();
87 v2 =
vol2_->blackVol(t, Null<Real>());
91 v2 =
vol2_->blackVol(t, Null<Real>());
93 return std::sqrt(std::max(0.0, v1 * v1 + v2 * v2 - 2.0 * c * v1 * v2));
97 Handle<BlackVolTermStructure>
vol1_;
98 Handle<BlackVolTermStructure>
vol2_;
99 Handle<CorrelationTermStructure>
rho_;
106 Visitor<BlackTriangulationATMVolTermStructure>* v1 =
107 dynamic_cast<Visitor<BlackTriangulationATMVolTermStructure>*
>(&v);
111 BlackVolatilityTermStructure::accept(v);
Black volatility surface that implies an ATM vol based on triangulation.
virtual Volatility blackVolImpl(Time t, Real) const override
Calendar calendar() const override
Handle< BlackVolTermStructure > vol1_
BlackTriangulationATMVolTermStructure(const Handle< BlackVolTermStructure > &vol1, const Handle< BlackVolTermStructure > &vol2, const Handle< CorrelationTermStructure > &rho, const bool staticVol2=false)
Constructor takes two BlackVolTermStructure and a correlation.
const Date & referenceDate() const override
Real minStrike() const override
virtual void accept(AcyclicVisitor &) override
Natural settlementDays() const override
Date maxDate() const override
std::map< double, double > staticVolCache_
Real maxStrike() const override
Handle< CorrelationTermStructure > rho_
Handle< BlackVolTermStructure > vol2_
Term structure of correlations.