選項
AmericanOptionImpliedVolatility - QuantLib/R 中的根不在括號內的問題
我正在嘗試計算隱含波動率——我正在嘗試匹配我在雅虎財經中看到的真實數據,該數據顯示 IV 約為 27%。我在“R”中呼叫相同的參數會返回一個根未括起來的錯誤——任何人都可以幫忙嗎?
樣本:
> 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]
這是一個簡單的根查找器,如果你給它不可能的起始值……那麼它就會失敗。在這裡,您可以使用這些值,它似乎限制在 5 美元,而您從 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>
也許你有罷工和潛在的混淆?
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>