Re: Accrued Amount for Vanilla Swaps

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Accrued-Amount-for-Vanilla-Swaps-tp15068p15149.html

The SWIG site itself has extensive docs at <http://swig.org/doc.html> (we're still using version 2.0, since 3.0 wasn't available at the time of our last release).

The definitions of our bindings are in the .i files in the SWIG folder of our QuantLib-SWIG release. There are a few tricks that we're using to hide the use of shared_ptr from the target language, and I'll have to write about those when I have some time. However, the classes you're interested in are already exported, so you should be able to look at those and add the relevant methods by copying the structure of the existing ones. And of course I'll be here to help.

Later,
    Luigi




On Thu, Apr 10, 2014 at 1:16 PM, John Orford <[hidden email]> wrote:
Luigi,

I have never looked into the mechanics of the SWIG bindings before.

If you can recommend a site showing me where to start learning about SWIG I'll give it a shot.

John


On 9 April 2014 21:51, Luigi Ballabio <[hidden email]> wrote:
Hello,
    I'm afraid that's not possible at this time. You'll have to extend the SWIG bindings and recompile them; specifically, you'll have to:
1) extend the VanillaSwap bindings so that they export the fixedLeg and floatingLeg methods.
2) extend the CashFlows bindings so that they export the accruedAmount method.
Once you have these, you can extract the legs from the swap and get the accrued amount of either.
Both the additions should not be difficult, given that the classes are already exported and you have other methods that you can use as models. However, let me know if you get stuck. Also, I'll be glad to merge your changes to the main repository if you want.

Luigi




On Tue, Mar 18, 2014 at 11:07 AM, John Orford <[hidden email]> wrote:
Hi All,

I am trying to figure out how to calculate the accrued amount for vanilla swaps using the Python bindings.

Could anyone give me some pointers?

As an aside, are there any clean / dirty conventions around swap pricing?  I have seen many cases of both, but perhaps there's some logic to it which'd be useful to know for future reference.

Thanks!

John

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
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>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users