Re: Adding functions to QuantLib SWIG

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Adding-functions-to-QuantLib-SWIG-tp6140p14748.html

Ok, try adding

%include callability.i

at the beginning.

Luigi


On Mon, Dec 16, 2013 at 5:39 PM, smazzucca <[hidden email]> wrote:

> Sorry, I did have those declarations at the top. But when I build the c
> wrapper (NQuantLibc) I get 3 errors and 1 warning:
>
>
>
> error C2061: syntax error : identifier 'CallabilitySchedule'
>
> ...\csharp\cpp\quantlib_wrap.cpp
>
> Line: 5575
>
>
>
> error C2065: 'putCallSchedule' : undeclared identifier
>
> ...\csharp\cpp\quantlib_wrap.cpp
>
> Line: 5580
>
>
>
> error C2660: 'new_CallableFixedRateBondPtr' : function does not take 9
> arguments
>
> ...\csharp\cpp\quantlib_wrap.cpp
>
> Line: 78439
>
>
>
> warning C4005: 'SWIGSTDCALL' : macro redefinition
>
> ...\csharp\cpp\quantlib_wrap.cpp
>
> Line: 339
>
>
>
> The first 2 error point here:
>
>
>
> SWIGINTERN CallableFixedRateBondPtr *new_CallableFixedRateBondPtr(Integer
> settlementDays,Real faceAmount,Schedule const &schedule,std::vector< Rate >
> const &coupons,DayCounter const &accrualDayCounter,BusinessDayConvention
> paymentConvention,Real redemption,Date issueDate,CallabilitySchedule const
> &putCallSchedule){
>
>             return new CallableFixedRateBondPtr(
>
>                 new CallableFixedRateBond(settlementDays, faceAmount,
>
>                                   schedule, coupons, accrualDayCounter,
>
>                                   paymentConvention, redemption,
>
>                                   issueDate, putCallSchedule));
>
>
>
>
>
>
>
> The third one here:
>
>
>
>       result = (CallableFixedRateBondPtr
> *)new_CallableFixedRateBondPtr(arg1,arg2,(Schedule const
> &)*arg3,(std::vector< double > const &)*arg4,(DayCounter const
> &)*arg5,arg6,arg7,arg8,(CallabilitySchedule const &)*arg9);
>
>
>
> Simon
>
>
>
> From: Luigi Ballabio [via QuantLib] [mailto:ml-node+[hidden email]]
> Sent: Monday, December 16, 2013 11:26 AM
>
>
> To: Simon Mazzucca
> Subject: Re: Adding functions to QuantLib SWIG
>
>
>
> I see. The examples are the ones commented at the end of the file:
>
>
> // combine traits as you wish, e.g.,
> // export_piecewise_curve(PiecewiseLinearForward,ForwardRate,Linear);
> // export_piecewise_curve(PiecewiseLinearZero,ZeroYield,Linear);
> // export_piecewise_curve(PiecewiseCubicZero,ZeroYield,Cubic);
>
> As for your callable-bond wrapper, it looks correct, but I think you
> also have to add
>
> using QuantLib::CallableFixedRateBond;
>
> and
>
> typedef boost::shared_ptr<Instrument> CallableFixedRateBondPtr;
>
> among the other similar declarations at the beginning of bonds.i
> (they're part of a scheme to hide shared_ptr, which are not idiomatic
> in the languages we're exporting to).
>
> Luigi
>
>
>
> On Mon, Dec 16, 2013 at 5:07 PM, smazzucca <[hidden email]> wrote:
>
>
>> I was referring to this, previously in the same thread:
>>
>>
>>
>>>If you want more combinations, you have to modify piecewiseyieldcurve.i
>>> (look at the bottom of the file; there's a few examples) and regenerate
>>> the
>>> wrappers.
>>
>>
>>
>> I added this segment in bonds.i:
>>
>>
>>
>> %rename(CallableFixedRateBond) CallableFixedRateBondPtr;
>>
>> class CallableFixedRateBondPtr : public BondPtr {
>>
>>     %feature("kwargs") CallableFixedRateBondPtr;
>>
>>   public:
>>
>>     %extend {
>>
>>         CallableFixedRateBondPtr(
>>
>>                 Integer settlementDays,
>>
>>                 Real faceAmount,
>>
>>                 const Schedule &schedule,
>>
>>                 const std::vector<Rate>& coupons,
>>
>>                 const DayCounter& accrualDayCounter,
>>
>>                 BusinessDayConvention paymentConvention,
>>
>>                 Real redemption,
>>
>>                 Date issueDate,
>>
>>                 const CallabilitySchedule &putCallSchedule) {
>>
>>             return new CallableFixedRateBondPtr(
>>
>>                 new CallableFixedRateBond(settlementDays, faceAmount,
>>
>>                                   schedule, coupons, accrualDayCounter,
>>
>>                                   paymentConvention, redemption,
>>
>>                                   issueDate, putCallSchedule));
>>
>>         }
>>
>>     }
>>
>> };
>>
>>
>>
>> Thanks so much!
>>
>> S
>>
>>
>>
>>
>>
>> From: Luigi Ballabio [via QuantLib] [mailto:ml-node+[hidden email]]
>> Sent: Monday, December 16, 2013 10:59 AM
>> To: Simon Mazzucca
>> Subject: Re: Adding functions to QuantLib SWIG
>>
>>
>>
>> Hi,
>>     I'm not sure what samples you're referring to? Anyway, I can have
>> a look at your SWIG interface if you post it here.
>>
>> Luigi
>>
>>
>> On Fri, Dec 13, 2013 at 8:57 PM, smazzucca <[hidden email]> wrote:
>>
>>
>>> I am also trying to convert CallableFixedRateBond using SWIG.
>>>
>>> I made some progress by copying the FixedRateBond segment in bonds.i, but
>>> at
>>> the end of the day I'm getting errors when trying to compile.
>>>
>>> Where exactly are the samples ? I don't see them anywhere ?
>>>
>>> Thank you,
>>> Simon
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>>
>>> http://quantlib.10058.n7.nabble.com/Adding-functions-to-QuantLib-SWIG-tp6140p14737.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
>>
>> ________________________________
>>
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>>
>> http://quantlib.10058.n7.nabble.com/Adding-functions-to-QuantLib-SWIG-tp6140p14741.html
>>
>> To unsubscribe from Adding functions to QuantLib SWIG, click here.
>> NAML
>>
>>
>>
>>
>>
>> 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.
>>
>>
>> ________________________________
>> View this message in context: RE: Adding functions to QuantLib SWIG
>>
>> 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
>
> ________________________________
>
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://quantlib.10058.n7.nabble.com/Adding-functions-to-QuantLib-SWIG-tp6140p14746.html
>
> To unsubscribe from Adding functions to QuantLib SWIG, click here.
> NAML
>
>
>
>
>
> 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.
>
>
> ________________________________
> View this message in context: RE: Adding functions to QuantLib SWIG
> 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