Cookbook/BloombergFeedHandler

From Kx Wiki
Jump to: navigation, search

The wiki is moving to a new format and this page is no longer maintained. You can find the new page at code.kx.com/q/interfaces/q-client-for-bloomberg.

The wiki will remain in place until the migration is complete. If you prefer the wiki to the new format, please tell the Librarian why.

Interfacing Kdb+ With Bloomberg API

Introduction

Marshall Wace have kindly contributed a linux based Bloomberg Feed Handler written by Sufian Al-Qasem & Attila Vrabecz, using the Bloomberg Open Api.

Design Notes

Bloomberg use an event driven model whereby they push EVENT objects to consumers – SUMMARY, TRADE and QUOTE. The C code in bloomberg.c handles the connectivity to the Bloomberg appliance (hosted on client’s site) and also does the conversion from an EVENT object to a dictionary (Bloomberg mnemonic <> Value pair) which is then processed on the Q main thread via the following:

Update:{@[value;x;-1"Update: '",string[x 0]," ",]}

The Bloomberg API calls back on a separate thread and copies a pointer to that object onto a lock free queue; eventfd is then used to create a K struct (a dictionary representation of the EVENT) on the Q main thread and process. A function is defined for every EVENT type (Authorize/SessionStarted/MarketDataEvent/etc …) which carries out the desired behaviour in Q.

Tested with bloomberg open api 3.6.2.0 and 3.7.5.1. Uses http://www.liblfds.org

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox