25 November 2007

A kdb tick/q demo

1) Install q and kdb tick, including k4.lic file

2) In install dir

mkdir data
mkdir logs

create file tick/schema.q containing:
test:([]time:`time$();sym:`symbol$();size:`float$();price:`float$())

3) create a start.sh script for kdb
#!/bin/bash
export QHOME=/usr/local/bin/q
export PATH=$PATH:/usr/local/bin/q

$QHOME/l32/q tick.k schema $QHOME/data -o 0 -p 30000 >> $QHOME/logs/tp.log 2>&1 &
$QHOME/l32/q tick/r.k :30000 -p 30001 >> $QHOME/logs/rtdb.log 2>&1 &
$QHOME/l32/q $QHOME/data/schema -p 30002 >> $QHOME/logs/hdb.txt 2>&1 &

4) run start script

5) In a seperate q session insert some data
h:hopen `:localhost:30000
h ".u.upd[`test](`ibm; 10000.0; 98.0)"

No comments:

Post a Comment