Framework
NB: The Framework is not maintained, it was last updated in version 1.8 (2016).

The QuantLibXL Framework is an application layer written in Excel VBA which wraps the QuantLibXL Addin with additional functionality in support of market data feeds, creation of instruments, etc.

1 Overview
1.1 Installation
1.2 Startup
1.3 User Interface
2 Code
2.1 QuantLibXL.xla
2.2 Errors.xla
2.3 Utilities.xla
2.4 Configuration.xla
2.5 Loader.xla
2.6 Events.xla
2.7 Keyboard.xla
2.8 Shortcut.xla
2.9 Menu.xla
2.10 CellMenu.xla
2.11 Serialization.xla

1 Overview

1.1 Installation

The application only works under 32-bit Excel. Under 64-bit Excel, the XLL works, but the VBA code does not.

Here is the link to the zip file for 32-bit Excel:

QuantLibXL-1.8.0-framework.zip.

We have packaged up a build for 64-bit Excel, and it is configured to load the 64-bit XLL, but as mentioned the VBA code does not work under 64-bit Excel so this build is broken. If you would like to help fix it then please send mail to quantlib-users@lists.sf.net.

QuantLibXL-1.8.0-x64-RateCurveFramework.zip.

Download the zip file to your hard drive and uncompress it.

1.2 Startup

The installation provides a large selection of DOS batch files for launching the application. For each supported currency, two batch files are provided, one for a live data feed (if you have Reuters installed on your machine) and another which loads a static snapshot of market data. Choose the desired batch file, e.g. session_file.EUR-s-static.bat, and double-click it.

Excel should start up and load the Framework application, which should then initialize the chosen market data environment. After a few moments you should see the main checks workbook:

The market environment is now initialized with over 2,000 data objects loaded (rates, indexes, curves, ...) You can now create pricing worksheets which define instruments that price against this data.

1.3 User Interface

The Framework menu appears on the ribbon under the Add-Ins tab.

The menu is context sensitive. The first item in the menu displays the functions supported for the active workbook. If no workbook is active, or if the active workbook does not belong to the Framework, then the menu placeholder [Workbook] appears grayed out as in the image above.

Similarly the second item in the menu is the function configured for the active worksheet, if any, otherwise the word [Worksheet] grayed out.

The third item in the menu displays the functionality relating to whatever Addin is currently loaded.

Right clicking in a cell brings up a QuantLibXL menu.

Similar to the main menu bar, the contents of the right click menu may change depending on which workbook, worksheet, or range is active, or which addins are loaded.

2 Code

QuantLibXL.xla resides in the framework directory and all of the other Excel VBA code resides in xla files in the addin subdirectory.

A comment block is provided for every addin (xla) file in the ThisWorkbook module.

Every addin is given a project name in the format qlxlXxx. Naming every project with the qlxl prefix causes the addins to appear together in the project window in the Excel VBA editor.

2.1 QuantLibXL.xla

QuantLibXL.xla is the entry point for the application. The Workbook_Open event loads some additional modules which are essential for minimum functionality: Errors.xla, Utilities.xla, Configuration.xla, Loader.xla

2.2 Errors.xla

Errors.xla provides a central implementation for all error handling for the application. Errors.xla implements three functions in support of error handling:

raiseError: To be called at the point where an error is detected.

propagateError: May be called at an intermediate frame in the stack - above where the error is detected and below where it is handled. Appends additional information to the error.

displayError: Displays the error message to the user. All entry points into the Excel VBA code must be wrapped in On Error Goto / Catch, and the Catch must call displayError.

2.3 Utilities.xla

Implements various utility functions for the application, including access to the file system, processing for ranges/sheets/books, etc.

2.4 Configuration.xla

Configuration.xla implements a global singleton object which encapsulates various information related to the running instance of the Framework application. The configuration object is accessed via wrapper function Config, e.g:

Debug.Print "root dir = " & Config().rootDirectory

2.5 Loader.xla

Loader.xla implements a facility for loading components required by a given instance of the Framework. A component can comprise any item which may be loaded or utilitzed from Excel, e.g. worksheets, addins (VBA, C++, etc), DLLs.

The loader allows dependencies between components to be defined. When a request is made to load a given component, the loader checks whether that component's prerequisites are present and loads them if not.

The environments recognized by the loader are configured in workbook QuantLibXL\framework\config\Loader.xls. Loader.xla imports Loader.xls at startup.

To load a given environment, call loadEnvironment("xxx") where xxx is a column in Loader.xls.

2.6 Events.xla

Events.xla implements an event listener which intercepts various Excel events, such as the activation of a workbook. These event handlers are used to call various Framework functionality, such as recreating menu items in response to a change in context.

2.7 Keyboard.xla

Keyboard.xla implements a few keyboard shortcuts for the application.

2.8 Shortcut.xla

Shortcut.xla is a small utility addin which can be used to create a shortcut (icon, link) for the Framework application. For example, after installing the Framework to a network drive, you can use Shortcut.xla to generate a .lnk file that anyone can use to invoke the application from the server.

2.9 Menu.xla

Menu.xla creates the QuantLibXL menu on the main Excel toolbar.

2.10 CellMenu.xla

CellMenu.xla creates the QuantLibXL entry on the menu which appears when the user right clicks on a cell or range.

2.11 Serialization.xla

Serialization.xla implements support for serialization. This implementation relies on the fact that the QuantLibAddin C++ layer implements boost::serialization for all of the classes in the QuantLib library. Serialization.xla can be used to export/import a hierarchy of objects from/to a workbook.