Reconciling American Option Prices Across R Packages
Summary
The document investigates why two R packages produce different values for an American call using the Barone-Adesi–Whaley approximation. The answers identify two interface issues: one function takes spot before strike while another expects strike before spot in the example, and the packages use different carry-related inputs. One parameter is cost of carry, while the other is dividend yield, which the answer relates to the risk-free rate and cost of carry.
After aligning the spot and strike arguments and translating the carry input to the dividend-yield convention, the reported prices become close. The comparison is useful as a reminder to check argument order and financial definitions before attributing disagreements to different numerical methods. The examples use one set of option inputs and one approximation, so they do not establish that the implementations agree across instruments, parameter ranges, or pricing engines.
Key ideas
- Confirm whether each pricing function expects spot and strike in the same argument order.
- Check whether a function expects cost of carry or dividend yield.
- The document relates dividend yield to the risk-free rate minus cost of carry.
- Aligning inputs produces close values in the presented American option example.
- The example does not establish agreement across other models or market conditions.
Tags
Full text
# The option values are different from two r package - foptions,rquantlib
# The option values are different from two r package - foptions,rquantlib
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
```
library(fOptions)
library(RQuantLib)
TypeFlag<-"c"
S<-530.32
X<-550
Time<-283/365
r<-0.000703
b<-0.05
sigma<-0.2442
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")
modelName<-c("fOptions.BAW","quantlib.BAW")
result <-cbind(modelName,
c(fOptions.BAW@price,quantlib.BAW[1]$value))
colnames(result)<-c("Model","Value")
```
## Answer by Dirk Eddelbuettel (score 8)
https://quant.stackexchange.com/a/21800
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
R>
```
## Answer by ZMatrix (score 2)
https://quant.stackexchange.com/a/21287
The prices should be 'really' close to each other. My result is:
```
>result
Model Value
[1,] "fOptions.BAW" "47.7630796321483"
[2,] "quantlib.BAW" "47.747504045402"
```
The reason is here we need to deal with three variables:
```
r (risk free rate), d (dividend yield), b (cost-of-carry rate).
```
and
```
d = r -b
```
The documentation of these two functions are: (look at the end of the first and third line)
```
BAWAmericanApproxOption(TypeFlag, S, X, Time, r, b,
sigma, title = NULL, description = NULL)
AmericanOption(type, underlying, strike, dividendYield, riskFreeRate,
maturity, volatility, timeSteps=150, gridPoints=149, engine="BaroneAdesiWhaley")
```
As you can see, one uses "r" and "b". The other uses "d" and "r".
A little modification (Just change "b" to "r-b") to the poster's code here will fix the problem.
```
library(fOptions)
library(RQuantLib)
TypeFlag<-"c"
S<-530.32
X<-550
Time<-283/365
r<-0.000703
b<-0.05
sigma<-0.2442
fOptions.BAW<-BAWAmericanApproxOption(TypeFlag, S, X, Time, r, b, sigma,
title = NULL, description = NULL)
quantlib.BAW<-AmericanOption("call", S, X,
r-b, r, Time, sigma,
timeSteps=150, gridPoints=149, engine="BaroneAdesiWhaley")
modelName<-c("fOptions.BAW","quantlib.BAW")
result <-cbind(modelName,
c(fOptions.BAW@price,quantlib.BAW[1]$value))
colnames(result)<-c("Model","Value")
```
The result will be the "47.76" and "47.74" I posted above.
Below is the answer that I wrote on Oct 18. I would keep it there.
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.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.