---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-21-3132d7cfd66d> in <module>()
17
18 # get implied vol
---> 19 vol_imp = norm1.impvol(price, strike, spot, cp_sign=cp_sign)
20
21 # now price option with the obtained implied vol
C:\Users\jaehyuk\Documents\GitHub\SABRmodel_Base\option_models\normal.py in impvol(self, price_in, strike, spot, texp, cp_sign)
72 iv_func = lambda _vol: \
73 price(strike, forward, _vol, texp, cp_sign=cp_sign) - price_fwd
---> 74 vol = sopt.brentq(iv_func, 0, price_straddle*np.sqrt(np.pi/2/texp))
75 return vol
C:\sw\Anaconda3\lib\site-packages\scipy\optimize\zeros.py in brentq(f, a, b, args, xtol, rtol, maxiter, full_output, disp)
440 if rtol < _rtol:
441 raise ValueError("rtol too small (%g < %g)" % (rtol, _rtol))
--> 442 r = _zeros._brentq(f,a,b,xtol,rtol,maxiter,args,full_output,disp)
443 return results_c(full_output, r)
444
ValueError: f(a) and f(b) must have different signs