QuantLibXL (Excel QuantLibAddin) provides a [limited subset of] QuantLib functionality directly in Excel. However, its development follows the development of QuantLib with a lag, e.g. currently the last modified date in project repository is 2017-05-02. I tried to build QuantLibXL with currently latest version of the Visual Studio (success) and to bind it to the latest version of QuantLib (no way).
QuantLibXL is an interesting projects that plugs [some of] QuantLib power directly into your Excel. A big advantage of QuantLibAddin that the binaries (.xll file) can be downloaded in launched with a couple of clicks. This is quite different from QuantLib itself, whose compilation is alone a non-trivial action. However, QuantLibXL makes easier getting started with QuantLib only in the sense of installation. The documentation is deficient and in order to apply virtually any non-toy business logic one has to understand the QuantLib concepts (e.g. the rateHelpers to fit a yieldTermStructure).
Those, who are impatient to start applying QuantLib power are recommended to try the Deriscope. However, there are enough advanced readers that might be interested in working close to QuantLib core (source code) and simultaneously have a convenient frond-end (Excel). Then - unless they are going to blindly trust QuantLibXL calculation results - they have to build it from source and be able to debug it.
As I tried to install QuantLibXL, I first followed the installation manual. So first of all you need to download all necessarily projects from the repository. You need to the stuff from QuantLibAddin, QuantLibXL and ObjectHandler: take the latest version with is currently 1.9.0. You also need the QuantLib v1.9
leads to the following error message:
Severity Code Description Project File Line Suppression State
Error (active) no instance of constructor QuantLib::BlackSwaptionEngine::BlackSwaptionEngine matches the argument list QuantLibObjects d:\QuantLibXL\build_ql_1_9_0\QuantLibAddin\qlo\pricingengines.cpp 94
Error C2661 QuantLib::MixedLinearCubicInterpolation::MixedLinearCubicInterpolation: no overloaded function takes 10 arguments QuantLibObjects D:\QuantLibXL\build_ql_1_9_0\QuantLibAddin\qlo\interpolation.cpp 155
Error C2664 QuantLib::BlackSwaptionEngine::BlackSwaptionEngine(QuantLib::BlackSwaptionEngine &&): cannot convert argument 2 from const QuantLib::Handle to QuantLib::Volatility QuantLibObjects D:\QuantLibXL\build_ql_1_9_0\QuantLibAddin\qlo\pricingengines.cpp 94
Then, according to instruction, you need to unpack the archives to C:\build_ql_1_9_0\. Do not forget to remove the version from QuantLib directory name, so it should be QuantLib (not QuantLib-1.9). Curiously, according to the manual one needs log4cxx 0.10.0f7 repository but in there is a version log4cxx-0.10.0f6 (that makes though no difference).
You also need have Python v2.x installed (v2.x will sustain for a long time, at the recent QuantLib User Meeting Luigi said there is currently no plan to migrate to Python 3).
Further you might need to (re-)build the boost libraries. Since I already had a boost folder from QuantLib installation it was enough for me to run b2 --build-type=complete stage
making sure that --static libraries will be compiled too; I actually needed libboost_serialization-vc141-mt-s-1_65_1.lib
.
Then in Visual Studio open QuantLibXL_full_vc12.sln
. The latest version of VS known to QuantLibXL is 2013, so you need to upgrade the targets.
Set the configuration to Release (static runtime).
(you may of course to change it later to Debug static runtime but then you need to set the boost paths again, see the next step).
Then set the path to boost libraries by QuantLib
, QuantLibObjects
and ohxllib
projects.
To be on the safe side, open Makefile.vc in qlgensrc folder and set the path to Python explicitly, e.g. PYTHON=C:\Python27\python.exe
Further as you try to build the solution, you will get several times the following problem in auto_link.hpp files: QuantLibXL\build_ql_1_9_0\ObjectHandler\xlsdk/auto_link.hpp(37): fatal error C1189: #error: unknown Microsoft compiler (compiling source file ..\repositoryxl.cpp)
.
Open these files, find #if (_MSC_VER < 1400)
and replace # error "unknown Microsoft compiler" with # define XLSDK_LIB_TOOLSET "vc120" (you may try to set "vc140", which corresponds to Visual Studio 2017 but since "12" is embedded in some target names in project solution, you'd better stay by "vc120").
# error "unsupported Microsoft compiler"
#elif (_MSC_VER == 1400)
# define XLSDK_LIB_TOOLSET "vc80"
#elif (_MSC_VER == 1500)
# define XLSDK_LIB_TOOLSET "vc90"
#elif (_MSC_VER == 1600)
# define XLSDK_LIB_TOOLSET "vc100"
#elif (_MSC_VER == 1700)
# define XLSDK_LIB_TOOLSET "vc110"
#elif (_MSC_VER == 1800)
# define XLSDK_LIB_TOOLSET "vc120"
#else
# error "unknown Microsoft compiler"
#endif
Likely, there will still be some errors at linking stage due to new Visual Studio. Then carefully check Target Name by all projects in Question (C++ linker will tell you which name it expects, so just put it in Target Name).
Done, you find QuantLibXL-vc120-mt-s-1_9_0.xll
in build_ql_1_9_0\QuantLibXL\xll
FinViz - an advanced stock screener (both for technical and fundamental traders)