Login  Register

Himalayan Option Worries

Posted by animesh on Aug 30, 2010; 8:27pm
URL: http://quantlib.414.s1.nabble.com/Himalayan-Option-Worries-tp6914.html

  Below is the sample code for Himalayan Option valuation. It works for
BlackScholes process but if I change it to slightly fancier
Merton76Process (Jumps), it throws out an ugly SIG ABORT exception. Can
anyone help me in figuring out the mistake. "Just copy paste the code
below to test it out".
Thanks in advance!

Date today = Settings::instance().evaluationDate();

     DayCounter dc = Actual360();
     std::vector<Date> fixingDates;
     for (Size i=0; i<5; ++i)
         fixingDates.push_back(today+i*90);

     Real strike = 100.0;
     HimalayaOption option(fixingDates, strike);

     Handle<YieldTermStructure> riskFreeRate(flatRate(today, 0.05, dc));

     std::vector<boost::shared_ptr<StochasticProcess1D> > processes(4);

     boost::shared_ptr<SimpleQuote> spot(new SimpleQuote(100));
     boost::shared_ptr<SimpleQuote> qRate(new SimpleQuote(0.01));
     boost::shared_ptr<YieldTermStructure> qTS = flatRate(today, qRate, dc);
     boost::shared_ptr<SimpleQuote> rRate(new SimpleQuote(0.05));
     boost::shared_ptr<YieldTermStructure> rTS = flatRate(today, rRate, dc);
     boost::shared_ptr<SimpleQuote> vol(new SimpleQuote(0.20));
     boost::shared_ptr<BlackVolTermStructure> volTS = flatVol(today,
vol, dc);


     boost::shared_ptr<SimpleQuote> jumpIntensity(new SimpleQuote(1));
     boost::shared_ptr<SimpleQuote> meanLogJump(new SimpleQuote(0.2));
     boost::shared_ptr<SimpleQuote> jumpVol(new SimpleQuote(0.2));

    processes[0]= boost::shared_ptr<StochasticProcess1D>(new
Merton76Process(Handle<Quote>(spot),Handle<YieldTermStructure>(qTS),Handle<YieldTermStructure>(rTS),Handle<BlackVolTermStructure>(volTS),Handle<Quote>(jumpIntensity),Handle<Quote>(meanLogJump),Handle<Quote>(jumpVol)));
     processes[1]= boost::shared_ptr<StochasticProcess1D>(new
Merton76Process(Handle<Quote>(spot),Handle<YieldTermStructure>(qTS),Handle<YieldTermStructure>(rTS),Handle<BlackVolTermStructure>(volTS),Handle<Quote>(jumpIntensity),Handle<Quote>(meanLogJump),Handle<Quote>(jumpVol)));
     processes[2]= boost::shared_ptr<StochasticProcess1D>(new
Merton76Process(Handle<Quote>(spot),Handle<YieldTermStructure>(qTS),Handle<YieldTermStructure>(rTS),Handle<BlackVolTermStructure>(volTS),Handle<Quote>(jumpIntensity),Handle<Quote>(meanLogJump),Handle<Quote>(jumpVol)));
     processes[3]= boost::shared_ptr<StochasticProcess1D>(new
Merton76Process(Handle<Quote>(spot),Handle<YieldTermStructure>(qTS),Handle<YieldTermStructure>(rTS),Handle<BlackVolTermStructure>(volTS),Handle<Quote>(jumpIntensity),Handle<Quote>(meanLogJump),Handle<Quote>(jumpVol)));



     Matrix correlation(4,4);
     correlation[0][1] = 0.29;
     correlation[0][2] = 0.29;
     correlation[0][3] = 0.39;
     correlation[1][0] = 0.49;
     correlation[1][2] = 0.59;
     correlation[1][3] = 0.69;

     correlation[2][2] = 0.19;
     correlation[2][3] = 0.29;

     correlation[3][0] = correlation[0][3];
     correlation[3][1] = correlation[1][3];
     correlation[3][2] = correlation[2][3];
     correlation[2][0] = correlation[0][2];
     correlation[2][1] = correlation[1][2];
     correlation[1][1] = 1.00;

     correlation[0][0] = 1.00;
     correlation[3][3] = 1.00;


     BigNatural seed = 42;
     int i_samples;
     i_samples = 4999;
     Size fixedSamples;
     boost::shared_ptr<StochasticProcessArray> process(new
StochasticProcessArray(processes, correlation));
     Real value;
     
option.setPricingEngine(MakeMCHimalayaEngine<PseudoRandom>(process).withSamples(fixedSamples).withSeed(seed));
     value = option.NPV();



--
Regards,
Animesh Saxena

(http://quantanalysis.wordpress.com)
Ph: (+91)9920098221


------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users