BondFunctions via SWIG

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

BondFunctions via SWIG

smazzucca
Was anybody been successful in using QL via SWIG ? So far most of what I need is not there...

[Question 1]
Right now I'm trying to access convexity / bps / duration from CashFlows but I don't see any of them (I do see amount() and date()). Am I supposed to ?

[Question 2]
I see that convexity and duration are available via BondFunctions. Can BondFunctions be converted with SWIG ?

Thank you,
Simon
Reply | Threaded
Open this post in threaded view
|

Re: BondFunctions via SWIG

Luigi Ballabio
Hello Simon,
    the methods you need are all exported:

$ python
Python 2.7.5+ (default, Sep 19 2013, 13:49:51)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from QuantLib import *
>>> CashFlows.duration
<built-in function CashFlows_duration>
>>> CashFlows.bps
<built-in function CashFlows_bps>
>>> CashFlows.convexity
<built-in function CashFlows_convexity>
>>> BondFunctions.convexity
<built-in function BondFunctions_convexity>
>>> BondFunctions.duration
<built-in function BondFunctions_duration>
>>>

My guess is that you're using the CashFlow class instead (yes, it's
unfortunate that the names are so similar...)



On Thu, Dec 12, 2013 at 5:05 PM, smazzucca <[hidden email]> wrote:

> Was anybody been successful in using QL via SWIG ? So far most of what I need
> is not there...
>
> [Question 1]
> Right now I'm trying to access convexity / bps / duration from CashFlows but
> I don't see any of them (I do see amount() and date()). Am I supposed to ?
>
> [Question 2]
> I see that convexity and duration are available via BondFunctions. Can
> BondFunctions be converted with SWIG ?
>
> Thank you,
> Simon
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/BondFunctions-via-SWIG-tp14725.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&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>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&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: BondFunctions via SWIG

smazzucca
Luigi,

If I look at _FixedRateBond.cashflows(), intellisense gives me Add, AddRange, Count... etc (this is clearly a collection).

If I look at _FixedRateBond.cashflows()[0], then I get amount, asObservable, date, but none of the methods I'm looking for.

There is no _FixedRateBond.cashflow() - singular.

I am using C#, not Python and I don't see any of the built-in functions you mention.

Thank SO much for the very prompt reply.
Simon


-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Thursday, December 12, 2013 11:40 AM
To: Simon Mazzucca
Cc: QuantLib users
Subject: Re: [Quantlib-users] BondFunctions via SWIG

Hello Simon,
    the methods you need are all exported:

$ python
Python 2.7.5+ (default, Sep 19 2013, 13:49:51) [GCC 4.8.1] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>> from QuantLib import *
>>> CashFlows.duration
<built-in function CashFlows_duration>
>>> CashFlows.bps
<built-in function CashFlows_bps>
>>> CashFlows.convexity
<built-in function CashFlows_convexity>
>>> BondFunctions.convexity
<built-in function BondFunctions_convexity>
>>> BondFunctions.duration
<built-in function BondFunctions_duration>
>>>

My guess is that you're using the CashFlow class instead (yes, it's unfortunate that the names are so similar...)



On Thu, Dec 12, 2013 at 5:05 PM, smazzucca <[hidden email]> wrote:

> Was anybody been successful in using QL via SWIG ? So far most of what
> I need is not there...
>
> [Question 1]
> Right now I'm trying to access convexity / bps / duration from
> CashFlows but I don't see any of them (I do see amount() and date()). Am I supposed to ?
>
> [Question 2]
> I see that convexity and duration are available via BondFunctions. Can
> BondFunctions be converted with SWIG ?
>
> Thank you,
> Simon
>
>
>
> --
> View this message in context:
> http://quantlib.10058.n7.nabble.com/BondFunctions-via-SWIG-tp14725.htm
> l Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ----------------------------------------------------------------------
> -------- Rapidly troubleshoot problems before they affect your
> business. Most IT organizations don't have a clear picture of how
> application performance affects their revenue. With AppDynamics, you
> get 100% visibility into your Java,.NET, & PHP application. Start your
> 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.c
> lktrk _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



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




This e-mail, including its contents and attachments, if any, is confidential and is intended only for the addressee. If you are not the intended recipient, you are hereby notified that any use, dissemination or distribution of this communication is strictly forbidden. If you received this e-mail in error please immediately notify the sender and delete or destroy this and all copies of this message and all attachments. Any unauthorized disclosure, use, distribution, or reproduction of this message or any attachments is prohibited and may be unlawful.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&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: BondFunctions via SWIG

Luigi Ballabio
Hi Simon,
    The FixedRateBond.cashflows() _method_ gives you some kind of
vector that you can pass to the static methods of the CashFlows
_class_.

Luigi


On Thu, Dec 12, 2013 at 5:47 PM, Simon Mazzucca
<[hidden email]> wrote:

> Luigi,
>
> If I look at _FixedRateBond.cashflows(), intellisense gives me Add, AddRange, Count... etc (this is clearly a collection).
>
> If I look at _FixedRateBond.cashflows()[0], then I get amount, asObservable, date, but none of the methods I'm looking for.
>
> There is no _FixedRateBond.cashflow() - singular.
>
> I am using C#, not Python and I don't see any of the built-in functions you mention.
>
> Thank SO much for the very prompt reply.
> Simon
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Thursday, December 12, 2013 11:40 AM
> To: Simon Mazzucca
> Cc: QuantLib users
> Subject: Re: [Quantlib-users] BondFunctions via SWIG
>
> Hello Simon,
>     the methods you need are all exported:
>
> $ python
> Python 2.7.5+ (default, Sep 19 2013, 13:49:51) [GCC 4.8.1] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>>> from QuantLib import *
>>>> CashFlows.duration
> <built-in function CashFlows_duration>
>>>> CashFlows.bps
> <built-in function CashFlows_bps>
>>>> CashFlows.convexity
> <built-in function CashFlows_convexity>
>>>> BondFunctions.convexity
> <built-in function BondFunctions_convexity>
>>>> BondFunctions.duration
> <built-in function BondFunctions_duration>
>>>>
>
> My guess is that you're using the CashFlow class instead (yes, it's unfortunate that the names are so similar...)
>
>
>
> On Thu, Dec 12, 2013 at 5:05 PM, smazzucca <[hidden email]> wrote:
>> Was anybody been successful in using QL via SWIG ? So far most of what
>> I need is not there...
>>
>> [Question 1]
>> Right now I'm trying to access convexity / bps / duration from
>> CashFlows but I don't see any of them (I do see amount() and date()). Am I supposed to ?
>>
>> [Question 2]
>> I see that convexity and duration are available via BondFunctions. Can
>> BondFunctions be converted with SWIG ?
>>
>> Thank you,
>> Simon
>>
>>
>>
>> --
>> View this message in context:
>> http://quantlib.10058.n7.nabble.com/BondFunctions-via-SWIG-tp14725.htm
>> l Sent from the quantlib-users mailing list archive at Nabble.com.
>>
>> ----------------------------------------------------------------------
>> -------- Rapidly troubleshoot problems before they affect your
>> business. Most IT organizations don't have a clear picture of how
>> application performance affects their revenue. With AppDynamics, you
>> get 100% visibility into your Java,.NET, & PHP application. Start your
>> 15-day FREE TRIAL of AppDynamics Pro!
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.c
>> lktrk _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
>
>
>
> This e-mail, including its contents and attachments, if any, is confidential and is intended only for the addressee. If you are not the intended recipient, you are hereby notified that any use, dissemination or distribution of this communication is strictly forbidden. If you received this e-mail in error please immediately notify the sender and delete or destroy this and all copies of this message and all attachments. Any unauthorized disclosure, use, distribution, or reproduction of this message or any attachments is prohibited and may be unlawful.



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

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&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: BondFunctions via SWIG

smazzucca
Ah! So THAT's how it's done. I wish I had asked you right away.

I don't know if my numbers are right yet, but I am definitely getting a value.

Thank you!
Simon


-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Thursday, December 12, 2013 11:51 AM
To: Simon Mazzucca
Cc: QuantLib users
Subject: Re: [Quantlib-users] BondFunctions via SWIG

Hi Simon,
    The FixedRateBond.cashflows() _method_ gives you some kind of vector that you can pass to the static methods of the CashFlows _class_.

Luigi


On Thu, Dec 12, 2013 at 5:47 PM, Simon Mazzucca <[hidden email]> wrote:

> Luigi,
>
> If I look at _FixedRateBond.cashflows(), intellisense gives me Add, AddRange, Count... etc (this is clearly a collection).
>
> If I look at _FixedRateBond.cashflows()[0], then I get amount, asObservable, date, but none of the methods I'm looking for.
>
> There is no _FixedRateBond.cashflow() - singular.
>
> I am using C#, not Python and I don't see any of the built-in functions you mention.
>
> Thank SO much for the very prompt reply.
> Simon
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Thursday, December 12, 2013 11:40 AM
> To: Simon Mazzucca
> Cc: QuantLib users
> Subject: Re: [Quantlib-users] BondFunctions via SWIG
>
> Hello Simon,
>     the methods you need are all exported:
>
> $ python
> Python 2.7.5+ (default, Sep 19 2013, 13:49:51) [GCC 4.8.1] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>>> from QuantLib import *
>>>> CashFlows.duration
> <built-in function CashFlows_duration>
>>>> CashFlows.bps
> <built-in function CashFlows_bps>
>>>> CashFlows.convexity
> <built-in function CashFlows_convexity>
>>>> BondFunctions.convexity
> <built-in function BondFunctions_convexity>
>>>> BondFunctions.duration
> <built-in function BondFunctions_duration>
>>>>
>
> My guess is that you're using the CashFlow class instead (yes, it's
> unfortunate that the names are so similar...)
>
>
>
> On Thu, Dec 12, 2013 at 5:05 PM, smazzucca <[hidden email]> wrote:
>> Was anybody been successful in using QL via SWIG ? So far most of
>> what I need is not there...
>>
>> [Question 1]
>> Right now I'm trying to access convexity / bps / duration from
>> CashFlows but I don't see any of them (I do see amount() and date()). Am I supposed to ?
>>
>> [Question 2]
>> I see that convexity and duration are available via BondFunctions.
>> Can BondFunctions be converted with SWIG ?
>>
>> Thank you,
>> Simon
>>
>>
>>
>> --
>> View this message in context:
>> http://quantlib.10058.n7.nabble.com/BondFunctions-via-SWIG-tp14725.ht
>> m l Sent from the quantlib-users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> -
>> -------- Rapidly troubleshoot problems before they affect your
>> business. Most IT organizations don't have a clear picture of how
>> application performance affects their revenue. With AppDynamics, you
>> get 100% visibility into your Java,.NET, & PHP application. Start
>> your 15-day FREE TRIAL of AppDynamics Pro!
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.
>> c lktrk _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
>
>
>
> This e-mail, including its contents and attachments, if any, is confidential and is intended only for the addressee. If you are not the intended recipient, you are hereby notified that any use, dissemination or distribution of this communication is strictly forbidden. If you received this e-mail in error please immediately notify the sender and delete or destroy this and all copies of this message and all attachments. Any unauthorized disclosure, use, distribution, or reproduction of this message or any attachments is prohibited and may be unlawful.



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




This e-mail, including its contents and attachments, if any, is confidential and is intended only for the addressee. If you are not the intended recipient, you are hereby notified that any use, dissemination or distribution of this communication is strictly forbidden. If you received this e-mail in error please immediately notify the sender and delete or destroy this and all copies of this message and all attachments. Any unauthorized disclosure, use, distribution, or reproduction of this message or any attachments is prohibited and may be unlawful.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users