Hi Walter,
Wow. I don't think I ever got a RQuantLib bug report.
On 1 August 2010 at 18:08, Walter Eaves wrote:
| Hello Dirk,
|
| # Haug via Eddelbeutel doesn't match
|
| library(RQuantLib)
|
| BinaryOption("cash", "put", "european",
| underlying = 100,
| dividendYield = 0,
| riskFreeRate = 0.06,
| maturity = 0.75,
| strike=80,
| volatility=0.35,
| cashPayoff = 10);
|
| > BinaryOption("cash", "put", "european",
| + underlying = 100,
| + dividendYield = 0,
| + riskFreeRate = 0.06,
| + maturity = 0.75,
| + strike=80,
| + volatility=0.35,
| + cashPayoff = 10);
| Concise summary of valuation for BinaryOption
| value delta gamma vega theta rho divRho
| 2.2155 -0.0962 0.0033 8.6306 -1.3038 -8.8749 7.2132
|
| I checked QuantLib source and it references Haug with a value of 2.6710.
Yes, looking at QuantLib's code, the file test-suite/digitaloption.cpp has
DigitalOptionData values[] = {
// "Option pricing formulas", E.G. Haug, McGraw-Hill 1998 - pag 88
// type, strike, spot, q, r, t, vol, value, tol
{ Option::Put, 80.00, 100.0, 0.06, 0.06, 0.75, 0.35, 2.6710, 1e-4 }
};
Now, you sent in
> library(RQuantLib)
> BinaryOption("cash", "put", "european", underlying = 100, dividendYield = 0,
> riskFreeRate = 0.06, maturity = 0.75, strike=80, volatility=0.35, cashPayoff
> = 10)
Concise summary of valuation for BinaryOption
value delta gamma vega theta rho divRho
2.2155 -0.0962 0.0033 8.6306 -1.3038 -8.8749 7.2132
>
but the problem is that you have q=0 (div.yeild of zero) which the quotes
Huag example does not. If we correct that to
> BinaryOption("cash", "put", "european", underlying = 100, dividendYield =
> 0.06, riskFreeRate = 0.06, maturity = 0.75, strike=80, volatility=0.35,
> cashPayoff = 10)
Concise summary of valuation for BinaryOption
value delta gamma vega theta rho divRho
2.6710 -0.1061 0.0031 8.1539 -1.7423 -9.9577 7.9545
>
Things pan out as expected. So ... no bug as best as I can tell.
Thanks for your interest in RQuantLib. I appreciate the testing. If you are
interested in contributing more unit tests, I would welcome that and can show
you how to contribute.
Cheers, Dirk
|
| The "call" variant works.
|
| -- System Information:
| Debian Release: 5.0.5
| APT prefers stable
| APT policy: (700, 'stable'), (650, 'testing'), (600, 'unstable')
| Architecture: i386 (i686)
|
| Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
| Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
| Shell: /bin/sh linked to /bin/bash
|
| Versions of packages r-cran-rquantlib depends on:
| ii libc6 2.11.2-2 Embedded GNU C Library: Shared
lib
| ii libgcc1 1:4.3.2-1.1 GCC support library
| ii libquantlib-0.9.0 0.9.0.20071224-1 Quantitative Finance Library --
de
| ii libstdc++6 4.4.4-6 The GNU Standard C++ Library v3
| ii r-base-core 2.7.1-1+lenny1 GNU R core of statistical
computin
|
| r-cran-rquantlib recommends no packages.
|
| r-cran-rquantlib suggests no packages.
|
| -- no debconf information
|
|
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]