Go to Deriscope's documentation start page


The QuantLib MonteCarlo engine for VarianceSwap calculates the realized cummulative variance along each simulated path by accruing the vol of the process that generates the paths rather than the realized vol of the individual path.
The consequence is that all paths end up with the same realized variance, which means that a VarianceSwap with strike, let's say, 0.04 would give a zero price when priced with a market vol input of 0.2, which clearly makes no sense.
Note for the QuantLib developer:
The culprit seems to be located in file ql\pricingengines\forward\mcvarianceswapengine.hpp
In particular in the following function:
inline Real VariancePathPricer::operator()(const Path& path) const {
QL_REQUIRE(path.length() > 0, "the path cannot be empty");
Time t0 = path.timeGrid().front();
Time t = path.timeGrid().back();
Time dt = path.timeGrid().dt(0);
SegmentIntegral integrator(static_cast<Size>(t/dt));
detail::Integrand f(path, process_);
return integrator(f,t0,t)/t;
It so happens that the variable process_ passed as argument in the constructor of f above is the very same process that was used to generate the collection of paths on the first place (an element of which collection is the variable path above). A different input to the f constructor is required so that the integral will be computed correctly.

Click on
download to download an xml file that contains an Excel formula that demonstrates this issue.

You may then reproduce the issue in spreadsheet by clicking on Go -> Load Excel Formula from Text File or one of its variations and choose the xml file downloaded in the step above.