BasisPointValue method does not exist in QuantLib for C#

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

BasisPointValue method does not exist in QuantLib for C#

sergvil
Hello,

I'm newbie using QuantLib. I'm developing a WPF desktop application for financial calculations. I'm using the C# wrapper that it allows me to use C++ QuantLib.

One of the calculations I have to make is Basis-Point Value for a Bond. In C++ class Casflows.cpp, the method basispointvalue appears as static and it is fully operational, but in C# class CashFlows.cs, I only have some calculations to use, less than in C++'s. The method basispointvalue doesn't appear on this class.

I don´t know if this is a known issue of QuantLib for C#. Can you help me to fix it?

Thank you very much.

Best regards.
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio
On Thu, 2011-09-15 at 16:29 -0700, sergvil wrote:
> One of the calculations I have to make is Basis-Point Value for a Bond. In
> C++ class Casflows.cpp, the method basispointvalue appears as static and it
> is fully operational, but in C# class CashFlows.cs, I only have some
> calculations to use, less than in C++'s. The method basispointvalue doesn't
> appear on this class.
>
> I don´t know if this is a known issue of QuantLib for C#. Can you help me to
> fix it?

You'll have to add the desired methods in the SWIG interface for  the
CashFlows class (at the end of cashflows.i) and regenerate the wrappers.
If you do, send me a patch and I'll add it to next release.

Thanks,
        Luigi


--

A debugged program is one for which you have not yet found the
conditions that make it fail.
-- Jerry Ogdin



------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

sergvil

Ok, now I just add a couple of calculations in CashFlows.i as they are defined in C++ class. How can I regenerate the wrappers?

Thank you very much.


Luigi Ballabio wrote
You'll have to add the desired methods in the SWIG interface for  the
CashFlows class (at the end of cashflows.i) and regenerate the wrappers.
If you do, send me a patch and I'll add it to next release.

Thanks,
        Luigi
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio
On Fri, 2011-09-16 at 02:23 -0700, sergvil wrote:
>
> Ok, now I just add a couple of calculations in CashFlows.i as they are
> defined in C++ class. How can I regenerate the wrappers?

You're working on a Windows machine, I guess?  You'll need swig.exe in
your path, then you can run swig.cmd in QuantLib-SWIG/CSharp that
invokes it with the correct parameters.  After that, recompile the
wrappers and you should be good to go.

Luigi


--

Of course, if people could just act consistently, they could keep
their desks clean, avoid cavities, lose weight, give up smoking,
play a musical instrument, and possibly even produce software on
a regular and timely basis.
-- Alistair Cockburn



------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

sergvil

Yes, I'm using Windows. Where Can I find the necessary parameters to do the job? SWIG manual or whitepaper would be very usefull.

Luigi Ballabio wrote
On Fri, 2011-09-16 at 02:23 -0700, sergvil wrote:
>
> Ok, now I just add a couple of calculations in CashFlows.i as they are
> defined in C++ class. How can I regenerate the wrappers?

You're working on a Windows machine, I guess?  You'll need swig.exe in
your path, then you can run swig.cmd in QuantLib-SWIG/CSharp that
invokes it with the correct parameters.  After that, recompile the
wrappers and you should be good to go.

Luigi


--

Of course, if people could just act consistently, they could keep
their desks clean, avoid cavities, lose weight, give up smoking,
play a musical instrument, and possibly even produce software on
a regular and timely basis.
-- Alistair Cockburn



------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio
On Fri, 2011-09-16 at 02:55 -0700, sergvil wrote:
>
> Yes, I'm using Windows. Where Can I find the necessary parameters to do the
> job?

As I said, they're inside QuantLib-SWIG/CSharp/swig.cmd.

Luigi


> Luigi Ballabio wrote:
> >
> > On Fri, 2011-09-16 at 02:23 -0700, sergvil wrote:
> >>
> >> Ok, now I just add a couple of calculations in CashFlows.i as they are
> >> defined in C++ class. How can I regenerate the wrappers?
> >
> > You're working on a Windows machine, I guess?  You'll need swig.exe in
> > your path, then you can run swig.cmd in QuantLib-SWIG/CSharp that
> > invokes it with the correct parameters.  After that, recompile the
> > wrappers and you should be good to go.
> >
> > Luigi
> >
> >
> > --
> >
> > Of course, if people could just act consistently, they could keep
> > their desks clean, avoid cavities, lose weight, give up smoking,
> > play a musical instrument, and possibly even produce software on
> > a regular and timely basis.
> > -- Alistair Cockburn
> >
> >
> >
> > ------------------------------------------------------------------------------
> > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> > http://p.sf.net/sfu/rim-devcon-copy2
> > _______________________________________________
> > QuantLib-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/quantlib-users
> >
> >
>

--

Reasonable people adapt themselves to the world. Unreasonable people
attempt to adapt the world to themselves. All progress, therefore,
depends on unreasonable people.
-- G.B. Shaw



------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

sergvil
When I try to execute swig.cmd, it throws me the next errors:

(1) : Error: Unable to find 'swig.swg'
(3) : Error: Unable to find 'csharp.swg'
..\SWIG\quantlib.i(29) : Error: Unable to find 'exception.i'
..\SWIG\common.i(22) : Error: Unable to find 'stl.i'
..\SWIG\common.i(23) : Error: Unable to find 'exception.i'
..\SWIG\vectors.i(23) : Error: Unable to find 'stl.i'
..\SWIG\types.i(23) : Error: Unable to find 'std_common.i'
..\SWIG\date.i(26) : Error: Unable to find 'stl.i'
..\SWIG\linearalgebra.i(26) : Error: Unable to find 'stl.i'
..\SWIG\daycounters.i(27) : Error: Unable to find 'stl.i'
..\SWIG\null.i(23) : Error: Unable to find 'exception.i'
..\SWIG\calendars.i(26) : Error: Unable to find 'stl.i'
..\SWIG\instruments.i(26) : Error: Unable to find 'stl.i'
..\SWIG\options.i(30) : Error: Unable to find 'stl.i'
..\SWIG\grid.i(25) : Error: Unable to find 'stl.i'
..\SWIG\statistics.i(25) : Error: Unable to find 'stl.i'

And in VS2010 project, when I try to regenerate the SWIG CSharp solution, this error appears on quantlib_wrap.hpp

"error C1083: Cannot open include file: 'ql/quantlib.hpp': No such file or directory"

QL_DIR environment variable is set to my local QuantLib installation directory.

I have no idea how to solve this issue.

Than you very much.

Luigi Ballabio wrote
On Fri, 2011-09-16 at 02:55 -0700, sergvil wrote:
>
> Yes, I'm using Windows. Where Can I find the necessary parameters to do the
> job?

As I said, they're inside QuantLib-SWIG/CSharp/swig.cmd.

Luigi


> Luigi Ballabio wrote:
> >
> > On Fri, 2011-09-16 at 02:23 -0700, sergvil wrote:
> >>
> >> Ok, now I just add a couple of calculations in CashFlows.i as they are
> >> defined in C++ class. How can I regenerate the wrappers?
> >
> > You're working on a Windows machine, I guess?  You'll need swig.exe in
> > your path, then you can run swig.cmd in QuantLib-SWIG/CSharp that
> > invokes it with the correct parameters.  After that, recompile the
> > wrappers and you should be good to go.
> >
> > Luigi
> >
> >
> > --
> >
> > Of course, if people could just act consistently, they could keep
> > their desks clean, avoid cavities, lose weight, give up smoking,
> > play a musical instrument, and possibly even produce software on
> > a regular and timely basis.
> > -- Alistair Cockburn
> >
> >
> >
> > ------------------------------------------------------------------------------
> > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> > http://p.sf.net/sfu/rim-devcon-copy2
> > _______________________________________________
> > QuantLib-users mailing list
> > QuantLib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/quantlib-users
> >
> >
>

--

Reasonable people adapt themselves to the world. Unreasonable people
attempt to adapt the world to themselves. All progress, therefore,
depends on unreasonable people.
-- G.B. Shaw



------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio
On Fri, 2011-09-16 at 04:32 -0700, sergvil wrote:
> When I try to execute swig.cmd, it throws me the next errors:
>
> (1) : Error: Unable to find 'swig.swg'
> [...]

Check your SWIG installation.  Alongside swig.exe, there should be a
directory called "Lib" containing swig.swg and a number of other files.
If not, you should probably download swig again and make sure to keep
everything in the archive.


> And in VS2010 project, when I try to regenerate the SWIG CSharp solution,
> this error appears on quantlib_wrap.hpp
>
> "error C1083: Cannot open include file: 'ql/quantlib.hpp': No such file or
> directory"
>
> QL_DIR environment variable is set to my local QuantLib installation
> directory.

QL_DIR should work, but if it doesn't, either add the QuantLib directory
to the include directories in the VS2010 project (it's in the
properties, under VC++ directories) or try setting the INCLUDE
environment variable to the same directory.  If the linker complains
too, do the same for the library directories in the properties or the
LIB environment variable (for the linker, though, you'll need to set the
dir to [your QuantLib directory]\lib, not just the directory).

Luigi


--

Academic: a term of opprobrium applied to those that do their job well
by those who cannot.
-- Sir Ernest Gowers



------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

sergvil

Luigi Ballabio wrote
QL_DIR should work, but if it doesn't, either add the QuantLib directory
to the include directories in the VS2010 project (it's in the
properties, under VC++ directories) or try setting the INCLUDE
environment variable to the same directory.  If the linker complains
too, do the same for the library directories in the properties or the
LIB environment variable (for the linker, though, you'll need to set the
dir to [your QuantLib directory]\lib, not just the directory).
Finally I could compile SWIG with the new CashFlows.i interface, but I'm stuck with VS2010 issue.

I have been looking at project properties looking for VC++ directories and I haven´t find them.

¿Can you explain me step by step how to resolve this?

Thank you very much.

Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio
On Sun, 2011-09-18 at 18:47 -0700, sergvil wrote:
> Finally I could compile SWIG with the new CashFlows.i interface, but I'm
> stuck with VS2010 issue.
>
> I have been looking at project properties looking for VC++ directories and I
> haven´t find them.
>
> ¿Can you explain me step by step how to resolve this?

I open the solution in Visual C++ 2010, right-click on the NQuantLibc
project, select "properties", and there they are under "configuration
properties".  I'm attaching a screenshot.

Luigi


--

Use every man after his desert, and who shall scape whipping?
-- Hamlet, Act II, scene II


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

properties.png (28K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

sergvil
Luigi Ballabio wrote
I open the solution in Visual C++ 2010, right-click on the NQuantLibc
project, select "properties", and there they are under "configuration
properties".  I'm attaching a screenshot.

Luigi
Thank you very much. I have a new error now, is this:

"Error 1 error LNK1104: cannot open file 'QuantLib-vc100-mt-gd.lib'"

Despite this error, project generation ends correctly, and for this, I try to use generated nquantlibc.dll but when I use the BasicPointValue function (now appears in CashFlows.cs), I receive this error:

"BPV calculation for security ES00000123B9 failed. Error Message: Unable to find an entry point named 'CSharp_CashFlows_basisPointValue__SWIG_4' in DLL 'NQuantLibc'."

Perhaps both errors are relacionated.

How can I resolve this issue?

Thank you very much.


Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio
On Thu, 2011-10-06 at 08:03 -0700, sergvil wrote:
> Thank you very much. I have a new error now, is this:
>
> "Error 1 error LNK1104: cannot open file 'QuantLib-vc100-mt-gd.lib'"

I think you're compiling the solution in Debug mode, but you compiled
the C++ library in Release mode instead.  Check that the two match.

Luigi


--

Prediction is very difficult, especially if it's about the future.
-- Niels Bohr



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

sergvil


-----Mensaje original-----
De: Luigi Ballabio [mailto:[hidden email]]
Enviado el: jueves, 06 de octubre de 2011 17:22
Para: sergvil
CC: [hidden email]
Asunto: Re: [Quantlib-users] BasisPointValue method does not exist in QuantLib for C#

On Thu, 2011-10-06 at 08:03 -0700, sergvil wrote:
> Thank you very much. I have a new error now, is this:
>
> "Error 1 error LNK1104: cannot open file 'QuantLib-vc100-mt-gd.lib'"

I think you're compiling the solution in Debug mode, but you compiled
the C++ library in Release mode instead.  Check that the two match.

Luigi


--

Prediction is very difficult, especially if it's about the future.
-- Niels Bohr


All projects and solution are set to Release and I have the same error. Where is located this .lib file?

Thank you very much.

Sergio.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: BasisPointValue method does not exist in QuantLib for C#

Luigi Ballabio

On Oct 6, 2011, at 7:06 PM, Sergio Villar de María wrote:

> On Thu, 2011-10-06 at 08:03 -0700, sergvil wrote:
>> Thank you very much. I have a new error now, is this:
>>
>> "Error 1 error LNK1104: cannot open file 'QuantLib-vc100-mt-gd.lib'"
>
> I think you're compiling the solution in Debug mode, but you compiled
> the C++ library in Release mode instead.  Check that the two match.
>
>
>
>
> All projects and solution are set to Release and I have the same  
> error. Where is located this .lib file?


QuantLib-vc100-mt-gd.lib is the library you get when you compile  
QuantLib in Debug mode.  If your linked looks for it, I suspect that  
one or more of your files were compiled in Debug mode for some  
reason.  Try recompiling the C# wrappers.

Luigi


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users