# Difference in implied volatility calculation

I've been using vollib to calculate IV, but my answers have been different by tenths from other sources like NASDAQ and Yahoo. The answers range +- 0.5, sometimes even more.
The inputs are: $S$ (float) – underlying asset price $K$ (float) – strike price $t$ (float) – time to expiration in years $r$ (float) – risk-free interest rate $q$ (float) – annualized continuous dividend rate

For $q$ I use $r=ln(1+\frac{D}{S})$, $D$ = annual dividend $S$ = spot price.

Any idea why this may happen?

• What is that ln(1+D/S) ? Shouldn't it be D/S-1 or ln(D/S) ? – onlyvix.blogspot.com Feb 22 '16 at 1:08

One possibility is to closely following the model-free estimate proposed by Demeter et al. (1999) and Carr and Madan (1998) who show that if one owns a portfolio of options across all strikes inversely weighted by the squared strike then one gets a variance exposure that does not depend on the price. The variance swap rate or implied volatility is approximated by: $$\sigma_{i,t,\tau}^2=\int_{S_i(t)}^{\infty}\frac{2\Big(1-\log[\frac{K}{S_i(t)}]\Big)}{K^2}C_i(t,\tau,K)dK+\int_{0}^{S_i(t)}\frac{2\Big(1-\log[\frac{K}{S_i(t)}]\Big)}{K^2}P_i(t,\tau,K)dK$$