Q:

Pricing Variance Swap

I want to calculate the NPV of a Variance Swap wherein the cash flow happens every months based on the standard Variance formula of the close prices of S&P500 for prior 30 business days. We may assume the strike as K.
Is there any standard formula for pricing this? As far as I know, the standard formula for Variance swaps assume continuous price during the life time of Swap.
I prefer to use QuantLib Python library for such valuation.
Any pointer will be highly appreciated.

A:

Your swap is essentially a few forward variance swaps grouped together and you are asking a single fair strike $K$ so that the payoff will be the same as the sum of the payoff of the forward variance swaps. Therefore $K^2 = \frac{\sum_{i=1}^{n}D_iK_i^2}{\sum_{i=1}^n D_i}$, where $K_i$ are the strikes of the individual forward var swaps and $D_i$ are the corresponding discounting factors.

