General Topics
Markets
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# IV formula

Discussion in 'Options' started by newguy05, Oct 20, 2010.

1. ### newguy05

From my understanding brute force is a commonly used method to calculate IV if the option price is known. Is there anything wrong with the below method? price calculation is based on b&s model.

2) if A is within 0.05 difference of actual option price B, IV found
3) if A > B by more than 0.05, reduce IV to 90% and try again.
4) if A < B by more than 0.05, increase IV to 110% and try again.

For those of you who code, it's a simple recursive call.

double actualOptionPrice=10; //given

public double getIV(double iv)
{
double tempOptionPrice = calculateCall(iv);
double diff = tempOptionPrice - actualOptionPrice;
if(Math.abs(diff) <0.05) return iv;
else if (diff > 0) return getIV(iv*0.9);
else return getIV(iv*1.1); //if diff < 0

}

I did a bunch unit testing with different strikes, expiration, etc..they all worked correctly. Just wondering if anything i am missing with this approach.

4. ### newguy05

good to see you are still around dmo! that thread is exactly what i am looking for thanks.

bigaeon, i am looking for the formula not a pre-made solution, i know excel and matlab already has them.

5. ### slickpick

There typically* isn't a closed-form solution for IV, if that's what you're looking for.

The standard approach is to use a root finding procedure, Newton-Raphson is fast enough for most applications.

6. ### slickpick

I just took a look at the wilmott link and I suppose you would have ended the thread at at that if you had what you're looking for (I have no idea what your background is).

So here's some quick pseudocode to solving for IV with the N-R method. This is assuming you're using the BSM.

1. define accuracy as 'accuracy'
2. define a guess to IV as 'guess_vol'
3. define market price of option as 'market_price'
4. Create a loop
5. NR = guess_vol - (market_price-BSM(guess_vol))/vega
6. if abs(guess_vol - NR) < accuracy return NR
7. else guess_vol = NR

7. ### newguy05

i think that's close to what I posted in the first note, i guess those are the only methods. The performance wasnt really a big deal since I am only calculating the strikes i am interested in.

8. ### thenmmm

seems ok to me...though i am way too lazy now and lack the time to test the c++ code myself. Basically...you have 2...or 3 options:

1. bisection
2. newton's method
3...just use the 2-3 available online calculators for implied volatility .

I have used my own c# code (and still use it...), though please don't get too stuck up into implied volatility - it could be just something used to impress your managers in case you work somewhere...it won't hurt if you as well write a computer program to calculate the yearly historical volatility and the yearly "historically implied" volatility and of course the stochastic volatility under SABR. I have 2 such codes in c# and php- if you need them write here.

ET IS FREE BECAUSE OF THE FINANCIAL SUPPORT FROM THESE COMPANIES: