# AmericanOptionImpliedVolatility - root not bracketed issue in QuantLib/R

I'm trying to compute an implied volatility -- I am trying to match real data I see in Yahoo finance which shows an IV of about 27%. My call in 'R' for the same params returns a root not bracketed error -- can anyone help pls?

Sample:

> AmericanOptionImpliedVolatility(type="put", value=2.7,
underlying=55.0, strike=60, dividendYield=0.02, riskFreeRate=0.03,
maturity=0.02, volatility=0.2)

RESULT:
Error in americanOptionImpliedVolatilityEngine(type, value, underlying,
: root not bracketed: f[1e-07,4] -> [2.300000e+00,1.256782e+01]


It is a simple root finder, and if you give it impossible starting values... well then it fails. Here, you can play with the values and it seems bounded at USD 5 whereas you start from USD 2.7:

R> AmericanOption(type="put", underlying = 55, strike = 60,
+                 dividendYield = 0.02, riskFreeRate = 0.03,
+                 maturity = 0.02, volatility = 0.2)
Concise summary of valuation for AmericanOption
value  delta  gamma   vega  theta    rho divRho
5     NA     NA     NA     NA     NA     NA
R>


Maybe you had strike and underlying mixed up?

R> AmericanOptionImpliedVolatility(type="put", value=2.7,
+              underlying=60.0, strike=55.0, dividendYield=0.02,
+              riskFreeRate=0.03, maturity=0.02, volatility=0.2)
[1] 1.48203
attr(,"class")
[1] "AmericanOptionImpliedVolatility" "ImpliedVolatility"
R>

• Yes. There's no way that a put option with underlying at 55 and strike at 60 has a value of 2.7. It has to be worth at least 5, because that's what you would gain by exercising now. – Luigi Ballabio Jan 2 '16 at 22:04
• That helps -- thanks. But let's try to look at a specific example as I'm still stuck trying to match what Yahoo shows: code From Yahoo -- today -- an MSFT 40 PUT, for July 15, 2016 has the following (bid=0.38, ask=0.40) - IV = 31.86% code > AmericanOptionImpliedVolatility(type="put", value=0.39, underlying=55.48, strike=40, dividendYield=0.00, riskFreeRate=0.01, maturity=0.53, volatility=0.2) [1] 0.3224758 attr(,"class") ' So this matches. – nxstock-trader Jan 2 '16 at 22:25