New Member
Payback .. ;-)

Hi Andy and all the rest of the gang..

Many thanks for your thorough work. You've saved me A LOT of time and hassle in my quest for the Greeks formulas.

My 2 cents of payback is a small improvement on the Implied Volatility calculation. I had the feeling that the number of iteration in andy's code was relatively high for the desired accuracy (mostly around deozens and sometimes reaching out to the hundreds).

Thanks to Haug's "Complete Guide to Option Pricing Formulas" I found a slightly better algorithm which seems to do the work in no more than 5 iterations.

Attached you can find a snippet of C# code with the modified blsimpv(..) method. You can copy and paste it instead of the original one from Andy's code.




New Member
Dear Andy,

These codes are implied volitility of call. But could you please post your code that calculating the implied volitility of put ? I don't know how to code it right.

Please help! Thanks very much.

doug reich

Some guy
Jared: substitute blsput wherever you see blscall in the code royalbitbol posted and that should be it. (That is, in any code you have, use the Black Scholes price of the put in place of the BS price of the call to change from computing Call implied to put implied vol).

Andy Nguyen

If you go through my code and look at the blsimpv function, you will see I use blsCall to calculate the option price. The code is pretty trivial for anyone knowing programming.
I feel generous with my time today (it's Friday, after all) so I took out the code and make some simple changes that allow users to calculate implied vol for either put or call.
I also use the optimized code by Abitol above. All I did is add a new boolean para for my function.
How to use it?
First calculate put and call option prices as usual. Then when you go to the Implied Vol calculation page, there is a check box. If you select it, it will copy the values to calculate the implied vol for call. If you want to calculate the put value, then just uncheck the box, replace the value in the Option value box by the put option price calculate earlier.

The code is updated in the first post of this thread.

Andy Nguyen



New Member
hello i was testing your code, and i cannot figure out why the following inputs do not return an implied vol:
spot price: 7.6525
strk: 7.25
riskfree: 0.02
option value: 0.28250
maturity: 0.150685


New Member
Hi All, it looks like none of the attached documents can longer be downloaded (maybe too old?).
I'd be very interested in Andy's C# code if it could be made available again.