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
2 answers

Function updating multiple columns in kdb

I have a table i want to update: q)show table:([]letter:`a`b`c`a;fruit:`apple`banana`pear`strawberry;family:`mom`dad`brother`sister) letter fruit family ------------------------- a apple mom b banana dad c pear …
0
votes
1 answer

q/kdb - hitting 'constants error when adding new key-value assignments to a dictionary within a function

I am currently working on a script where within a function, key-value pairs are being added to a dictionary x - consider x as a single dictionary of different inputs used to query data, and different key-values are appended to this depending on…
cman14
  • 1
0
votes
2 answers

KDB/Q: how to join and fill null with 0

I am joining 2 tables. How do I replace NULL with 0 a column from one of the table? My code to join newTable: table1 lj xkey `date`sym xkey table2 I am aware that 0^ helps you to do this, but I dont know how to apply here
duckman
  • 687
  • 1
  • 15
  • 30
0
votes
1 answer

KDB/Q: Get sum of a certain column value

I want to create a column that equals the sum of the value in another column (colA) when the value of another column (colB) equal something. Without the condition, I can get the sum of all values in colA by using: update TotalVal: sum colB by date…
duckman
  • 687
  • 1
  • 15
  • 30
0
votes
2 answers

report progress during tplog row count using -11!(-2;`:tplog)

I'm counting the number of rows in a 1TB tplog using -11!(-2;`:tplog) internal function, which takes a long time as expected. Is there a way to track progress (preferably as a percentage) of this operation?
kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80
0
votes
3 answers

KDB/Q: how to transpose a table with null values

I have a table with 2 keyed columns. It looks like this date sym type val 2020.01.02 ABC 100 2020.01.02 ABC a2 200 2020.01.02 ANX 300 2020.01.02 XYZ a3 400 2020.01.02 XYZ a2 100 Note that type column…
duckman
  • 687
  • 1
  • 15
  • 30
0
votes
1 answer

KDB: how to create a sequence number

I would want to create a column whose value would increase if the value of another column changes. Here is an example: Party sequence ABC 1 ABC 1 ABC 1 OOO 2 OOO 2 PIM 3 AAW 4 ABC 5 TOM 6 TOM 6 TOM …
duckman
  • 687
  • 1
  • 15
  • 30
0
votes
1 answer

Strange view declaration behaviour

In the q 3.6 32bit I see something that I can not explain. Having the same parse trees these two expressions for y1 and for y2 give way too different results: q)x:3 q)parse"y :: x*10" :: `y (*;`x;10) q)parse"y:: x*10" :: `y (*;`x;10) q)y1 ::…
egor7
  • 4,678
  • 7
  • 31
  • 55
0
votes
2 answers

How to put multiple where statements into function on kdb+

I'm trying to write a function using kdb+ which will look at the list, and find the values that simply meet two conditions. Let's call the list DR (for data range). And I want a function that will combine these two conditions "DR where (DR mod 7) in…
B.Q.
  • 1
  • 1
0
votes
2 answers

KDB+:Efficient method of converting a 2 stage query into a one stage query?

I would like to convert the following query into a single query tab:([price:til 10]side:10?-1 1;qty:990 + 2 * til 10); a:select[>price] from tab where side=1; b:select from a where sums[qty] <= max(min[sums qty];100); or select from…
James
  • 1,260
  • 13
  • 25
0
votes
1 answer

Skipping the errors and recording downloads in kdb

I am trying to use kdb q script to download file from remote source. How can I make the download keep going if there is an error? also, how can i mark it down what its downloaded in linux when there are other files in the same directory??? Here is…
Terry
  • 523
  • 9
  • 21
0
votes
1 answer

using .Q.dpft function to resave table

I am trying to load the data for each date and then sort the sym column and apply the parted attribute. But I don’t know how to use the .Q.dpft function to save to the same table? There is a trade table in hdb. Here is my function: \l dbdir; test:{ …
Terry
  • 523
  • 9
  • 21
0
votes
2 answers

sort data in hdb by using dbmain.q in kdb

I am trying to sort 1 or 2 columns in a hdb in kdb but failed. This is the code I have fncol[dbdir;`trade;`sym;xasc]; and got a length error when I called it. But I don't have a length error if I use this…
Terry
  • 523
  • 9
  • 21
0
votes
1 answer

Filling missing data in a table

I have a problem with missing data. So I have a returns table created this way: returns:update logret:log ret from update ret:{0.0, 1_deltas x} mid by sym from spots; and looking like this: meta returns c | t f a ------| ----- date | d …
Will
  • 910
  • 7
  • 17
0
votes
1 answer

How to query with "IN" in Q (kdb)?

Let's assume that I have a table in KBD named "Automotive" with following data: Manufacturer Country Sales Id Mercedes United States 002 Mercedes Canada 002 Mercedes Germany …
equanimity
  • 2,371
  • 3
  • 29
  • 53