Coder Social home page Coder Social logo

kdb-feedhandler-tutorial's Introduction

KDB+ Feed Handler Tutorial

This project demonstrates how to build a feedhandler that interfaces with kdb+.

Additional PDF documentation on the C API can be found here

Installation & Setup

Extra Resources

This project uses CMake 2.6+ to build across multiple platforms. It has been tested on Linux and Windows. Execute the following commands on all platforms to create platform appropriate build files within the build directory.

mkdir build; cd build; cmake ..

Building on Linux

On Linux, you just need to run make install to complete the build process and find the binary output in the ../bin directory.

make install && cd ../bin

Building on Windows

On Windows platforms you will need to have the msbuild.exe available on your path. CMake creates two Visual Studio projects that need to be built. The INSTALL project will not modify any of the code and will just move the binaries from the ../build directory to the ../bin directory. An extra libqtoc.lib file will be produced on Windows, which can be ignored after the build process.

msbuild ./ALL_BUILD.vcxproj /p:Configuration=Release
msbuild ./INSTALL.vcxproj /p:Configuration=Release
cd ../bin

Running the Examples

The resulting directory after running a build should look like this:

bin/                    -- contains the fakefeed.[dll/so] and feedhandler.[dll/so] libraries and run.q
build/                  -- contains the makefiles/visual studio projects
src/                    -- contains the source code
CMakeLists.txt

Once the build is complete, navigate to the bin directory and execute:

q run.q

on Windows plaforms or on Linux:

./run.sh

The run.sh script just sets the LD_LIBRARY_PATH to look in the current directory before running the run.q script.

This will load the C shared objects and bind the functions to names (init and halt). Instructions and example commands should be displayed as soon as the the run.q script loads.

##
# run.q
#
# Example q script that loads in two functions from the feedhandler library
# and defines two tables (quote and trade). Calling the init function will
# start the feed handler and push quotes and trades into their respective
# tables. The halt function will stop the feed handler and release any
# resources it held.
#
# AquaQ Analytics
# kdb+ consultancy, training and support
#
# For questions, comments, requests or bug reports, please contact us
# w: www.aquaq.co.uk
# e: support@aquaq.co.uk
#
# examples:
#       init[] to start the feed handler
#       halt[] to stop the feed handler
#

q) init[]
q) count trade
75376
q) count quote
848361
q) halt[]
q) -10#quote
time                           sym  exg   asksize bidsize askprice bidprice sequence cond
----------------------------------------------------------------------------------------------------
2015.04.02D13:00:33.806996000 `YHOO `LSE  463i    303i    20.2     18.45    131364i  0x434040204f220200f88d
2015.04.02D13:00:33.806996000 `MSFT `LSE  118i    45i     84.6     83.06    74369i   0x40204949867f00000080
2015.04.02D13:00:33.806996000 `APPL `LSE  191i    110i    81.9     81.852   120771i  0x49464349621013404d62
2015.04.02D13:00:33.806996000 `IBM  `LSE  180i    409i    86.7     85.364   98308i   0x4343435a000000001806
2015.04.02D13:00:33.806996000 `YHOO `LSE  331i    138i    87.4     85.584   110350i  0x46405a46fb000000e502
...

Other Resources

This resource is intended to suppliment the existing Kx Wiki sections on interfacting with C and provide some concrete examples. Readers should look at the following pages on the Kx Wiki:

kdb-feedhandler-tutorial's People

Contributors

andrewshortt avatar markrooney avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.