At the end of our Online kdb+ Training Course we recommend to trainees that they take data that interests them and create a database using what they have learnt. The purpose of this article is to outline the major components that could be used to make a bitcoin trading system based upon kdb+ tick.

Bitcoin Trading System

Tutorial by Tutorial we will expand the functionality provided by our system. This outline article is to show the tasks involved, what areas of kdb knowledge are used in each and to give guidance. As such it will contain links throughout to the relevant training section in case you get stuck.

Kdb+ Tick Architecture

Kdb+Tick is a standardised architecture by kx for storing, analysising and retrieving tick data. The product provides a framework for subscribing to data, distributing the data to your C++/Java processes and storing it efficiently long term. We are going to use this recommended architecture as the basis for our system.

The major components of our market data system will be:

  • Feedhandler - Subscribes to bitcoin real time feeds, processes, cleans the data. Creates a kdb insert statement and sends that to the tickerplant.
  • Tickerplant - Accepts feed data, logs it to file and pushes out the relevant data to subscribers.
  • RDB - An in-memory database that subscribes to all symbols on the tickerplant and stores them in memory.
  • HDB - An on-disk database that stores historical tick data for previous days.

Step by Step

The recommended steps to getting a simple system up and running are:

  1. Build our Historical Time Series Database HDB by importing CSV files
  2. Write a C or Java Kdb+ Feedhandler to gather real-time bitcoin data
  3. get kdb+ tick running - Set our schema, make sure feedhandler and inserting data, get HDB running.
  4. Create a gateway to stitch together real-time and historical data
  5. Visualize our Market Data - Real-time display of our data using sqlDashboards
  6. Use Chained-Tickerplants to improve response speed of common queries
  7. Now we have our market data, lets add functionality for initiating trades, backtesting...

The list above contains links to some relevant articles, that will be extended further in future. A number of hints are also given below.

If you are enrolled on our online training course please contact us with any questions, we are always happy to help, full source code is available.


Bitcoin Real Time Data

If you have little kdb+ experience or training I recommend skipping writing a feedhandler, leaving out the tickerplant and using only a "fake" RDB database that you can populate with some random data for today. This allows skipping writing a feedhandler and dealing with tickerplants.