Barrier options

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

Barrier options

Mariano Zeron
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<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
Reply | Threaded
Open this post in threaded view
|

Re: Barrier options

Yannis
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
Reply | Threaded
Open this post in threaded view
|

Re: Barrier options

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

Reply | Threaded
Open this post in threaded view
|

Re: Barrier options

Yannis
You 're welcome!

I am not the author of BarrierOption, but I believe QuantLib can only price barrier options with european exercise rights, a fact that makes all such products treatable with an analytic solution, to the extent their underlying pays no discrete dividends.

The case where the option's underlying pays discrete dividends is different. In such a case you need to resort to the DividendBarrierOption class and price it using FdBlackScholesBarrierEngine or FdHestonBarrierEngine. Both of these engines are discrete methods based on finite differences and there exist no alternative analytic engine that can do the job.

Hope that helps,

Yannis


Mariano Zeron <[hidden email]> schrieb am 9:37 Dienstag, 24.Januar 2017:


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 RandomSequenceGenera tor<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, Inv erseCumulativePoisson> 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



View this message in context: Re: Barrier options

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
Reply | Threaded
Open this post in threaded view
|

Re: Barrier options

Mariano Zeron
Thanks Yannis! 

I was able to use the Dividend paying barrier option with FdBlackScholesBarrierEngine. This is the kind of thing I was looking for!

Regards

Mariano

2017-01-24 13:05 GMT+00:00 Yannis [via QuantLib] <[hidden email]>:
You 're welcome!

I am not the author of BarrierOption, but I believe QuantLib can only price barrier options with european exercise rights, a fact that makes all such products treatable with an analytic solution, to the extent their underlying pays no discrete dividends.

The case where the option's underlying pays discrete dividends is different. In such a case you need to resort to the DividendBarrierOption class and price it using FdBlackScholesBarrierEngine or FdHestonBarrierEngine. Both of these engines are discrete methods based on finite differences and there exist no alternative analytic engine that can do the job.

Hope that helps,

Yannis


Mariano Zeron <[hidden email]> schrieb am 9:37 Dienstag, 24.Januar 2017:


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 RandomSequenceGenera tor<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, Inv erseCumulativePoisson> 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



View this message in context: Re: Barrier options

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-tp17983p17990.html
To unsubscribe from Barrier options, click here.
NAML