Posted by
rm-22 on
URL: http://quantlib.414.s1.nabble.com/Possible-bug-in-Examples-EquityOption-EquityOption-cpp-tp7982.html
When I slightly modify the example EquityOptions.cpp
as shown below, so that it calculates for Put and then Call,
then the results of the second (ie. Call) are incorrect/buggy
(see attached results).
What is causing this unexpected behaviour?
QuantLib/Examples/EquityOption/EquityOption.cpp :
...
int main(int, char* [])
{
for (int iType = 0; iType < 2; ++iType) // added
{ // added
try {
...
// our options
Option::Type type(iType == 0 ? Option::Put : Option::Call); // modified
...
std::cout << "StartDate = " << todaysDate << std::endl; // added
...
// return 0; // disabled
} // added
return 0; // added
}
// Output:
Option type = Put
StartDate = May 15th, 1998
Maturity = May 17th, 1999
Underlying price = 36
Strike = 40
Risk-free interest rate = 6.000000 %
Dividend yield = 0.000000 %
Volatility = 20.000000 %
Method European Bermudan American
Black-Scholes 3.844308 N/A N/A
Barone-Adesi/Whaley N/A N/A 4.459628
Bjerksund/Stensland N/A N/A 4.453064
Integral 3.844309 N/A N/A
Finite differences 3.844342 4.360807 4.486118
Binomial Jarrow-Rudd 3.844132 4.361174 4.486552
Binomial Cox-Ross-Rubinstein 3.843504 4.360861 4.486415
Additive equiprobabilities 3.836911 4.354455 4.480097
Binomial Trigeorgis 3.843557 4.360909 4.486461
Binomial Tian 3.844171 4.361176 4.486413
Binomial Leisen-Reimer 3.844308 4.360713 4.486076
Binomial Joshi 3.844308 4.360713 4.486076
MC (crude) 3.834522 N/A N/A
QMC (Sobol) 3.844613 N/A N/A
MC (Longstaff Schwartz) N/A N/A 4.481675
Run completed in 7 s
Option type = Call
StartDate = May 15th, 1998
Maturity = May 17th, 1999
Underlying price = 36
Strike = 40
Risk-free interest rate = 6 %
Dividend yield = 0 %
Volatility = 20 %
Method European Bermudan American
Black-Scholes 2 N/A N/A
Barone-Adesi/Whaley N/A N/A 2
Bjerksund/Stensland N/A N/A 2
Integral 2 N/A N/A
Finite differences 2 2 2
Binomial Jarrow-Rudd 2 2 2
Binomial Cox-Ross-Rubinstein 2 2 2
Additive equiprobabilities 2 2 2
Binomial Trigeorgis 2 2 2
Binomial Tian 2 2 2
Binomial Leisen-Reimer 2 2 2
Binomial Joshi 2 2 2
MC (crude) 2 N/A N/A
QMC (Sobol) 2 N/A N/A
MC (Longstaff Schwartz) N/A N/A 2
Run completed in 10 s
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users