-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call_iv() shouldn't panic if the implied volatility can't be found #2
Comments
call_iv()
shouldn't panic if the implied volatility can't be found
Thanks for bringing up this issue @dgbustos ! I've gone back and forth when considering the API for the implied volatility functions. With the "approximate_vol" function providing a value close to the optimum value I have not ever had a panic. In the tests I randomly simulate parameters; with no panics. Have you actually experienced a panic when using the implied volatility functions? If so, can you provide the parameters which resulted in the panic? Thanks! |
I have 500 examples from a recent file of SPY option quotes. They're all for deep-in-the-money calls. For example
When I encountered this in another library, I think I tracked the reason down to negative time value, and https://math.stackexchange.com/a/2959355 might be informative. |
That makes a lot of sense. I'll update the code (hopefully this weekend) and bump the crates version. |
In
call_iv()
, if there is no volatility which matches the price, thennrfind::find_root()
incall_iv_guess()
will returnResult.Err
andunwrap()
will panic.call_iv()
and the like should probably returnResult<f64>
instead off64
.The text was updated successfully, but these errors were encountered: