Bloomberg Tick-By-Tick Data Download

Bloomberg maintains tick-by-tick historical data for only 140 days. However, you may want to backtest your strategies with a longer history. In this case, you can archive these tickdata by yourself and do backtesting with the archived data. Since version 0.2, AlgoQuant supports downloading tick-by-tick data from Bloomberg and saving them as CSV files via the Bloomberg Java API v3 (assuming that you have access to a Bloomberg terminal).

After you download the AlgoQuant package, you will find that there is a folder lib/blpapi-dummy which contains the Bloomberg API jar file (blpapi3.jar). This file is a dummy for AlgoQuant to compile. To use the Bloomberg Java API, you need to replace the file with the real API jar file. If your machine has been deployed the Bloomberg API, you can find the real jar file in your hard drive, for example,

C:\blpAPI\APIv3\JavaAPI\v3.4.3.2\lib\blpapi3.jar

Note that the version number of the API may be automatically upgraded by Bloomberg.

The code for connecting, downloading and saving the tickdata is located in the package com.numericalmethod.algoquant.data.historicaldata.bloomberg.  You can find in the package a simple demo application “TickDataDownloadApp“, which accepts command-line arguments and downloads tickdata of a given period for a given security:

Usage: TickDataDownloadApp <security> <startDate (yyyy-MM-dd)> <endDate (yyyy-MM-dd)> <output dir>

Note that the start date should be within 140 days as it is the oldest history you can download from Bloomberg.

Here is how it works. The Bloomberg system provides a core service named “//blp/refdata” which allows downloading a wide range of market data. The code opens a session to connect to the localhost at port 8194 (change the settings in SimpleSessionFactory if you are using a different port). Then, it sends the IntradayTickRequest with the security symbol, start and end dates. Upon receiving the response, the BloombergTickDataFileWriter saves the data as zipped CSV files in the specified output folder (one file per trading day). For example,

TickDataDownloadApp "5 HK Equity" 2012-12-01 2012-12-21 data

will save the data as .csv.zip files in the folder “data/5 HK Equity“.

Since AlgoQuant is source-available, you are free to change the code to download different data, or save the data into your database instead of files.

 

Happy downloading data! :)

 

Reference: Bloomberg API Version 3.x Developer’s Guide

2 Comments

  1. avatar

    I worked with Bloomberg data extensively ~ 2004/5, some of these issues may have been resolved but from the memory the ‘gotchas’ to look out for are:

    * Bloomberg liked to ‘group’ trades to cut down on transmission bandwidth IE rather than saying 5 trades for 1 lot went through, they would say 1 trade for 5 lots went through.

    * The command line looks something like this: {app} -s {symbol} Index -t 730 -d YYYYMMDD HHMM YYYYMMDD HHMM > {outputfile}

    * Back ~ 2004/5 you needed to modify the tool in C to add seconds to the feed, I believe this comes automatically now.

    * The amount of ticks you can request in a single request is limited, so make sure you have a mechanism to detect if your request has been truncated. I would typically request data with a crossover period & simply de-dupe the excess to make sure no data was missed.

    Good luck guys :)

    Justin

  2. avatar

    Thank you for sharing your experience, Justin. We will take heed.

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

What is 14 + 13 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)