Monte Carlo path generator

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

Monte Carlo path generator

deriv
Hy everybody, I'm trying to understand where the Monte Carlo method in QuantLib stores the simulated prices. I need to take them to plot all the simulated time series.
Any help?
Reply | Threaded
Open this post in threaded view
|

Re: Monte Carlo path generator

Luigi Ballabio
On Thu, 2010-07-01 at 06:17 -0700, deriv wrote:
> Hy everybody, I'm trying to understand where the Monte Carlo method in
> QuantLib stores the simulated prices. I need to take them to plot all the
> simulated time series.

It doesn't store them---paths are generated, passed to the path pricer
to yield a price, and discarded (see the MonteCarloModel::addSamples
method.)  if you want a one-off solution, insert some print statement in
the implementation of the PathPricer instance you're using.  For a
long-term solution, you'd have to modify the MonteCarloModel class.

Luigi


--

Newton's Law of Gravitation:
What goes up must come down. But don't expect it to come down
where you can find it. Murphy's Law applies to Newton's.



------------------------------------------------------------------------------
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: Monte Carlo path generator

deriv
Thank you Luigi for your reply.
But can you tell me the classes and methods where the simulated prices are generated?

Pierluigi

Luigi Ballabio wrote
On Thu, 2010-07-01 at 06:17 -0700, deriv wrote:
> Hy everybody, I'm trying to understand where the Monte Carlo method in
> QuantLib stores the simulated prices. I need to take them to plot all the
> simulated time series.

It doesn't store them---paths are generated, passed to the path pricer
to yield a price, and discarded (see the MonteCarloModel::addSamples
method.)  if you want a one-off solution, insert some print statement in
the implementation of the PathPricer instance you're using.  For a
long-term solution, you'd have to modify the MonteCarloModel class.

Luigi


--

Newton's Law of Gravitation:
What goes up must come down. But don't expect it to come down
where you can find it. Murphy's Law applies to Newton's.



------------------------------------------------------------------------------
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
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Monte Carlo path generator

Luigi Ballabio
On Thu, 2010-07-01 at 07:10 -0700, deriv wrote:
> can you tell me the classed and methods where the simulated prices are
> generated?

PathGenerator and MultiPathGenerator, in particular the next() method.

Luigi


--

There are two ways to write error-free programs; only the third one
works.
-- unknown



------------------------------------------------------------------------------
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: Monte Carlo path generator

deriv
Luigi, another question:
how many steps the MC simulation generates? Till the maturity of the contract? I mean, is there a timesteps variable inside the code with value equal to 1 day (for example) so that each new simulated value is 1 day forward from today to maturity day (I'm looking at the MC routine used by the Rainbow Barrier Memory Bond class)?
If there are some fixing dates between today and maturity date at which some barrier event is going to be checked, am I able to understand from the code which date is it?

Pierluigi

Luigi Ballabio wrote
On Thu, 2010-07-01 at 07:10 -0700, deriv wrote:
> can you tell me the classed and methods where the simulated prices are
> generated?

PathGenerator and MultiPathGenerator, in particular the next() method.

Luigi


--

There are two ways to write error-free programs; only the third one
works.
-- unknown



------------------------------------------------------------------------------
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
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Monte Carlo path generator

Kakhkhor Abdijalilov
The path stops after reaching the final time. The initial time is
always zero. The final time is the last point of the grid.
PathGenerator stores an instance of TimeGrid which is provided by the
pricing engine or instantiated using the number of time steps and the
end time. In the later case, all time steps are equal to (end time) /
(number of time steps).

TimeGrid  will include fixing dates if those are pass to the
constructor as mandatory times.

Hope it helps.

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