Posted by
qlnewbie on
URL: http://quantlib.414.s1.nabble.com/GeometricBrownianMotionProcess-tp993.html
Hi all,
I am a newbie with QuantLib, so I try to do something easy.
I want to price a call, but my code doesn't work:
-----------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------
Date todaysDate(12, Jun, 2007);
Settings::instance().evaluationDate() = todaysDate;
//myStochasticProcess
Real spot=100.0;
Real riskFreeRate=0.05;
Real vol=0.2;
Date settlementDate(1, Jan,2008);
boost::shared_ptr<StochasticProcess> myStochasticProcess(new
GeometricBrownianMotionProcess(spot, riskFreeRate,vol));
//myStrikedTypePayoff
Option::Type type=Option::Call;
Real strike=100;
boost::shared_ptr<StrikedTypePayoff> myStrikedTypePayoff(new
PlainVanillaPayoff(type,strike));
//myExercise
Date maturity(1, Jan, 2010);
boost::shared_ptr<Exercise> myExercise(new EuropeanExercise(maturity));
//myEngine
boost::shared_ptr<PricingEngine> myEngine(new
AnalyticEuropeanEngine);EuropeanOption
myEuropeanOption(myStochasticProcess,myStrikedTypePayoff,myExercise,myEngine);
//myEuropeanOption.setPricingEngine(boost::shared_ptr<PricingEngine>(new
AnalyticEuropeanEngine));
cout<<"Price call : "<<myEuropeanOption.NPV()<<std::endl;
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
I get the error "date/time conversion not supported".
When I change GeometricBrownianMotionProcess into
BlackScholesMertonProcess it works.
What's wrong with GeometricBrownianMotionProcess ??
Thanks
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users