Quantcast

Re: QuantLib-dev Digest, Vol 126, Issue 1 - setCouponPricer(s) (Peter Caspers)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: QuantLib-dev Digest, Vol 126, Issue 1 - setCouponPricer(s) (Peter Caspers)

Theo Boafo
Hi Peter,

Just curious what sort of Interest Rates trade or instrument has a leg with a mixture of Libor coupons, floored Libor coupons, CMS coupons from your last post?


Regards

Theo

-----Original Message-----
From: quantlib-dev-request <[hidden email]>
To: quantlib-dev <[hidden email]>
Sent: Fri, 16 Dec 2016 23:55
Subject: QuantLib-dev Digest, Vol 126, Issue 1

Send QuantLib-dev mailing list submissions to
quantlib-[hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
or, via email, send a message with subject or body 'help' to
quantlib-dev-[hidden email]

You can reach the person managing the list at
quantlib-dev-[hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of QuantLib-dev digest..."


Today's Topics:

1. setCouponPricer(s) (Peter Caspers)
2. Re: setCouponPricer(s) (Luigi Ballabio)
3. Re: setCouponPricer(s) (Peter Caspers)
4. Re: setCouponPricer(s) (Luigi Ballabio)


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

Message: 1
Date: Tue, 13 Dec 2016 12:53:32 +0100
From: Peter Caspers <[hidden email]>
Subject: [Quantlib-dev] setCouponPricer(s)
To: quantlib-[hidden email]
Message-ID: <6F817049-CE65-4F5C-AA55-[hidden email]>
Content-Type: text/plain; charset=utf-8

Hi,

say I have a Leg with Libor coupons, floored Libor coupons, CMS coupons, etc. all mixed. I also have a IborCouponPricer and a CmsCouponPricer and want to attach these to the ?matching" coupons.

How can I do that in one (not too long) line of code? It seems setCouponPricer() and setCouponPricers() do not suit really, but I might be missing the obvious...

Kind Regards
Peter


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

Message: 2
Date: Tue, 13 Dec 2016 15:52:13 +0000
From: Luigi Ballabio <[hidden email]>
Subject: Re: [Quantlib-dev] setCouponPricer(s)
To: Peter Caspers <[hidden email]>,
quantlib-[hidden email]
Message-ID:
<[hidden email]>
Content-Type: text/plain; charset="utf-8"

Hi,
I don't think there's a function that does that. If you want to get
fancy, you can write a visitor similar to PricerSetter but storing both
pricers and setting the appropriate one; otherwise, you can loop over the
coupons and find out their type yourself.

Luigi


On Tue, Dec 13, 2016 at 12:56 PM Peter Caspers <[hidden email]>
wrote:

> Hi,
>
> say I have a Leg with Libor coupons, floored Libor coupons, CMS coupons,
> etc. all mixed. I also have a IborCouponPricer and a CmsCouponPricer and
> want to attach these to the ?matching" coupons.
>
> How can I do that in one (not too long) line of code? It seems
> setCouponPricer() and setCouponPricers() do not suit really, but I might be
> missing the obvious...
>
> Kind Regards
> Peter
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> QuantLib-dev mailing list
> QuantLib-[hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...

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

Message: 3
Date: Tue, 13 Dec 2016 17:53:02 +0100
From: Peter Caspers <[hidden email]>
Subject: Re: [Quantlib-dev] setCouponPricer(s)
To: Luigi Ballabio <[hidden email]>
Cc: quantlib-[hidden email]
Message-ID: <8F3E06CB-DF2F-4E37-98EE-[hidden email]>
Content-Type: text/plain; charset="utf-8"

Hi Luigi,

yes, I do loop over the coupons right now. This is cumbersome, lots of dynamic casting and for cap-floored coupons you have to look at the underlying to find the type.

Instead of your fancy solution I thought I could reuse the existing PricerSetter und write a simple overload of the setCouponPricers method that just tries to set the pricers one after another and catches exceptions thrown from the PricerSetter in case of mismatches. But this overload would have to sit within the couponpricer file since the setter is in an empty namespace in that file.

Would that be too dirty for a PR? Is the use case maybe exotic after all?

Kind Regards
Peter

> On 13 Dec 2016, at 16:52, Luigi Ballabio <[hidden email]> wrote:
>
> Hi,
> I don't think there's a function that does that. If you want to get fancy, you can write a visitor similar to PricerSetter but storing both pricers and setting the appropriate one; otherwise, you can loop over the coupons and find out their type yourself.
>
> Luigi
>
>
> On Tue, Dec 13, 2016 at 12:56 PM Peter Caspers <[hidden email] <[hidden email]>> wrote:
> Hi,
>
> say I have a Leg with Libor coupons, floored Libor coupons, CMS coupons, etc. all mixed. I also have a IborCouponPricer and a CmsCouponPricer and want to attach these to the ?matching" coupons.
>
> How can I do that in one (not too long) line of code? It seems setCouponPricer() and setCouponPricers() do not suit really, but I might be missing the obvious...
>
> Kind Regards
> Peter
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot <http://sdm.link/slashdot>
> _______________________________________________
> QuantLib-dev mailing list
> QuantLib-[hidden email] <[hidden email]>
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev <https://lists.sourceforge.net/lists/listinfo/quantlib-dev>

-------------- next part --------------
An HTML attachment was scrubbed...

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

Message: 4
Date: Thu, 15 Dec 2016 10:38:27 +0000
From: Luigi Ballabio <[hidden email]>
Subject: Re: [Quantlib-dev] setCouponPricer(s)
To: Peter Caspers <[hidden email]>
Cc: quantlib-[hidden email]
Message-ID:
<CAJkxnzfPCLjVtMsn_a07Tf6tF8Xzx801CBugcJ-[hidden email]>
Content-Type: text/plain; charset="utf-8"

It's ok for me.

Luigi

On Tue, Dec 13, 2016 at 5:53 PM Peter Caspers <[hidden email]>
wrote:

> Hi Luigi,
>
> yes, I do loop over the coupons right now. This is cumbersome, lots of
> dynamic casting and for cap-floored coupons you have to look at the
> underlying to find the type.
>
> Instead of your fancy solution I thought I could reuse the existing
> PricerSetter und write a simple overload of the setCouponPricers method
> that just tries to set the pricers one after another and catches exceptions
> thrown from the PricerSetter in case of mismatches. But this overload would
> have to sit within the couponpricer file since the setter is in an empty
> namespace in that file.
>
> Would that be too dirty for a PR? Is the use case maybe exotic after all?
>
> Kind Regards
> Peter
>
>
> On 13 Dec 2016, at 16:52, Luigi Ballabio <[hidden email]> wrote:
>
> Hi,
> I don't think there's a function that does that. If you want to get
> fancy, you can write a visitor similar to PricerSetter but storing both
> pricers and setting the appropriate one; otherwise, you can loop over the
> coupons and find out their type yourself.
>
> Luigi
>
>
> On Tue, Dec 13, 2016 at 12:56 PM Peter Caspers <[hidden email]>
> wrote:
>
> Hi,
>
> say I have a Leg with Libor coupons, floored Libor coupons, CMS coupons,
> etc. all mixed. I also have a IborCouponPricer and a CmsCouponPricer and
> want to attach these to the ?matching" coupons.
>
> How can I do that in one (not too long) line of code? It seems
> setCouponPricer() and setCouponPricers() do not suit really, but I might be
> missing the obvious...
>
> Kind Regards
> Peter
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org <http://slashdot.org>!
> http://sdm.link/slashdot
> _______________________________________________
> QuantLib-dev mailing list
> QuantLib-[hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...

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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

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

_______________________________________________
QuantLib-dev mailing list
QuantLib-[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


End of QuantLib-dev Digest, Vol 126, Issue 1
********************************************

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