GeometricBrownianMotionProcess

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GeometricBrownianMotionProcess

qlnewbie
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
Reply | Threaded
Open this post in threaded view
|

Re: GeometricBrownianMotionProcess

Luigi Ballabio
On Tue, 2007-06-12 at 11:51 +0200, [hidden email] wrote:
> When I change GeometricBrownianMotionProcess into
> BlackScholesMertonProcess it works.
> What's wrong with GeometricBrownianMotionProcess ??

The error should be catched earlier and give a clearer message.
However, the European analytic engine implements the lognormal
Black-Scholes formula, so it requires a lognormal Black-Scholes process.
Other processes won't work (and it wouldn't make sense to plug them into
the formula anyway.)

Later,
        Luigi


----------------------------------------

Ninety percent of everything is crap.
--- Theodore Sturgeon



-------------------------------------------------------------------------
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