Getting the latestDate() from a SwapRateHelper object (using C# SWIG Bindings)

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

Getting the latestDate() from a SwapRateHelper object (using C# SWIG Bindings)

Ahmad Mahomed
Using the C# SWIG bindings, how does one get the value of the  `latestDate()` from a SwapRateHelper defined as 

             var daysTillLast = curveEndDate.serialNumber() - TodaysDate.serialNumber();
             var newFwdSwap = 
                    new SwapRateHelper(
                        swapRate,
                        new Period(10,TimeUnit.Years),
                        SouthAfricanCalender,
                        Frequency.Quarterly,
                        DayConvention,
                        Actual365FixedDayCounter,
                        new Jibar(new Period(Frequency.Quarterly),DiscountingTermStructure),
                        0 /*zero spread */, 
                        new Period(daysTillLast,TimeUnit.Days) /* fwdStart */
                    );

The latestDate() is part of the the functionality of the  'RelativeDateBootstrapHelper<YieldTermStructure>' object.

Note: I created the the above ctor since it was not defined in the SWIG files. I need to test this and if it works I will submit a patch for the files if its valid.


--
Ahmad Mahomed

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Getting the latestDate() from a SwapRateHelper object (using C# SWIG Bindings)

Ahmad Mahomed
Having looked into the C++ source, it would seem that the latestDate() function returns the maturityDate of the vanilla swap that is created by the SwapRateHelper.

What I have done as a result, is to expose the underlying VanillaSwap by modifying the related SWIG file ie. 'ratehelper.i' - see attachemment (I have also added another SwapRateHelper constructor).


On 29 October 2010 07:51, Ahmad Mahomed <[hidden email]> wrote:
Using the C# SWIG bindings, how does one get the value of the  `latestDate()` from a SwapRateHelper defined as 

             var daysTillLast = curveEndDate.serialNumber() - TodaysDate.serialNumber();
             var newFwdSwap = 
                    new SwapRateHelper(
                        swapRate,
                        new Period(10,TimeUnit.Years),
                        SouthAfricanCalender,
                        Frequency.Quarterly,
                        DayConvention,
                        Actual365FixedDayCounter,
                        new Jibar(new Period(Frequency.Quarterly),DiscountingTermStructure),
                        0 /*zero spread */, 
                        new Period(daysTillLast,TimeUnit.Days) /* fwdStart */
                    );

The latestDate() is part of the the functionality of the  'RelativeDateBootstrapHelper<YieldTermStructure>' object.

Note: I created the the above ctor since it was not defined in the SWIG files. I need to test this and if it works I will submit a patch for the files if its valid.


--
Ahmad Mahomed



--
Ahmad Mahomed

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

ratehelpers.i (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Getting the latestDate() from a SwapRateHelper object (using C# SWIG Bindings)

Luigi Ballabio
On Mon, 2010-11-01 at 09:30 +0200, Ahmad Mahomed wrote:
> Having looked into the C++ source, it would seem that the latestDate()
> function returns the maturityDate of the vanilla swap that is created
> by the SwapRateHelper.
>
> What I have done as a result, is to expose the underlying VanillaSwap
> by modifying the related SWIG file ie. 'ratehelper.i' - see
> attachemment (I have also added another SwapRateHelper constructor).

Ok, thanks for the patch.  Another way would have been to export the
RateHelper interface so that the other helpers get latestDate() as
well---I'll try and do that for next release.  Your patch in
independent, though, and can go in anyway.

Luigi



--

I have yet to see any problem, however complicated, which, when you
looked at it in the right way, did not become still more complicated.
-- Poul Anderson



------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Getting the latestDate() from a SwapRateHelper object (using C# SWIG Bindings)

Ahmad Mahomed
Hi Luigi, 

I tried that first actually, but the generated c++ was not compiling. I may have missed something, but will also look at it again.

Regards,

Ahmad

On 2 November 2010 11:38, Luigi Ballabio <[hidden email]> wrote:
On Mon, 2010-11-01 at 09:30 +0200, Ahmad Mahomed wrote:
> Having looked into the C++ source, it would seem that the latestDate()
> function returns the maturityDate of the vanilla swap that is created
> by the SwapRateHelper.
>
> What I have done as a result, is to expose the underlying VanillaSwap
> by modifying the related SWIG file ie. 'ratehelper.i' - see
> attachemment (I have also added another SwapRateHelper constructor).

Ok, thanks for the patch.  Another way would have been to export the
RateHelper interface so that the other helpers get latestDate() as
well---I'll try and do that for next release.  Your patch in
independent, though, and can go in anyway.

Luigi



--

I have yet to see any problem, however complicated, which, when you
looked at it in the right way, did not become still more complicated.
-- Poul Anderson





--
Ahmad Mahomed

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users