Logo Search packages:      
Sourcecode: quantlib version File versions  Download package


Go to the documentation of this file.
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

 Copyright (C) 2008 Frank Hövermann

 This file is part of QuantLib, a free-software/open-source library
 for financial quantitative analysts and developers - http://quantlib.org/

 QuantLib is free software: you can redistribute it and/or modify it
 under the terms of the QuantLib license.  You should have received a
 copy of the license along with this program; if not, please email
 <quantlib-dev@lists.sf.net>. The license is also available online at

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.

/*! \file extendedblackvariancesurface.hpp
    \brief Black volatility surface modelled as variance surface

#ifndef quantlib_extended_black_variance_surface_hpp
#define quantlib_extended_black_variance_surface_hpp

#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
#include <ql/math/matrix.hpp>
#include <ql/math/interpolations/interpolation2d.hpp>
#include <ql/handle.hpp>
#include <ql/quote.hpp>

namespace QuantLib {

    //! Black volatility surface modelled as variance surface
    /*! This class is similar to BlackVarianceSurface, but extends it
        to use quotes for the input volatilities.
00039     class ExtendedBlackVarianceSurface : public BlackVarianceTermStructure {
        enum Extrapolation { ConstantExtrapolation,
                             InterpolatorDefaultExtrapolation };
                              const Date& referenceDate,
                              const Calendar& calendar,
                              const std::vector<Date>& dates,
                              const std::vector<Real>& strikes,
                              const std::vector<Handle<Quote> >& volatilities,
                              const DayCounter& dayCounter,
                              Extrapolation lowerExtrapolation =
                              Extrapolation upperExtrapolation =
00054         DayCounter dayCounter() const { return dayCounter_; }
00055         Date maxDate() const { return maxDate_; }
00056         Real minStrike() const { return strikes_.front(); }
00057         Real maxStrike() const { return strikes_.back(); }
        template <class Interpolator>
        void setInterpolation(const Interpolator& i = Interpolator()) {
            varianceSurface_ =
                i.interpolate(times_.begin(), times_.end(),
                              strikes_.begin(), strikes_.end(),
        void accept(AcyclicVisitor&);
        void update();
        Real blackVarianceImpl(Time t, Real strike) const;
        void setVariances();
        DayCounter dayCounter_;
        Date maxDate_;
        const std::vector<Handle<Quote> >& volatilities_;
        std::vector<Real> strikes_;
        std::vector<Time> times_;
        Matrix variances_;
        Interpolation2D varianceSurface_;
        Extrapolation lowerExtrapolation_, upperExtrapolation_;

    inline void ExtendedBlackVarianceSurface::accept(AcyclicVisitor& v) {
        Visitor<ExtendedBlackVarianceSurface>* v1 =
        if (v1 != 0)



Generated by  Doxygen 1.6.0   Back to index