• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Poll: for how much would you buy a book on "Getting Started with QuantLib"?

For how much would you buy a book on "Getting Started with QuantLib"?

  • For at most $10

    Votes: 18 30.0%
  • For at most $20

    Votes: 5 8.3%
  • For at most $30

    Votes: 5 8.3%
  • For at most $50

    Votes: 4 6.7%
  • I would also pay $100 if the book is really good

    Votes: 1 1.7%
  • I would not buy in any case

    Votes: 15 25.0%
  • What is QuantLib?!

    Votes: 12 20.0%

  • Total voters
    60
Nowadays the primary lack is that of time, not of hardware resources or ready-to-use libraries.

It only seems that way. You gotta invest in the upkeep of software products. In general, adding new features to a product takes longer and longer. That is the issue IMO, not time as such. It's a management issue.

I have seen some legacy code, which had to fit in 640K RAM => elegance and well-thought optimization.

You lucky devil. What did you do with the left-0ver memory? Used it for games. We used to write COBOL applications in 4K.

Imagine being the architect of a team of ZX80 programmers? Hardware and tools change, but humans tend to remain constant.
 
Last edited:
If you were to write a book on something like "QL by Example" I would buy it.
e.g. ready-to-run examples + exercises on how to extend it. It would save so much time.

[40,50]$ range.
 
Last edited:
If you were to write a book on something like "QL by Example" I would buy it.
Thanks, probably I indeed will.

My previous attempt seems to be a bit premature but - at least I got this impression from recent QuantLib User Meeting - QuantLib slowly but steadily conquers the financial branch.
In particular a guy (from one big insurance company), who almost laughed at my QL enthusiasm several years ago, now use it himself and has given a talk at one of QLUMs.
 
One way to make QL more widespread is to use C++/CLI to the .NET world.

1. Call QL from C#.
2. Call C# from QL.

C++/CLI is a set of extensions made to C++ to benefit from the services that an implementation of the Common Language Infrastructure (CLI) offers. It can be seen as a .NET language in its own right and you will find it easy to learn if you know (native) C++ and some C#. In particular, you can freely mix C++/CLI and C++ code in a project and in this sense we say that C++/CLI is bilingual because it can talk to both .NET and native C++ code.
 
I don't know QLXL and cannot find a feature list. I suspect it is kinda legacy stuff in C(?). I have used C++ ATL and other stuff in the past which is also a pain in the derriere.

C# and Excel-DNA is the best IMO and you can use .NET libraries and adapers to native C++ via C++/CLI.
And SWIG is not needed.

Excel-DNA

Not sure if Python-Excel is such a great idea.. but I could be wrong. It is very fashionable at the moment (Python I mean, not being wrong).

Microsoft products work well with Microsoft products
 
Last edited:
Here is a small test of Excel-DNA, C# and a C++ wrapper.
(Adapter design pattern).

Code:
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ExcelDna.Integration;
using ExcelDNA_CPPCLI; // C++ code

namespace ExcelDNA
{
    public static class MyFunctions
    { // This is now a proxy to Excel; the real stuff is C++

        [ExcelFunction(Description = "My first")]
        public static string SayHello(string name)
        {
            //  return "Hello, there " + name;
            return MyFunctionsCLI.SayHelloCLI(name);
        }

        [ExcelFunction(Description = "My Sum")]
        public static string MySum()
        {
                double sum = MyFunctionsCLI.MySum();
                string result = sum.ToString();

                return result;

         }

        [ExcelFunction(Description = "BS")]
        public static double CallPrice(double K, double T, double r, double v, double S)
        {
            return MyFunctionsCLI.CallPrice(K, T, r, v, S);
        }
    }
}
 
Last edited:
I don't know QLXL and cannot find a feature list.
Feature list is available here ("list" is to understand literally: just an enumeration with very little guidance)
QuantLibXL: Functions

I suspect it is kinda legacy stuff in C(?).
Seems to be, it actively uses
Code:
/*
** XLOPER structure
**
** Excel's fundamental data type: can hold data
** of any type. Use "R" as the argument type in the
** REGISTER function.
**/

typedef struct xloper
{
    union
    {
        double num;                    /* xltypeNum */
        LPSTR str;                    /* xltypeStr */
#ifdef __cplusplus
        WORD xbool;                    /* xltypeBool */
#else  
        WORD bool;                    /* xltypeBool */
#endif  
        WORD err;                    /* xltypeErr */
        short int w;                    /* xltypeInt */
        struct
        {
            WORD count;                /* always = 1 */
            XLREF ref;
        } sref;                        /* xltypeSRef */
        struct
        {
            XLMREF *lpmref;
            IDSHEET idSheet;
        } mref;                        /* xltypeRef */
        struct
        {
            struct xloper *lparray;
            WORD rows;
            WORD columns;
        } array;                    /* xltypeMulti */
        struct
        {
            union
            {
                short int level;        /* xlflowRestart */
                short int tbctrl;        /* xlflowPause */
                IDSHEET idSheet;        /* xlflowGoto */
            } valflow;
            WORD rw;                /* xlflowGoto */
            BYTE col;                /* xlflowGoto */
            BYTE xlflow;
        } flow;                        /* xltypeFlow */
        struct
        {
            union
            {
                BYTE *lpbData;            /* data passed to XL */
                HANDLE hdata;            /* data returned from XL */
            } h;
            long cbData;
        } bigdata;                    /* xltypeBigData */
    } val;
    WORD xltype;
} XLOPER, *LPXLOPER;


Not sure if Python-Excel is such a great idea.. but I could be wrong. It is very fashionable at the moment (Python I mean, not being wrong).
I am quite sure Excel IS a bad thing for productive application :)
(Rather then use VBA, AddIns or whatever one can read from Excel files and write output to them, if Excel as "Data Container" is desired).
But QuantLib-Python, contrary to QuantLibXL, works also without Excel.
And I think one can develop much faster with it, at least when one uses the functionality, which is already implemented in QuantLib.
Moreover, Python is very good at machine learning... and I could have had a project, in which both ML and FinMath libraries are necessary.
 
I am quite sure Excel IS a bad thing for productive application :)

But it is very popular. Is there an alternative?

That XLA stuff is not very future-proof (64 bit VBA is non-starter?)
 
Last edited:
I am quite sure Excel IS a bad thing for productive application :)

But it is very popular. Is there an alternative?

That XLA stuff is not very future-proof (64 bit VBA is non-starter?)
I think any "good" scripting language with ability to create and read from Excel sheets is a better alternative to VBA-macros and Excel-AddIns.

As I have already said, I gotta try it with QuantLib-Python. Before I was reluctant to learn Python, in spite of all hype I found it "yet another scripting language with a strange syntax (I got used to parentheses)". But now most deep learning frameworks use Python and since I am also a Data Scientist, I have to learn it. Moreover, finally there is an ability to optionally specify static types which I really like (because it allows to generate nice autodoc with Doxygen).
 
And now fitting a yield curve with QuantLib Python
QuantLib Python - Twisting a Snake to fit a Yieldcurve

python_curve.jpg
 
I haven't used NelsonSiegler; is it arbitrage-free?
No. Moreover, Damir Filipovic did a fine research, in which he has shown a kind of inconsistency of NS with HJM Framework.

What's the rationale for using it?
Because in Europe Nelson-Siegel-Svensson is de-factor a standard model, in particular Deutsche Bundesbank, German Finance Agency (and likely the ECB) use it.
The reason behind is likely the economic interpretation of model parameters but as this paper correctly affirms: economic interpretation should stop well before a problem cannot be numerically solved any more.
 
It is used because it's simple, easy to understand and you know its short comings fairly well.
Of course, the same can be said of linear and cubic spline interpolation.
In general, we found Hagan-West and Hyman (montone-preserving) method best for the 3-year yield curve (sparse input data).

Just out of curiosity, is NS used for short-rate models (e.g. Hull White 2 factor?)
 
In general, we found Hagan-West and Hyman (montone-preserving) method best for the 3-year yield curve (sparse input data).
Best in which sense?


Just out of curiosity, is NS used for short-rate models (e.g. Hull White 2 factor?)
Yes. Although it is inconsistent: HW is arbitrage free, NS is not.
But who cares? :)
Or who cared about theoretical inconsistencies by a usage of Black'76 for pricing options on bonds (until the LIBOR model appeared)?

Moreover, in pricing and trading it is quite essential to have an arbitrage-free model.
In risk-management not really, e.g. if you want to simulate the sensitivity of your portfolio to the change of interest rates.
 
For 'best' see the Hagan-West paper I posted.
BTW keeping on QL, it supports such methods.
 
Back
Top