QuantLib-SWIG-1.3: pricing caps with non constant vola?

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

QuantLib-SWIG-1.3: pricing caps with non constant vola?

Nils Tobias Kramer
Hi,

I was delving into pricing caps and the only way I could get it to work was using ConstantOptionletVolatility(). This is because I'm using BlackCapFloorEngine() which needs an OptionletVolatiltyStructureHandle() as second argument.

In QuantlibXL I could get it to work: CapFloorTermVolSurface() -> OptionletStripper1() -> StrippedOptioneltAdapter() => OptionletVolatilityStructure().

However using C# I couldn't find any constructors for CapFloorTermVolSurface() or OptionletStripper().
For Surface(), LocalVolTermStructure(), and CapFloorTermVolatilityStructure() I could only find an empty constructor so I'm not sure how to use it and am not sure if these are implemented in SWIG.

The only two volatility term structures I found in C# are CapFloorTermVolCurve() and BlackVarianceSurfac(). But I can't get these things converted to and OptionletVolatiltyStructure().
- Any ideas on how to price a cap with a vola term structure in C#?
- Should I write my own pricer or use an other pricer from Quantlib, namely: analyticcapfloorengine, discretizedcapfloor, mchullwhiteengine or treecapfloorengine?

I searched and searched and searched but could only come up with this: http://quantlib.10058.n7.nabble.com/CapFloor-surfaces-td5575.html. Also http://implementingquantlib.blogspot.com/2014/01/chapter-3-part-7-of-7-interest-rate.html didn't clear things up enough for me to solve my issue.

Any suggestions are welcome.

Have nice week
Toby



------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantLib-SWIG-1.3: pricing caps with non constant vola?

Luigi Ballabio
Hi,
    the chain of classes CapFloorTermVolSurface -> OptionletStripper1
-> StrippedOptioneltAdapter should be exported to QuantLib-SWIG. (My
guess is that nobody needed them yet, so they weren't exported.
QuantLib-SWIG tends to lag behind the C++ library. This is also true
of QuantLibXL, with the difference that someone used and exported
those particular classes).

Are you willing to give it a try at writing the SWIG wrappers for
them? if so, I can point you in the right direction. And of course,
I'll be glad to add them to the official repository if you contribute
them.

Later,
    Luigi



On Mon, Feb 10, 2014 at 10:20 AM, Nils Tobias Kramer
<[hidden email]> wrote:

> Hi,
>
> I was delving into pricing caps and the only way I could get it to work was
> using ConstantOptionletVolatility(). This is because I'm using
> BlackCapFloorEngine() which needs an OptionletVolatiltyStructureHandle() as
> second argument.
>
> In QuantlibXL I could get it to work: CapFloorTermVolSurface() ->
> OptionletStripper1() -> StrippedOptioneltAdapter() =>
> OptionletVolatilityStructure().
>
> However using C# I couldn't find any constructors for
> CapFloorTermVolSurface() or OptionletStripper().
> For Surface(), LocalVolTermStructure(), and
> CapFloorTermVolatilityStructure() I could only find an empty constructor so
> I'm not sure how to use it and am not sure if these are implemented in SWIG.
>
> The only two volatility term structures I found in C# are
> CapFloorTermVolCurve() and BlackVarianceSurfac(). But I can't get these
> things converted to and OptionletVolatiltyStructure().
> - Any ideas on how to price a cap with a vola term structure in C#?
> - Should I write my own pricer or use an other pricer from Quantlib, namely:
> analyticcapfloorengine, discretizedcapfloor, mchullwhiteengine or
> treecapfloorengine?
>
> I searched and searched and searched but could only come up with this:
> http://quantlib.10058.n7.nabble.com/CapFloor-surfaces-td5575.html. Also
> http://implementingquantlib.blogspot.com/2014/01/chapter-3-part-7-of-7-interest-rate.html
> didn't clear things up enough for me to solve my issue.
>
> Any suggestions are welcome.
>
> Have nice week
> Toby
>
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantLib-SWIG-1.3: pricing caps with non constant vola?

Nils Tobias Kramer
Hi Luigi,

I'm not experienced with swig but would give it a try. How would you start, I mean which is probably the best way to get acquainted with swig-ql and learn how to write some wrappers?

Thanks
Toby


2014-02-19 16:06 GMT+01:00 Luigi Ballabio <[hidden email]>:
Hi,
    the chain of classes CapFloorTermVolSurface -> OptionletStripper1
-> StrippedOptioneltAdapter should be exported to QuantLib-SWIG. (My
guess is that nobody needed them yet, so they weren't exported.
QuantLib-SWIG tends to lag behind the C++ library. This is also true
of QuantLibXL, with the difference that someone used and exported
those particular classes).

Are you willing to give it a try at writing the SWIG wrappers for
them? if so, I can point you in the right direction. And of course,
I'll be glad to add them to the official repository if you contribute
them.

Later,
    Luigi



On Mon, Feb 10, 2014 at 10:20 AM, Nils Tobias Kramer
<[hidden email]> wrote:
> Hi,
>
> I was delving into pricing caps and the only way I could get it to work was
> using ConstantOptionletVolatility(). This is because I'm using
> BlackCapFloorEngine() which needs an OptionletVolatiltyStructureHandle() as
> second argument.
>
> In QuantlibXL I could get it to work: CapFloorTermVolSurface() ->
> OptionletStripper1() -> StrippedOptioneltAdapter() =>
> OptionletVolatilityStructure().
>
> However using C# I couldn't find any constructors for
> CapFloorTermVolSurface() or OptionletStripper().
> For Surface(), LocalVolTermStructure(), and
> CapFloorTermVolatilityStructure() I could only find an empty constructor so
> I'm not sure how to use it and am not sure if these are implemented in SWIG.
>
> The only two volatility term structures I found in C# are
> CapFloorTermVolCurve() and BlackVarianceSurfac(). But I can't get these
> things converted to and OptionletVolatiltyStructure().
> - Any ideas on how to price a cap with a vola term structure in C#?
> - Should I write my own pricer or use an other pricer from Quantlib, namely:
> analyticcapfloorengine, discretizedcapfloor, mchullwhiteengine or
> treecapfloorengine?
>
> I searched and searched and searched but could only come up with this:
> http://quantlib.10058.n7.nabble.com/CapFloor-surfaces-td5575.html. Also
> http://implementingquantlib.blogspot.com/2014/01/chapter-3-part-7-of-7-interest-rate.html
> didn't clear things up enough for me to solve my issue.
>
> Any suggestions are welcome.
>
> Have nice week
> Toby
>
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: QuantLib-SWIG-1.3: pricing caps with non constant vola?

Luigi Ballabio
Hi Nils,
    unfortunately we don't have much docs on the wrappers. I think you
can look at how similar classes are wrapped and try to replicate them.
The thing that might be confusing is that we're hiding the shared_ptr
class from the target language (basically we're exporting
shared_ptr<X> pretending that it's just an instance of X) so we have
to do some strange things with inheritance. We have plenty of examples
in the existing wrappers, though. Let me know if you get stuck.

Later,
    Luigi


On Thu, Feb 20, 2014 at 3:19 PM, Nils Tobias Kramer
<[hidden email]> wrote:

> Hi Luigi,
>
> I'm not experienced with swig but would give it a try. How would you start,
> I mean which is probably the best way to get acquainted with swig-ql and
> learn how to write some wrappers?
>
> Thanks
> Toby
>
>
> 2014-02-19 16:06 GMT+01:00 Luigi Ballabio <[hidden email]>:
>
>> Hi,
>>     the chain of classes CapFloorTermVolSurface -> OptionletStripper1
>> -> StrippedOptioneltAdapter should be exported to QuantLib-SWIG. (My
>> guess is that nobody needed them yet, so they weren't exported.
>> QuantLib-SWIG tends to lag behind the C++ library. This is also true
>> of QuantLibXL, with the difference that someone used and exported
>> those particular classes).
>>
>> Are you willing to give it a try at writing the SWIG wrappers for
>> them? if so, I can point you in the right direction. And of course,
>> I'll be glad to add them to the official repository if you contribute
>> them.
>>
>> Later,
>>     Luigi
>>
>>
>>
>> On Mon, Feb 10, 2014 at 10:20 AM, Nils Tobias Kramer
>> <[hidden email]> wrote:
>> > Hi,
>> >
>> > I was delving into pricing caps and the only way I could get it to work
>> > was
>> > using ConstantOptionletVolatility(). This is because I'm using
>> > BlackCapFloorEngine() which needs an OptionletVolatiltyStructureHandle()
>> > as
>> > second argument.
>> >
>> > In QuantlibXL I could get it to work: CapFloorTermVolSurface() ->
>> > OptionletStripper1() -> StrippedOptioneltAdapter() =>
>> > OptionletVolatilityStructure().
>> >
>> > However using C# I couldn't find any constructors for
>> > CapFloorTermVolSurface() or OptionletStripper().
>> > For Surface(), LocalVolTermStructure(), and
>> > CapFloorTermVolatilityStructure() I could only find an empty constructor
>> > so
>> > I'm not sure how to use it and am not sure if these are implemented in
>> > SWIG.
>> >
>> > The only two volatility term structures I found in C# are
>> > CapFloorTermVolCurve() and BlackVarianceSurfac(). But I can't get these
>> > things converted to and OptionletVolatiltyStructure().
>> > - Any ideas on how to price a cap with a vola term structure in C#?
>> > - Should I write my own pricer or use an other pricer from Quantlib,
>> > namely:
>> > analyticcapfloorengine, discretizedcapfloor, mchullwhiteengine or
>> > treecapfloorengine?
>> >
>> > I searched and searched and searched but could only come up with this:
>> > http://quantlib.10058.n7.nabble.com/CapFloor-surfaces-td5575.html. Also
>> >
>> > http://implementingquantlib.blogspot.com/2014/01/chapter-3-part-7-of-7-interest-rate.html
>> > didn't clear things up enough for me to solve my issue.
>> >
>> > Any suggestions are welcome.
>> >
>> > Have nice week
>> > Toby
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Managing the Performance of Cloud-Based Applications
>> > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>> > Read the Whitepaper.
>> >
>> > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>> > _______________________________________________
>> > QuantLib-users mailing list
>> > [hidden email]
>> > https://lists.sourceforge.net/lists/listinfo/quantlib-users
>> >
>>
>>
>>
>> --
>> <https://implementingquantlib.blogspot.com>
>> <https://twitter.com/lballabio>
>
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users