# Binary Option valuation problem in R using RQuantLib; also result validation aspect

When I am trying to value Binary Option using RQuantLib I am not getting all the greeks for exctype "american" wheras "european" exctype is fine. What is the problem here ?

boe<-BinaryOption(binType="asset", type="call", excType="european",
underlying=100, strike=100, dividendYield=0.02,
riskFreeRate=0.03, maturity=0.5, volatility=0.4, cashPayoff=10)
> boe
Concise summary of valuation for BinaryOption
value    delta    gamma     vega    theta      rho   divRho
55.7601   1.9365   0.0060  12.0652  -5.0897  68.9439  -96.8239

boa<-BinaryOption(binType="asset", type="put", excType="american",
underlying=100, strike=100, dividendYield=0.02,
riskFreeRate=0.03, maturity=0.5, volatility=0.4, cashPayoff=10)

> boa
Concise summary of valuation for BinaryOption
value    delta    gamma     vega    theta      rho   divRho
100.0000   0.4375   0.0032      NaN      NaN      NaN   NaN


My R version is R-3.0.2 64 bit, RQuantLib 0.4.0(latest),OS Windows 8. Could anyone please give me any other package or library to calculate Binary option in R.If at all nothing in R, Python is ok. Also how we can validate these results ? Will these show same value vis-a-vis Bloomberg/Thomson Reuter terminal ? Basically I want to know industry-standard way of validating the results.

• Write it yourself!? You can find plenty of help on stackoverflow as long as you break it into simplified problems and don't try to dump your goal all at once. – BAR Sep 23 '15 at 4:27

It is all in the code::

Rcpp::List rl =
Rcpp::List::create(Rcpp::Named("value") = opt.NPV(),
Rcpp::Named("delta") = opt.delta(),
Rcpp::Named("gamma") = opt.gamma(),
Rcpp::Named("vega") =
(excType=="european") ? opt.vega() : R_NaN,
Rcpp::Named("theta") =
(excType=="european") ? opt.theta() : R_NaN,
Rcpp::Named("rho") =
(excType=="european") ? opt.rho() : R_NaN,
Rcpp::Named("divRho") =
(excType=="european") ? opt.dividendRho() : R_NaN);


For American exercise, QuantLib simply does not provide analytical greeks, and the standard recommendation is to approximate these numerically.

Your question is not new; this comes up about once a year.

• If the Q is not new you should find a similar one and vote to close. – BAR Sep 23 '15 at 4:26
• I understand development part direction, basically some kind of closed-form approximation solution is needed – pmr Sep 23 '15 at 9:33
• @BAR: Sure. This isn't the only venue for RQuantLib questions. But next time we have one here we can now close and point to this one. – Dirk Eddelbuettel Sep 23 '15 at 10:58