eddelbuettel / rquantlib

R interface to the QuantLib library
117 stars 50 forks source link

Unexpected behaviour with option pricing #10

Closed kismsu closed 9 years ago

kismsu commented 9 years ago

Hi, I's testing my own version of Black-Scholes using your package as a point of reference and noticed something strange.

maturity <- 1/365
underlying <- 111.205
strike <- 111
EuropeanOption("call", underlying = underlying , strike = strike, div = 0.0, 
                                riskFree = 0.0, maturity = maturity , vol =0.00001)

This is a call option with one day to expiry with no uncertainty and 0.205 intrinsic. The price should be 0.205, so it is

Concise summary of valuation for EuropeanOption 
  value   delta   gamma    vega   theta     rho  divRho 
 0.2050  1.0000  0.0000  0.0000  0.0000  0.3083 -0.3089 

But, if we have only 0.5 days left

maturity <- 0.5/365
underlying <- 111.205
strike <- 111
EuropeanOption("call", underlying = underlying , strike = strike, div = 0.0, 
                                riskFree = 0.0, maturity = maturity , vol =0.00001)

Price shouldn't change, but it does

Concise summary of valuation for EuropeanOption 
 value  delta  gamma   vega  theta    rho divRho 
     0      0      0      0      0      0      0

It looks like something going wrong with very small values of maturity. Any ideas?

eddelbuettel commented 9 years ago

It is a known shortcoming of QuantLib that dates are currently only 'whole days'. Two replacement proposals are being discusses to offer intraday times which would address.

eddelbuettel commented 8 years ago

This is now in the master branch of RQuantLib. It requires QuantLib (>= 1.7) with --enable-intraday.