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

problem building an expression dynamically

I'm trying to build a generic query, where I would not know the name and number of columns of a table. so assuming I have a table such as: r:([] a:til 5; b:til 5; c:til 5); I would like to build a query to calculate the difference from the…
Will
  • 910
  • 7
  • 17
0
votes
1 answer

KDB+/Q: how to understand the definitions in the language reference?

I am trying to understand the definition of an atomic function quoted here: .[f;x]~.[f';x] Now I believe the . is function application as documented here, but what is f' in the above ?
user3203476
  • 499
  • 3
  • 12
0
votes
1 answer

KDB+/Q : How does the following code work ? q) 16 16#"c"$til 256`

How does the following code work in kdb+/q , specifically, what does the first 16 do ? q)16 16#"c"$til 256 til 256 creates a list 0 .. 255, "c"$ casts each entry to type char, and 16#takes the first 16 elements, but what does the first 16 do ? I…
user3203476
  • 499
  • 3
  • 12
0
votes
2 answers

Element-wise concatenation of 2 vectors in kdb+

Given 2 vectors A and B, I want to concatenate each element of A with each element of B. For example if A and B were as follows: A: 0 1 2 B: 3 4 5 then the output should be (0 3;1 4; 2 5)
codeforkdb
  • 13
  • 1
  • 9
0
votes
3 answers

kdb: How to convert a list of dictionaries into a table whose columns are the union of dictionary keys?

I have a list of strings below. It's a simple example for now, with just 3 strings, and each string contains some keys and their corresponding values. For example, string 1 says that expiration year is 2024, birth year is 1947, issue year is 2015,…
JZL
  • 53
  • 9
0
votes
0 answers

kdb: How to double-loop over a text file and extract the values, per line, per key?

I am working on question 4 of adventofcode. I have a list of strings called "q4" where there are 3 lines (just simple data for now) and each line has keys & values, such as: passport ID being 662406624, or birth year being 1947, etc. show…
JZL
  • 53
  • 9
0
votes
1 answer

Convert string tenor to year

I have the following tenors in string (converted to symbols below) coming from a swap curve: tenors_str : `1d`6m`1y`1y6m`2y`2y6m`3y`3y6m`4y`4y6m`5y`10y`20y`30y6m I would like to create a function to parse those tenors and get the corresponding time…
JejeBelfort
  • 1,593
  • 2
  • 18
  • 39
0
votes
1 answer

How to apply an "interface" method to a set of rows in kdb?

Sorry if this is a newbie question again. I am trying to replicate the functionality of interfaces as seen in c++, rust etc. in kdb as is shown in a simple demonstration below: q).iface.a.fun:{x*y+z} q).iface.b.fun:{x*x+y+z} q)ifaces:`a`b; // for…
0
votes
1 answer

Reliably parsing/applying a function to tables vs dictionaries in kdb

I am trying to do a functional select within a function in q as follows: dosel:{[tab] ?[tab;enlist(>;`scalar;5);0b;()]}; which works perfectly on tabular input i.e. q)tab:([]time:2#.z.z;tag:0 0;direction:0 0;scalar:5 10) q)count tab 2 q).Q.s1…
0
votes
3 answers

kdb/q: How to concatenate adjacent elements in a list of strings with a space in between?

Thank you in advance for the help! (I am coming from a C++ and Python background, and not using while-loops in kdb has been hard for me) In kdb/q, I have a list of strings, let's call it "test", which looks like this. There are 7 entries in this…
JZL
  • 53
  • 9
0
votes
1 answer

kdb/q: generate all possible "strings" of length N

in KDB/Q, how do I generate all combinations given an alphabet universe (doesn't have to be string, could be like a list of numbers) for a given size n? What I am looking for is similar to this in python, but in q. How to generate all possible…
Matt Frank
  • 177
  • 6
0
votes
1 answer

kdb - combine two timeseries into one

I have data in a table with the following schema: date, time, sym, book, pnl This is a timeseries. sym/book as columns define the timeseries. I have a special usecase where I need to come up with another timeseries that combines two books…
kkudi
  • 1,625
  • 4
  • 25
  • 47
0
votes
1 answer

adding tplog writing ability to chained TP

I am trying to make Chained TP to write tplog file as well. However, what i can see from the process log is l every second. refer to this link:https://github.com/KxSystems/kdb/blob/master/tick/chainedtick.q in the shell script i already pointed out…
Terry
  • 523
  • 9
  • 21
0
votes
1 answer

adding special character to Kdb table?

I would like to add a forward slash in a field name in a table: tab:([] yes/no:`yes`yes`no;num: 1 2 3); I tried using `$"yes/no": but didnt work. any input?
Terry
  • 523
  • 9
  • 21
0
votes
1 answer

KDB+/Q:Input agnostic function for single and multi row tables

I have tried using the following function to derive a table consisting of 3 columns with one column data holding a list of an arbitrary schema. fn:{ flip `time`data`id!(x`b;(x`a`b`c`d`e);x`a) }; which works well on input with multiple rows…
James
  • 1,260
  • 13
  • 25