Sign up ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

The results are very different.I know the code from quantlib and the result of quantlib seem right(close to market price). Is there anyone know why the value from fOptions is so large or fOptions used different approach? Thank you



    fOptions.BAW<-BAWAmericanApproxOption(TypeFlag, S, X, Time, r, b, sigma,
                                          title = NULL, description = NULL)
    quantlib.BAW<-AmericanOption("call", S, X,
                                 b, r, Time, sigma,
                                 timeSteps=150, gridPoints=149, engine="BaroneAdesiWhaley")

    result <-cbind(modelName,

enter image description here

share|improve this question
The source code for both is available. Have you looked at it? – Joshua Ulrich Jun 13 '14 at 12:51
I already read the quantlib version (it can be found at github). I try to find the foptions source, but it wrote by fortran (which I don't understand). am i right or could you send me the link about foptions source code. Much obliged – galaxyan Jun 13 '14 at 14:34
Yes, it's in Fortran. You could compare the current version with archived versions of fOptions on CRAN. Maybe one of the older versions had a pure-R implementation. – Joshua Ulrich Jun 13 '14 at 15:06
@JoshuaUlrich thank you. – galaxyan Jun 13 '14 at 15:14

2 Answers 2

The price difference is so large -- that the only possible reason is that you have spot and strike confused between the two functions.

And indeed:

R> fOptions.BAW <- BAWAmericanApproxOption(TypeFlag, S, X, Time,
+                       r, b, sigma, title = NULL, description = NULL)
R> quantlib.BAW <- AmericanOption("call", X, S, b, r, Time, 
+                       sigma, timeSteps=150, gridPoints=149,
+                       engine="BaroneAdesiWhaley")
R> result <- c("fOptions"=fOptions.BAW@price,
+             "RQL"=quantlib.BAW$value)
R> result
fOptions      RQL 
 47.7631  47.5193 
share|improve this answer

In RQuantLib, the formula you are using should include "dividendYield" which is "r-b" instead of b (the annualized cost-of-carry rate)

quantlib.BAW<-AmericanOption(type = TypeFlag, underlying = S, strike = X, dividendYield = r - b, 
                  riskFreeRate = r, maturity = Time, volatility = sigma, engine="BaroneAdesiWhaley")

This will provide the same(similar) answer to fOptions.

share|improve this answer
No, that is in-line with the documentation and moves the price for me from 29.82 to 29.91. – Dirk Eddelbuettel Nov 18 at 12:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.