# computeOptionWeights (3) - Linux Manuals

## computeOptionWeights: Variance-swap pricing engine using replicating cost,.

## NAME

QuantLib::ReplicatingVarianceSwapEngine - Variance-swap pricing engine using replicating cost,.

## SYNOPSIS

#include <ql/pricingengines/forward/replicatingvarianceswapengine.hpp>

Inherits **QuantLib::VarianceSwap::engine**.

### Public Types

typedef std::vector< std::pair< boost::shared_ptr< **StrikedTypePayoff** >, Real > > **weights_type**

### Public Member Functions

**ReplicatingVarianceSwapEngine** (const boost::shared_ptr< **GeneralizedBlackScholesProcess** > &process, Real dk=5.0, const std::vector< Real > &callStrikes=std::vector< Real >(), const std::vector< Real > &putStrikes=std::vector< Real >())

void **calculate** () const

### Protected Member Functions

void **computeOptionWeights** (const std::vector< Real > &, const Option::Type, weights_type &optionWeights) const

Real **computeLogPayoff** (const Real, const Real) const

Real **computeReplicatingPortfolio** (const weights_type &optionWeights) const

**Rate** **riskFreeRate** () const

**DiscountFactor** **riskFreeDiscount** () const

Real **underlying** () const

**Time** **residualTime** () const

## Detailed Description

Variance-swap pricing engine using replicating cost,.

as described in Demeterfi, Derman, Kamal & Zou, 'A Guide to Volatility and Variance Swaps', 1999

**Tests**

- returned variances verified against results from literature

## Author

Generated automatically by Doxygen for QuantLib from the source code.