KDB Cheatsheet
Remote Connection
Use authenticated hopen when process access control is enabled:
h:hopen `:localhost:6002:admin:admin
Remote Query Examples
Run qSQL over handle h:
h "select avg bid, avg ask from quote where sym=`TSLA"
With aliases:
h "select avgbid:avg bid, avgask:avg ask from quote where sym=`TSLA"
Notes:
- Use q symbol literal in where clause:
sym=TSLA` - Use commas between select expressions in qSQL
Run feed_ws.q (Bash)
From repo root, start the torq service (host shell):
docker compose -f localhost-docker-compose.yaml up -d torq
Open a shell in the torq container:
docker exec -it sravz-torq-1 bash
Inside the container, source env and run the feed websocket script:
source /opt/backend-q/deploy/bin/setenv.sh
q "$TORQHOME/torq.q" -proctype feed -procname feed_ws1 -p 6098 -debug -noredirect -trap -load "$KDBAPPCODE/tick/feed_ws.q"
