Anyone have any experience using SWIG? I am currently researching QuantLib and saw that C# code can be generated using SWIG. We are exploring options to create a combined library of financial functions using QuantLib and a proprietary closed source library (which will probably be made available as .Net dlls). The idea is to combine both of these to create a unified super library. I have seen the .Net port of QuantLib, but it seems that it is not actively maintained (and not entirely sure of how much was actually ported), so I am avoiding it.
Step 1 of this is to evaluate the difficulty in producing a library that can be used 'anywhere' i.e. MS office applications ( via VBA), console apps as well server-side (eg web apps). I assume that this involves COM Interop, but I have no clue where to start or if I am even on the right track.
The SWIG folder contains several subfolders, depending on your language of choice, in my case C# was the one that interested me. You will need to download SWIG first and it the executable to system PATH variable.
With respect to my development environment, what would I need?It seems that the current version of QuantLib only builds with VS 2008. There have been some changes to VS 2010 which causes some issues with compilation. The C# project builds fine, however just remember to change the Target Framework from v4 to v3.5 to lower.
Note: As the time of writing this there was an issue with the QL_HEX_VERSION number in the source files of the C++ SWIG project. After running the swig.cmd open the VS project, and change Line 344 of quantlib_wrap.cpp to
I have emailed the project author, and awaiting feedback. Edit: Luigi, correctly informed me that this is any issue with the code in SVN (which I used). He suggested that the QuantLib-SWIG-1.0.zip bindings should be used.
This blog post is about QuantLib and how to get it working in CLion. For those of you who are unaware of what QuantLib is, it is an open-source quantitative finance library, covering many aspects of financial mathematics, including instrument pricing, financial calendars, and more. It has some sophisticated math, and also exhibits some interesting design patterns that C++ practitioners might find interesting.
QuantLib depends on the Boost libraries, which need to be installed and built in order to successfully build QuantLib. Some parts of Boost are header-only (no compilation at all required), but other parts are not, meaning they have to be built and, unfortunately, QuantLib uses these Boost libraries, so we have no choice but to compile. The general procedure is as follows:
My recommendation is to investigate a little and fine-tune the compilation of Boost to your liking. For example, in my case, I use a RAM disk (about 20Gb) to build Boost in, including the following options:
Note also, that in case of Cygwin, you can install Boost headers from Cygwin (just select the corresponding package when running Cygwin installer). This will make it easier for CMake to find your Boost headers.
We now need to import the QuantLib project into CLion wholesale. To do so, choose Import Project from Sources from the start menu. If you cloned QuantLib sources into c:\lib\quantlib, then the folder you want import is c:\lib\quantlib\QuantLib:
Now, of course, we have a question of how to consume the library.First of all, pick or make the executable that you want to use with QuantLib. Check out the \Samples folder for some examples. If you want to build such a sample, there are two simple steps to follow:
By submitting this form, I agree that JetBrains s.r.o. ("JetBrains") may use my name, email address, and location data to send me newsletters, including commercial communications, and to process my personal data for this purpose. I agree that JetBrains may process said data using third-party services for this purpose in accordance with the JetBrains Privacy Policy. I understand that I can revoke this consent at any time in my profile. In addition, an unsubscribe link is included in each email.
Limit to suite:[buster][buster-updates][buster-backports][bullseye][bullseye-updates][bullseye-backports][bookworm][bookworm-updates][bookworm-backports][trixie][sid][experimental]Limit to a architecture: [alpha] [amd64] [arm] [arm64] [armel] [armhf] [avr32] [hppa] [hurd-i386] [i386] [ia64] [kfreebsd-amd64] [kfreebsd-i386] [m68k] [mips] [mips64el] [mipsel] [powerpc] [powerpcspe] [ppc64] [ppc64el] [riscv64] [s390] [s390x] [sh4] [sparc] [sparc64] [x32] You have searched for packages that names contain quantlib in all suites, all sections, and all architectures.Found 12 matching packages.
To load QuantLib's calendars use load_quantlib_calendars definingwhichcalendar has to be loaded by its name and the range of dates the calendarhas to handle.All QuantLib calendars have the QuantLib prefix.
This argument defines the calendar as a financial or a non financialcalendar.Financial calendars don't consider the ending business day when countingworking days in bizdays.In QuantLib, Financial calendars are those that includeLast is setto FALSE.
c80f0f1006