How to get the legs of a swap in QuantLibXL?

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

How to get the legs of a swap in QuantLibXL?

Ballabio Gerardo-4
Hi all,
could you please tell me if there is a way in QuantLibXL to access the
underlying Leg objects of a swap?

For example, let's say I want to know the current accrued days for the
floating leg. If I have built the legs first, and then the swap from the
legs (with qlFixedRateLeg, qlIborLeg, qlSwap), then I can call
qlLegAccruedDays on the floating leg object to get the number that I
want. But what if I have built the swap without creating the legs first,
for example with qlVanillaSwap or qlAssetSwap? Then the legs are inside
the VanillaSwap or AssetSwap object but, unless there's a way which
escapes me, I can't get to them.

There are quite many functions which operate on Legs and lack an
equivalent for Swaps: qlLegAccrualStartDate, qlLegAccrualEndDate,
qlLegDuration, qlLegNextCashFlowDate, qlLegNextCashFlowAmount,
qlLegNextCouponRate... Duplicating (actually, triplicating) all of them
would be a lot of work and not really a neat solution.

I see that QuantLib does have a Swap::leg accessor method, so it's
QuantLibXL which lacks equivalent functionality. I don't know whether it
would be simple to add.

Thank you
 Gerardo


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div style="font-family:Calibri;font-size:10px">
Banca Profilo S.p.A.
Corso Italia, 49 - 20122 Milano - Tel. 02 58408.1, Fax 02 5831 6057
Capitale Sociale Euro 136.794.106,00 i.v.
Iscrizione al Registro Imprese di Milano, C.F. e P.IVA 09108700155 - [hidden email]
Iscritta all’Albo delle Banche e dei Gruppi bancari
Aderente al Fondo Interbancario di Tutela dei depositi
Aderente al Conciliatore Bancario Finanziario e all’Arbitro Bancario Finanziario
Appartenente al Gruppo bancario Banca Profilo e soggetta all’attività di direzione e coordinamento di Arepo BP S.p.A.


DISCLAIMER:
The information transmitted may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any computer.
</div>
</body>
</html>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: How to get the legs of a swap in QuantLibXL?

Bojan Nikolic

Did you have a look at the qlSwapLegAnalysis() function? It retrieves
most of the information from the underlying swap legs.

Best,
Bojan

--
Bojan Nikolic          ||          http://www.bnikolic.co.uk/ql

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

R: How to get the legs of a swap in QuantLibXL?

Ballabio Gerardo-4
Da: Bojan Nikolic [mailto:[hidden email]]
> Did you have a look at the qlSwapLegAnalysis() function? It retrieves
> most of the information from the underlying swap legs.

Yes the information is there, but it requires calculations to extract it
(e.g., to find the current accrued days, first I must locate the current
coupon, then subtract the start date from the evaluation date). While if
I could access the legs, the appropriate function would give me the
answer directly.

Gerardo


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div style="font-family:Calibri;font-size:10px">
Banca Profilo S.p.A.
Corso Italia, 49 - 20122 Milano - Tel. 02 58408.1, Fax 02 5831 6057
Capitale Sociale Euro 136.794.106,00 i.v.
Iscrizione al Registro Imprese di Milano, C.F. e P.IVA 09108700155 - [hidden email]
Iscritta all’Albo delle Banche e dei Gruppi bancari
Aderente al Fondo Interbancario di Tutela dei depositi
Aderente al Conciliatore Bancario Finanziario e all’Arbitro Bancario Finanziario
Appartenente al Gruppo bancario Banca Profilo e soggetta all’attività di direzione e coordinamento di Arepo BP S.p.A.


DISCLAIMER:
The information transmitted may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any computer.
</div>
</body>
</html>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: How to get the legs of a swap in QuantLibXL?

Ferdinando M. Ametrano-3
In reply to this post by Ballabio Gerardo-4
On Fri, Jun 22, 2012 at 5:15 PM, Ballabio Gerardo <[hidden email]> wrote:
> I see that QuantLib does have a Swap::leg accessor method, so it's
> QuantLibXL which lacks equivalent functionality. I don't know whether it
> would be simple to add.

done

I would suggest anyone interested to take a look at the implementation, as it use a nice trick.

When a shared pointer to an underlying C++ object is needed in Excel, this is equivalent to creating a new XL Object, Objects being nothing else than shared pointers.
So the member function Swap::leg is exposed to Excel as qlLegFromSwap Constructor.

ciao -- Nando

PS did I win a free beer from you ?     ;-)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users