Skip to content

Getting non-sense values for certain inputs using "Implied Volatility with the Newton-Raphson Method" #6

@ewmailing

Description

@ewmailing

Hello, I was just curious as to why I sometimes get non-sense values using your:
2021-03-29 Option Implied Volatility using Newton_s Method in Python

https://github.com/TheQuantPy/youtube-tutorials/blob/main/2021/001%20Jan-Mar/2021-03-29%20Option%20Implied%20Volatility%20using%20Newton_s%20Method%20in%20Python.ipynb

It usually gives pretty good values, but sometimes I do get non-sense values. So I thought I would provide a legitimate real-world value that is outputting non-sense.

I was looking at the TLT today, and stumbled upon some values that broke this.

The underlying price is $85.37.
The strike price is $75.00.
The time to expiration is .6767 (247 days / 365 days).
The interest rate is 0.043.
The market price is $11.73 for a call option.

According to the options chain from my brokerage, the implied volatility should be about 20% for this.

So modifying your workbook:

S0, K, T, r = 85.37, 75.00, 0.6767, 0.043
market_price = 11.73
implied_vol_est = implied_vol(S0, K, T, r, market_price, flag='c')
print("Implied Volatility is : ", round(implied_vol_est,2)*100, "%")

Produces the output:

Implied Volatility is :  nan %

<ipython-input-5-76ce81ec5ffe>:17: RuntimeWarning: divide by zero encountered in scalar divide
  vol_new = vol_old - C/Cprime

Tweaking the values a little bit to avoid the divide by zero, I still get non-sense values.

S0, K, T, r = 85.00, 75.00, 0.6767, 0.04
market_price = 11.73
implied_vol_est = implied_vol(S0, K, T, r, market_price, flag='c')
print("Implied Volatility is : ", round(implied_vol_est,2)*100, "%")

Produces the output:

Implied Volatility is :  -286.0 %

I'm curious if this is a bug, or if there are just some (legitimate) values that cause this technique to break-down and not work. And is there a fix for this?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions