Posted by
Luigi Ballabio on
Nov 06, 2010; 12:26pm
URL: http://quantlib.414.s1.nabble.com/using-quantlib-in-Matlab-tp9078p9079.html
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
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev