Usage for StochProcess

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

Usage for StochProcess

Krupakar Manukonda
Hi,
 
I am relatively new for Quantlib/Boost .
 
To start with, I am trying to test EuropeanOption by creating a new project.
 
Is there any wrong with the declaration of stochProcess?
 
Could someone please help me with this?
 
Regards,
Krupakar
 

boost::shared_ptr<GeneralizedBlackScholesProcess> stochProcess(

new BlackScholesMertonProcess(Handle<SimpleQuote>(spot),

Handle<YieldTermStructure>(qTS),

Handle<YieldTermStructure>(rTS),

Handle<BlackVolTermStructure>(vol)));

 

I get the following error:

error C2440: '<function-style-cast>' : cannot convert from 'boost::shared_ptr<T>' to 'QuantLib::Handle<T>'

1> with

1> [

1> T=QuantLib::SimpleQuote

1> ]

1> and

1> [

1> T=QuantLib::BlackVolTermStructure

1> ]

1> No constructor could take the source type, or constructor overload resolution was ambiguous

 

 


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Usage for StochProcess

animesh
I am not sure what spot, qTS and rTS variables are in your code, but I think you have used double types or something like that. They are actually classes.
See the code below. Hope this helps.....


Calendar calendar = TARGET();
Date todaysDate(9, Jan, 2010);
Date settlementDate(9, Jan, 2011);
Settings::instance().evaluationDate() = todaysDate;
Option::Type type(Option::Call);
Real underlying = 99;
Real strike = 100;
Spread dividendYield = 0.00;
Rate riskFreeRate = 0.06;
Volatility volatility = 0.20;
Date maturity(9, Jan, 2011);
DayCounter dcounter = Actual365Fixed();



Handle<Quote> spot(boost::shared_ptr<Quote>(new SimpleQuote(underlying)));
Handle<YieldTermStructure> qTS(
                               boost::shared_ptr<YieldTermStructure>(
                                                                     new FlatForward(settlementDate, dividendYield, dcounter)));

Handle<YieldTermStructure> rTS(
                               boost::shared_ptr<YieldTermStructure>(
                                                                     new FlatForward(settlementDate, riskFreeRate, dcounter)));
Handle<BlackVolTermStructure> vol(
                                  boost::shared_ptr<BlackVolTermStructure>(
                                                                           new BlackConstantVol(settlementDate, calendar, volatility,
                                                                                                dayCounter)));


boost::shared_ptr<GeneralizedBlackScholesProcess> stochProcess(
                                                              
                                                               new BlackScholesMertonProcess(spot,
                                                                                             qTS,
                                                                                             
                                                                                             rTS,
                                                                                             
                                                                                             vol));


On 7/15/10 12:51 AM, Krupakar Manukonda wrote:
Hi,
 
I am relatively new for Quantlib/Boost .
 
To start with, I am trying to test EuropeanOption by creating a new project.
 
Is there any wrong with the declaration of stochProcess?
 
Could someone please help me with this?
 
Regards,
Krupakar
 

boost::shared_ptr<GeneralizedBlackScholesProcess> stochProcess(

new BlackScholesMertonProcess(Handle<SimpleQuote>(spot),

Handle<YieldTermStructure>(qTS),

Handle<YieldTermStructure>(rTS),

Handle<BlackVolTermStructure>(vol)));

 

I get the following error:

error C2440: '<function-style-cast>' : cannot convert from 'boost::shared_ptr<T>' to 'QuantLib::Handle<T>'

1> with

1> [

1> T=QuantLib::SimpleQuote

1> ]

1> and

1> [

1> T=QuantLib::BlackVolTermStructure

1> ]

1> No constructor could take the source type, or constructor overload resolution was ambiguous

 

 

------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users

-- 
Regards,
Animesh Saxena

(http://quantanalysis.wordpress.com)

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users