Login  Register

Re: Barrier options

Posted by Mariano Zeron on Jan 23, 2017; 3:27pm
URL: http://quantlib.414.s1.nabble.com/Barrier-options-tp17983p17988.html

Hi Yannis,


Thanks a lot for your quick response. I've done what you suggested and now I can use the Monte Carlo engine for barrier options using 

boost::shared_ptr<PricingEngine> barrierEngineMC = MakeMCBarrierEngine<PseudoRandom, GeneralStatistics>(bsmProcess)
.withSteps(timeSteps)
.withSamples(nSamples);

Ended up using this as MCBarrierEngine needed every single parameter (non seem to be defined by default) and that was giving me problems.

Do you know by any chance which of the barrier options offered in Quantlib cannot be priced using an analytic solution? So far I had been using BarrierOption, but this type of product can be priced using an analytic engine.

All the best

Mariano 



2017-01-22 7:39 GMT+00:00 Yannis [via QuantLib] <[hidden email]>:
Hi Mariano,

Try replacing RandomSequenceGenerator<MersenneTwisterUniformRng> with either PseudoRandom or PoissonPseudoRandom for normally or exponentially distributed random number generator. Both use MersenneTwisterUniformRng since they are defined as follows:

    typedef GenericPseudoRandom<MersenneTwisterUniformRng, InverseCumulativeNormal> PseudoRandom;
    typedef GenericPseudoRandom<MersenneTwisterUniformRng, InverseCumulativePoisson> PoissonPseudoRandom;

Regards
Yannis


Mariano Zeron <[hidden email]> schrieb am 9:35 Sonntag, 22.Januar 2017:


Hi,

I'm interested in pricing a barrier option not using an analytic solution,
for example through a Monte Carlo simulation. I found MCBarrierEngine but so
far I have had problems using it.

I seem to have a problem passing the right template argument list. I tried


boost::shared_ptr<PricingEngine> barrierEngineMC(
new MCBarrierEngine<RandomSequenceGenerator&lt;MersenneTwisterUniformRng>,
GeneralStatistics>(bsmProcess, timeSteps, 24, true, true, nSamples,
0.000001, nSamples + 10000, false, 42));


There are quite a few errors all of them related to the use of

RandomSequenceGenerator<MersenneTwisterUniformRng>

for example (I can pass all if needed):

  'rsg_type' : is not a member of
'QuantLib::RandomSequenceGenerator<QuantLib::MersenneTwisterUniformRng>'


What is the right way of using this engine? As a side question but directly
related to what I need, can this engine be used to price single barrier
options (which I can price using the analytic pricer) or is this engine
restricted to more exotic barriers?

Thanks in advance!

Mariano



--
View this message in context: http://quantlib.10058.n7.nabble.com/Barrier-options-tp17983.html
Sent from the quantlib-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



If you reply to this email, your message will be added to the discussion below:
http://quantlib.10058.n7.nabble.com/Barrier-options-tp17983p17984.html
To unsubscribe from Barrier options, click here.
NAML