Heston model - Monte Carlo simulation

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

Heston model - Monte Carlo simulation

gbogaert

Hello everyone,

 

I would like to evaluate the Heston model using a Monte Carlo simulation and get the values of the paths back, a kind of array [t, St], or better to get the average of the paths at certain dates. I went through the sources but I don’t see how to use the pricing engine for my purpose.

 

Does anyone have an idea to help me?

 

Thank you in advance and Have a nice weekend!

 

Regards,

 

Gilles

 

The information in this e-mail is confidential and may be legally privileged. It is intended
solely for the addressee. Access to this e-mail by anyone else is unauthorized. If you have 
received this communication in error, please address with the subject heading "Received in 
error," send back to the sender, then delete the e-mail and destroy any copies of it. If you 
are not the intended recipient, any disclosure, copying, distribution or any action taken or 
omitted to be taken in reliance on it, is prohibited and may be unlawful. Any opinions or 
advice contained in this e-mail are subject to the terms and conditions expressed in the 
governing KPMG client engagement letter. Opinions, conclusions and other information in this 
e-mail and any attachments that do not relate to the official business of the firm are 
neither given nor endorsed by it. KPMG cannot guarantee that e-mail communications are secure 
or error-free, as information could be intercepted, corrupted, amended, lost, destroyed, 
arrive late or incomplete, or contain viruses.
 
KPMG is the Luxembourg member firm of KPMG international. KPMG International is a Swiss 
cooperative that serves as a coordinating entity for a network of independent firms operating 
under the KPMG name. KPMG International provides no services to clients. Each member firm of 
KPMG International is a legally distinct and separate entity and each describes itself as 
such. Information about the structure and jurisdiction of your local KPMG member firm can be 
obtained from your KPMG representative.

This footnote also confirms that this e-mail message has been swept by AntiVirus software for 
the presence of computer viruses. However, the ultimate responsibility for virus checking 
lies with the recipient of this e-mail.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Heston model - Monte Carlo simulation

gbogaert
Hello Everyone,

The aim of what I described below would be to evaluate an autocallable bond which is described as following:

Issue Size;Notes;Par per Note;Trade Date;Strike Date (Index value);Issue/payment date;Final Valuation Date;Final Redemption Date;Denomination;Issue price per note;Calendar
10000000;10000;1000;24/01/2008;24/01/2008(3809.07);07/02/2008;24/01/2013;07/02/2013;1000;London and TARGET

Index/Underlying=STOXX50E;
Trigger Level=65% closing value at strike date;
Protection Level=100% closing value at strike date;

Auto-Call Dates;IF STOXX50E >= Strike level; Then change at Early Redemption Date; to Early Redemption Amount; Next action
26/01/2009; 100% x Protection Level = 3809.07;09/02/2009; 112% x Denomination; -> Notes terminated and no further payment shall be made
25/01/2010; 95% x Protection Level;          08/02/2010; 124% x Denomination; -> Notes terminated and no further payment shall be made
24/01/2011; 90% x Protection Level;          07/02/2011; 136% x Denomination; -> Notes terminated and no further payment shall be made
24/01/2012; 85% x Protection Level;          07/02/2012; 148% x Denomination; -> Notes terminated and no further payment shall be made

Auto-Call Dates;IF STOXX50E >= Trigger Level;Then change at  Redemption Date;to Redemption Amount
24/01/2013; 65% closing value at strike date; 07/02/2013; 160% x Denomination
               ; if NOT;                                    07/02/2013; 100% x (STOXX50E final / STOXX50E initial) x (100/65)

Evaluation date: 30/09/2009
Implied volatility:0.25667
Index value at evaluation date: 2872.63
Dividend: 0.033949938

To valuate it I thought of
1) Simulate a brownian motion
2) Evaluate at each auto-call dates le average of St

Someone has an idea?

Thank you in advance,

Regards,

Gilles
Reply | Threaded
Open this post in threaded view
|

LinkedIn Thread on QL

Bianchetti Marco-3
Check
http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&discussionI
D=9442895&gid=90917&trk=EML_anet_qa_ttle-0St79xs2RVr6JBpnsJt7dBpSBA

This e-mail is subject to terms available at the following link:
https://www.bancaimi.com/bimi/emaildisclaimer.jsf.
Please read the hyperlink carefully as it contains the conditions governing any electronic communications between you and Banca IMI SpA. By messaging with Banca IMI SpA you agree to such terms and conditions of use. Banca IMI SpA may amend these terms and conditions at any time without notice. You should check the relevant webpage from time to time to review the current terms and conditions because they are binding on you. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Please note that, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is strictly prohibited and may be unlawful.

Prima di stampare, pensa all'ambiente ** Think about the environment before printing

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Heston model - Monte Carlo simulation

Luigi Ballabio
In reply to this post by gbogaert
On Fri, 2009-11-06 at 18:19 +0100, Bogaert, Gilles wrote:
> I would like to evaluate the Heston model using a Monte Carlo
> simulation and get the values of the paths back, a kind of array [t,
> St], or better to get the average of the paths at certain dates. I
> went through the sources but I don’t see how to use the pricing engine
> for my purpose.

Gilles,
        you can use a MultiPathGenerator with a Heston process.  The class is
in <ql/methods/montecarlo/multipathgenerator.hpp>.
For an example, look at <test-suite/pathgenerator.cpp> (even though it
doesn't use Heston.) Let me know if you need additional help.

Luigi



--

Prediction is very difficult, especially if it's about the future.
-- Niels Bohr



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Heston model - Monte Carlo simulation

gbogaert
Hello Luigi,

Thank you for your advice. Could you give more detailed on the used of the MultiPath Generator? Is it not used for multiple assets?
In my case I have one asset. Based on the test-suite, I tried the PathGenerator class. From what I understood, a path is generated each time that generator.next() is called, isn't it? I called it several times (50,000x) and took the last value of the sample with sample.value.back() for each generation. I am then surprised that after relaunching my program several times I always get the same values and average.

   typedef PseudoRandom::rsg_type rsg_type;
   typedef PathGenerator<rsg_type>::sample_type sample_type;
   BigNatural seed = 42;
   Time length = 10;
   Size timeSteps = 12;
   bool brownianBridge = true;
   Handle<Quote> x0(boost::shared_ptr<Quote>(new SimpleQuote(100.0)));
   Handle<YieldTermStructure> r(flatRate(0.05, Actual360()));
   Handle<YieldTermStructure> q(flatRate(0.02, Actual360()));
   Handle<BlackVolTermStructure> sigma(flatVol(0.20, Actual360()));
   boost::shared_ptr<StochasticProcess1D> process (new BlackScholesMertonProcess(x0,q,r,sigma));
   rsg_type rsg = PseudoRandom::make_sequence_generator(timeSteps, seed);
   PathGenerator<rsg_type> generator(process, length, timeSteps,rsg, brownianBridge);
   for (Size i = 0; i <= 50000; i++){
      sample_type sample1 = generator.next();
      std::cout << sample1.value.at(j) << "\n";
   }

Thank you in advance for your help and time.

For any information, please ask.

Regards,

Gilles


Luigi Ballabio wrote
On Fri, 2009-11-06 at 18:19 +0100, Bogaert, Gilles wrote:
> I would like to evaluate the Heston model using a Monte Carlo
> simulation and get the values of the paths back, a kind of array [t,
> St], or better to get the average of the paths at certain dates. I
> went through the sources but I don’t see how to use the pricing engine
> for my purpose.

Gilles,
        you can use a MultiPathGenerator with a Heston process.  The class is
in <ql/methods/montecarlo/multipathgenerator.hpp>.
For an example, look at <test-suite/pathgenerator.cpp> (even though it
doesn't use Heston.) Let me know if you need additional help.

Luigi



--

Prediction is very difficult, especially if it's about the future.
-- Niels Bohr



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Heston model - Monte Carlo simulation

Luigi Ballabio
On Tue, 2009-11-17 at 03:24 -0800, gbogaert wrote:
> Thank you for your advice. Could you give more detailed on the used of the
> MultiPath Generator? Is it not used for multiple assets?

Not only that.  If you pass it the Heston model, it will generate
MultiPaths with two components. The first will be the path generated for
the underlying and the second the one for the volatility.

> In my case I have one asset. Based on the test-suite, I tried the
> PathGenerator class. From what I understood, a path is generated each time
> that generator.next() is called, isn't it? I called it several times
> (50,000x) and took the last value of the sample with sample.value.back() for
> each generation. I am then surprised that after relaunching my program
> several times I always get the same values and average.

That's because you're always feeding the generator the same seed:

>    BigNatural seed = 42;
>    [...]
>    rsg_type rsg = PseudoRandom::make_sequence_generator(timeSteps, seed);

If you want your program to use different feeds each time, set the seed
to 0.  But that will mean you might be unable to reproduce errors if
they arised.

Luigi


--

There are no rules of architecture for a castle in the clouds.
-- Gilbert K. Chesterton



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users