Barrier Option with Local Vol

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

Barrier Option with Local Vol

BL BL
Hi,

i try using the FdBlackScholesBarrierEngine from Perl. I would like to use a local Vol Model.

The Engine supports this by the localVol Switch.

Only: It seems i habe to supply a Black Vol Surface. For this  i need to supply a QuantLib::Matrix to the Generalized Black Scholes Process. But QL Matrix is not exported to Perl via Swig (well it is but no constructor or element access is exposed). So no good way to supply this matrix via the perl interface.

Is there a quick/recommended way to supply a black variance surface via perl?

And am i correct that then the LocalVol Termstructure can be given that such that its converted via the dupire formula?

Thanks for any hints.

Bernd

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Barrier Option with Local Vol

Peter Caspers-4
Hi Bernd,

I don't know about the Perl interface.

Concerning the GeneralizedBlackScholesProcess, yes, this converts a
strike and time dependent black surface to a local volatility surface
(using the class LocalVolSurface).

Best regards
Peter


On 15 September 2015 at 18:19, BL BL <[hidden email]> wrote:

> Hi,
>
> i try using the FdBlackScholesBarrierEngine from Perl. I would like to use a
> local Vol Model.
>
> The Engine supports this by the localVol Switch.
>
> Only: It seems i habe to supply a Black Vol Surface. For this  i need to
> supply a QuantLib::Matrix to the Generalized Black Scholes Process. But QL
> Matrix is not exported to Perl via Swig (well it is but no constructor or
> element access is exposed). So no good way to supply this matrix via the
> perl interface.
>
> Is there a quick/recommended way to supply a black variance surface via
> perl?
>
> And am i correct that then the LocalVol Termstructure can be given that such
> that its converted via the dupire formula?
>
> Thanks for any hints.
>
> Bernd
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Barrier Option with Local Vol

BL BL
Hi Peter,

thanks. This is already helpful.

For Perl. I exposed the Engine already to perl. It works without the local vol part.

I looked at the matrix swig definition in linearalgebra.i. They expose most of the methods to not perl. For whatever reason.

I tried to insert 2 methods for element access. They compiled. I was able to insert an element and then read it out again from perl.

But when i tried to acess further elemets i got an unhandled error.

Also i wondered a bit because the matrix is not exported via a pointer. Maybe this is the reason for the problems.

ATM i try some workarounds (including possibly changing the signature of the original engine and passing a vector. Then transforming this into a matrix in the c++ glue code.

But i hoped for another solution.

Maybe there is still someone out there using perl and having solved this.

Many thanks anyway!

Bernd

2015-09-15 19:18 GMT+02:00 Peter Caspers <[hidden email]>:
Hi Bernd,

I don't know about the Perl interface.

Concerning the GeneralizedBlackScholesProcess, yes, this converts a
strike and time dependent black surface to a local volatility surface
(using the class LocalVolSurface).

Best regards
Peter


On 15 September 2015 at 18:19, BL BL <[hidden email]> wrote:
> Hi,
>
> i try using the FdBlackScholesBarrierEngine from Perl. I would like to use a
> local Vol Model.
>
> The Engine supports this by the localVol Switch.
>
> Only: It seems i habe to supply a Black Vol Surface. For this  i need to
> supply a QuantLib::Matrix to the Generalized Black Scholes Process. But QL
> Matrix is not exported to Perl via Swig (well it is but no constructor or
> element access is exposed). So no good way to supply this matrix via the
> perl interface.
>
> Is there a quick/recommended way to supply a black variance surface via
> perl?
>
> And am i correct that then the LocalVol Termstructure can be given that such
> that its converted via the dupire formula?
>
> Thanks for any hints.
>
> Bernd
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Barrier Option with Local Vol

Peter Caspers-4
Bernd,

a second constructor in the BlackVarianceSurface taking a vector of
vectors of quote handles (like it is also done in
SwaptionVolatilityMatrix for example), and observing these, would be
nice anyhow.

If it helps interfacing to Perl, the better :-)

Best regards
Peter


On 16 September 2015 at 09:27, BL BL <[hidden email]> wrote:

> Hi Peter,
>
> thanks. This is already helpful.
>
> For Perl. I exposed the Engine already to perl. It works without the local
> vol part.
>
> I looked at the matrix swig definition in linearalgebra.i. They expose most
> of the methods to not perl. For whatever reason.
>
> I tried to insert 2 methods for element access. They compiled. I was able to
> insert an element and then read it out again from perl.
>
> But when i tried to acess further elemets i got an unhandled error.
>
> Also i wondered a bit because the matrix is not exported via a pointer.
> Maybe this is the reason for the problems.
>
> ATM i try some workarounds (including possibly changing the signature of the
> original engine and passing a vector. Then transforming this into a matrix
> in the c++ glue code.
>
> But i hoped for another solution.
>
> Maybe there is still someone out there using perl and having solved this.
>
> Many thanks anyway!
>
> Bernd
>
> 2015-09-15 19:18 GMT+02:00 Peter Caspers <[hidden email]>:
>>
>> Hi Bernd,
>>
>> I don't know about the Perl interface.
>>
>> Concerning the GeneralizedBlackScholesProcess, yes, this converts a
>> strike and time dependent black surface to a local volatility surface
>> (using the class LocalVolSurface).
>>
>> Best regards
>> Peter
>>
>>
>> On 15 September 2015 at 18:19, BL BL <[hidden email]> wrote:
>> > Hi,
>> >
>> > i try using the FdBlackScholesBarrierEngine from Perl. I would like to
>> > use a
>> > local Vol Model.
>> >
>> > The Engine supports this by the localVol Switch.
>> >
>> > Only: It seems i habe to supply a Black Vol Surface. For this  i need to
>> > supply a QuantLib::Matrix to the Generalized Black Scholes Process. But
>> > QL
>> > Matrix is not exported to Perl via Swig (well it is but no constructor
>> > or
>> > element access is exposed). So no good way to supply this matrix via the
>> > perl interface.
>> >
>> > Is there a quick/recommended way to supply a black variance surface via
>> > perl?
>> >
>> > And am i correct that then the LocalVol Termstructure can be given that
>> > such
>> > that its converted via the dupire formula?
>> >
>> > Thanks for any hints.
>> >
>> > Bernd
>> >
>> >
>> > ------------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > QuantLib-users mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/quantlib-users
>> >
>
>

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Barrier Option with Local Vol

Luigi Ballabio
In reply to this post by BL BL
Hi Bernd,
    I'm not sure why the Matrix methods are not exported to Perl. As a workaround to setup your matrix, may you try exporting the get and set method and see if they work? It should be as simple as replacing

        #elif defined(SWIGCSHARP) || defined(SWIGJAVA)

before their definition with

        #elif defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGPERL)

Later,
    Luigi

On Wed, Sep 16, 2015 at 9:28 AM BL BL <[hidden email]> wrote:
Hi Peter,

thanks. This is already helpful.

For Perl. I exposed the Engine already to perl. It works without the local vol part.

I looked at the matrix swig definition in linearalgebra.i. They expose most of the methods to not perl. For whatever reason.

I tried to insert 2 methods for element access. They compiled. I was able to insert an element and then read it out again from perl.

But when i tried to acess further elemets i got an unhandled error.

Also i wondered a bit because the matrix is not exported via a pointer. Maybe this is the reason for the problems.

ATM i try some workarounds (including possibly changing the signature of the original engine and passing a vector. Then transforming this into a matrix in the c++ glue code.

But i hoped for another solution.

Maybe there is still someone out there using perl and having solved this.

Many thanks anyway!

Bernd

2015-09-15 19:18 GMT+02:00 Peter Caspers <[hidden email]>:
Hi Bernd,

I don't know about the Perl interface.

Concerning the GeneralizedBlackScholesProcess, yes, this converts a
strike and time dependent black surface to a local volatility surface
(using the class LocalVolSurface).

Best regards
Peter


On 15 September 2015 at 18:19, BL BL <[hidden email]> wrote:
> Hi,
>
> i try using the FdBlackScholesBarrierEngine from Perl. I would like to use a
> local Vol Model.
>
> The Engine supports this by the localVol Switch.
>
> Only: It seems i habe to supply a Black Vol Surface. For this  i need to
> supply a QuantLib::Matrix to the Generalized Black Scholes Process. But QL
> Matrix is not exported to Perl via Swig (well it is but no constructor or
> element access is exposed). So no good way to supply this matrix via the
> perl interface.
>
> Is there a quick/recommended way to supply a black variance surface via
> perl?
>
> And am i correct that then the LocalVol Termstructure can be given that such
> that its converted via the dupire formula?
>
> Thanks for any hints.
>
> Bernd
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Barrier Option with Local Vol

BL BL
Hi Luigi,

thanks!

That works. i played around with the get and set in perl. So far it always worked.

never thought of this. sorry

Bernd

2015-09-16 12:44 GMT+02:00 Luigi Ballabio <[hidden email]>:
Hi Bernd,
    I'm not sure why the Matrix methods are not exported to Perl. As a workaround to setup your matrix, may you try exporting the get and set method and see if they work? It should be as simple as replacing

        #elif defined(SWIGCSHARP) || defined(SWIGJAVA)

before their definition with

        #elif defined(SWIGCSHARP) || defined(SWIGJAVA) || defined(SWIGPERL)

Later,
    Luigi

On Wed, Sep 16, 2015 at 9:28 AM BL BL <[hidden email]> wrote:
Hi Peter,

thanks. This is already helpful.

For Perl. I exposed the Engine already to perl. It works without the local vol part.

I looked at the matrix swig definition in linearalgebra.i. They expose most of the methods to not perl. For whatever reason.

I tried to insert 2 methods for element access. They compiled. I was able to insert an element and then read it out again from perl.

But when i tried to acess further elemets i got an unhandled error.

Also i wondered a bit because the matrix is not exported via a pointer. Maybe this is the reason for the problems.

ATM i try some workarounds (including possibly changing the signature of the original engine and passing a vector. Then transforming this into a matrix in the c++ glue code.

But i hoped for another solution.

Maybe there is still someone out there using perl and having solved this.

Many thanks anyway!

Bernd

2015-09-15 19:18 GMT+02:00 Peter Caspers <[hidden email]>:
Hi Bernd,

I don't know about the Perl interface.

Concerning the GeneralizedBlackScholesProcess, yes, this converts a
strike and time dependent black surface to a local volatility surface
(using the class LocalVolSurface).

Best regards
Peter


On 15 September 2015 at 18:19, BL BL <[hidden email]> wrote:
> Hi,
>
> i try using the FdBlackScholesBarrierEngine from Perl. I would like to use a
> local Vol Model.
>
> The Engine supports this by the localVol Switch.
>
> Only: It seems i habe to supply a Black Vol Surface. For this  i need to
> supply a QuantLib::Matrix to the Generalized Black Scholes Process. But QL
> Matrix is not exported to Perl via Swig (well it is but no constructor or
> element access is exposed). So no good way to supply this matrix via the
> perl interface.
>
> Is there a quick/recommended way to supply a black variance surface via
> perl?
>
> And am i correct that then the LocalVol Termstructure can be given that such
> that its converted via the dupire formula?
>
> Thanks for any hints.
>
> Bernd
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users