Questions tagged [kdb]

kdb+ is a proprietary high-performance database developed by Kx Systems.

kdb+ is a proprietary high-performance database developed by KX.

Features

  • Scalable column-oriented database for massive data volumes
  • Manages real-time and historical data in one platform
  • A single system allowing for low latency communication between kdb+ processes
  • Coupled with the expressive q programming and query language

It comes with a programming language called q (or kdb/q). Both q and kdb are written in the k language which has the tag on this site.

More Information

KX have recently launched the KX Community, a site moderated daily by KX employees to ensure all questions are answered. For any questions, on q/kdb+ or any of the KX technology and products, our KX experts are on hand to help!

2014 questions
0
votes
1 answer

kdb: filter table match symbol column: ~ vs =

For a where clause to filter on symbol columns, = works fine, but why does the match operator ~ not work? q)t:([sym:`aa`bb]qty:20 30) q)t sym| qty ---| --- aa | 20 bb | 30 q)select from t where sym=`aa sym| qty ---| --- aa | 20 q)select from t…
kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80
0
votes
2 answers

FK field over IPC

Some prerequisites on the remote process: q)\p 15222 q)t:([id:10 20 30]data:`aa`bb`cc); q)kt:([]id:`t$10 20 20 30 30 30; num:til 6); and the following will be performed on a local process: The size of kt looks the same from both…
egor7
  • 4,678
  • 7
  • 31
  • 55
0
votes
2 answers

most performant way to get asof price given a list of timestamps

I have a list of timestamps spanning multiple dates ( no sym, just timestamps). These can be 1000/2000 at times, spanning multiple dates. What's the most performant way to hit an hdb and get the closest price available for each timestamp? select…
kkudi
  • 1,625
  • 4
  • 25
  • 47
0
votes
2 answers

KDB/Q: create a new column based on the value of other columns

This might be a simple question but I cannot get it to work. I am trying to create a column varNew that equals half of a column Price if only one of the columns var1 and var2 has a value of 1. var1 and var2 only takes a value of 0 or 1. If both var1…
duckman
  • 687
  • 1
  • 15
  • 30
0
votes
1 answer

how to pivot table wide to long in q

I'm trying to write a function to pivot my tables from wide to long format. so I have something on this lines: tblwide:([]k1:`a`a`b`b`c`c;xx:1 2 3 4 5 6;yy:11 12 13 14 15 16); wide2long:{[lhscolnames;rhscolname;varcolname;valuecolname]…
Will
  • 910
  • 7
  • 17
0
votes
1 answer

Protected execution, 2 cases

Why does in first following case protected execution work, but in second does not?: q)t:([]a:1 2;b:3 4); q)@[@[cols t; ; :; `bb]; (cols t)?`b; `columnNotFound] `a`bb q)@[@[cols t; ; :; `cc]; (cols t)?`c; `columnNotFound] // 1. works…
egor7
  • 4,678
  • 7
  • 31
  • 55
0
votes
1 answer

QPad64's (QInsightPad's) output window

How do I get the q script output to be displayed in QPad64's (QInsightPad's) output window. I am presently starting q and QPad 64 with the following .bat file : set QHOME=C:\Q\q set QINIT=C:\code\server.q set PATH=%PATH%;%QHOME%;%QHOME%\w32 START…
0
votes
1 answer

null aware covariance matrix in KDB

I'm working through Funq by Nick Psaris but need a null aware function for making a covariance matrix. I will use it to create a mahalanobis distance matrix. He supplies some null aware functions: navg = null aware avg nvar null aware var nsvar =…
0
votes
1 answer

TP sends signal to subscribers from which function in Kdb+?

I know at EOD, TP sends signal to all its subscribers and call .u.eod function. However, what function in TP that sends signals to its subscribers? I would like to know. I am currently revising my CTP code and worried the signal will not be sent to…
Terry
  • 523
  • 9
  • 21
0
votes
1 answer

Select from a table with Limit expression works, without - fails

For a table t with a custom field c which is dictionary I could use select with limit expression, but simple select failes: q)r1: `n`m`k!111b; q)r2: `n`m`k!000b; q)t: ([]a:1 2; b:10 20; c:(r1; r2)); q)t a b c ---------------- 1 10 `n`m`k!111b 2 20…
egor7
  • 4,678
  • 7
  • 31
  • 55
0
votes
1 answer

How to uncompress a message with kdb (32 bit)?

I'm trying to decompress a message optimized by Deflate compression in kdb i.e. the following…
0
votes
2 answers

KDB/Q how do we calculate the moving median

There are already moving average in kdb/q. https://code.kx.com/q/ref/avg/#mavg But how do I compute moving median?
Matt Frank
  • 177
  • 6
0
votes
1 answer

kdb: does a leading plus sign mean a Q table?

I often see output like +`col1`col2`col3!(,`a`b`c;,{x+1};,()!()). I suspect it means a table, but wasn't able to find documentation on this syntax. What does the leading + mean? Could someone provide a link to a reference page?
kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80
0
votes
1 answer

Enums for tables

I found no information about what the enum is over the table domain on https://code.kx.com/q/ref/enumerate/. But something interesting exists there: https://code.kx.com/q/kb/linking-columns. I tried those examples and found an enum structure that…
egor7
  • 4,678
  • 7
  • 31
  • 55
0
votes
1 answer

how does ticketplant write the new tplog next day in kdb?

I know tickerplant will write tplog when it receives data. at the end of the day, ticker plant will start writing a new tplog. I see tp.q but cannot figure out which function does that. I know .u.tick start writing the tplog on disk but dont see…
Terry
  • 523
  • 9
  • 21