|
From: Luigi B. <lui...@gm...> - 2010-11-06 12:48:34
|
On Nov 6, 2010, at 12:02 AM, steven e. pav wrote: > I am trying to use the quantlib library from Matlab. As a test case, I > adapted the EquityOption.cpp example code from the quantlib webpage > to a cpp > file which would generate the price of an American Put option with > parameters > given by the user, using a few different pricing engines. Before > writing the > mex, I had created a standalone version which accepted input from > std::cin, and > this ran fine. > However, when I run the code from matlab, the results always come > back as 0. I > do not know a lot about the guts of quantlib, and the lazy > evaluation methods > being used. However, it seems that when I run the standalone, it > takes about 1 > second or so (there are some binomial lattice engines being used), > whereas when > I run the mex file from matlab, it returns zeros instantaneously. It sounds like the library thinks the instrument is expired and skips the calculation. Are you settings the evaluation date correctly? (Look for where Settings::instance().evaluationDate() is set in the standalone.) Luigi |