EU market liquidity risk and kdb+

Analysis of EU market liquidity & collateral haircuts using kdb+

9 Nov 2017 | , , ,
Share on:

by Florian Glaser and Sven Panz

This blog is excerpted from a longer paper written by Florian Glaser and Sven Panz for the European Systemic Risk Board called (Pro?)-cyclicality of collateral haircuts and systemic illiquidity. Florian is a Research Group Lead at the Karlsruhe Institute of Technology (KIT) and Sven is a PhD candidate in Finance at Goethe University Frankfurt/ Main. Kx provided a free kdb+ academic license for this research project.

The research challenge

In this paper, we aim to fill the gap of empirical insights regarding systemic risk and the relationship between market wide illiquidity and collateral haircuts. These haircuts can be understood as the percentage by which a security is devalued relative to its market value when it is used as collateral. Haircuts are designed to comprise a counterparty risk component reflecting the issuer’s creditworthiness as well as a liquidity component, taking the ease of liquidation into account. Hence, haircuts are supposed to increase in periods of raising volatility and decrease in periods of declining volatility on a micro-prudential level. These pro-cyclical tendencies of haircuts and their significant consequences to market-wide liquidity are subject to an ongoing discussion among academics and regulatory authorities in the context of macro-prudential regulation since the aftermath of the financial crisis in 2008.

To investigate possible pro-cyclical patterns, we propose a methodology that can also serve as a quantitative trigger to stop deteriorating liquidity spirals. Our empirical approach consists of two steps: First, we measure systemic illiquidity as the price deviation from actual and theoretical bond yields by aggregating cross-sectional pricing errors between theoretical bond yields, which are computed as the present value of discounted coupons, neglecting any risk, and actual market yields. Second, using a bubble detection methodology, we identify periods of irrational tendencies. Based on this setup we compare the overall market illiquidity with identified periods of exuberance and a synthetic illiquidity under the application of haircuts within the collateral portfolio.

The kdb+ advantage

The data underlying our analysis represents a full view of all collateral positions posted within the last 15 years on a daily basis by every clearing member of a large European CCP. Preliminary analyses to get an idea of different dimensions and characteristics of the dataset required us to frequently filter, aggregate and transform billions of collateral portfolio positions.

The superior performance of kdb+ reduced our “time to data” and significantly improved the time gap between coming up with a new idea or research question and the corresponding data sample. The neat integration with R and other statistical software enabled us to easily feed the sampled data as input to our QuantLib pricing engine, analytical scripts or visualization tools.

Kdb+’s very expressive and impressive inherent language – q – made writing and executing new functions for processing data blazingly fast and reduced the amount of lines of code to an easily maintainable minimum. Once we were familiar with q, using domain specific built-in functionality in q-sql queries often reduced common and peculiar data transformation to a single line of code.


Our results confirm that bond collateral markets face irrational, i.e. bubble-like illiquidity during periods of systemic distress. Against theoretical rationale, we observe neither a foreshadowing nor an amplifying behavior of the current haircut implementation and conclude that the design of past and present haircuts does not exacerbate market-wide illiquidity.

© 2017 Kx Systems
Kx® and kdb+ are registered trademarks of Kx Systems, Inc., a subsidiary of First Derivatives plc.


Kx collaborating with Fintech startup chartiq

Collaboration: The Dominant Trend in Finance

13 Dec 2017 | , , , ,

In December we are re-blogging some of our favorite content from Kx partners and affiliated companies, starting with this article on the ChartIQ blog. ChartIQ is an agile FinTech company that sells an advanced HTML5 charting library used in technical data analysis, trading configurations and for charting in the capital markets industry. Kx offers a ChartIQ integration as an addition to our Dashboards. In Collaboration: The Dominant Trend in Finance, ChartIQ’s Hanni Chehak writes about the rise of FinTech companies, and the role collaboration plays as FinTech companies are increasingly disrupting the traditional banking sector.

Water system workers with kdb+ historical database

Kdb+ Use Case: Machine Learning Water System Maintenance Application

6 Dec 2017 | , , , ,

Kdb+ is being used much more widely in machine learning applications today. Its ability to quickly ingest and process data, particularly large, fragmented datasets, is one way that developers are adding kdb+ to their technology stack of artificial intelligence and machine learning tools.
For Australian kdb+ developer Sherief Khorshid, who also develops machine learning systems, incorporating kdb+ into a predictive maintenance application gave him the edge in a hackathon win that landed him a cash prize and a contract with the Water Corporation of Western Australia.

kdb+ FFI

Kdb+ FFI: Access external libraries more easily from q

22 Nov 2017 | , , ,

Following on from the hugely popular Python library and interface embedPy and PyQ, Kx has released an FFI as part of the Fusion for kdb+ interfaces. As with embedPy and PyQ, this FFI is open-sourced under the Apache 2 license.
The kdb+ FFI is a foreign function interface library for loading and calling dynamic libraries from q code. It has been adapted and expanded upon from a library originally written by Alex Belopolsky of Enlightenment Research. With the kdb+ FFI you can now call your favorite C/C++ libraries directly from q without the overhead of having to compile shared objects and load into q using the 2: command.