kdb

Changing the IPython interpreter

五迷三道 提交于 2019-12-10 17:10:56
问题 I'm using Python with kdb+. To do this I'm using PyQ, which brings Python and kdb+/Q to the same process and allows both languages to operate on the same set of data/memory space. After some effort, I am able to load Python into the kdb+/Q process on OS X using the instructions from here, i.e. running q python.q [-<python option>@ <python option value>]* python-script This is all good, but I would like to use the above command as interpreter in IPython (Notebook for research, etc.). So, how

What performance can we expect from kdb+ 32bit

我的未来我决定 提交于 2019-12-09 07:01:47
问题 Kx announced their free kdb+ (32bit) time series database. What performance in terms of reads/writes per second can we typically expect from this database? I do understand this is a complex question as the answer depends on a setup, number of nodes, etc. I am hoping someone will be able to provide us some numbers as well as use cases. 回答1: After more investigation I found sample performance benchmarks on the kx.com website: On an AMD Opteron box with 4 GB of RAM, we get 0.672 million inserts

How to create a cursor in kdb?

蹲街弑〆低调 提交于 2019-12-08 02:52:11
问题 I want to iterate over all the rows in a time series, partitioned kdb database and perform some calculation at each step. In SQL this could be done with a cursor. Is there something similar in kdb? Some background: the database consist of several million time series records and I need to maintain a state for a number of objects as I progress through the rows. There are a few 'if' statements I need to run at each step. I thought to integrate my calculation in a query, but because of the number

How to query KDB table where one column is a list?

六月ゝ 毕业季﹏ 提交于 2019-12-07 11:48:18
问题 I have a table in KDB where one of the columns is a list of symbols, for example:- q)table:([id:1 2 3 4 5] books:((`book1`book2);(enlist `book6);(enlist`book3);(enlist`book4);(`book2;`book5))) q)table id| books --| ------------ 1 | `book1`book2 2 | ,`book6 3 | ,`book3 4 | ,`book4 5 | `book2`book5 q) I want to find all the rows where `book2 is one of the books in the books column, how do I do this? So in the example above, I'd expect the 1st and 5th rows to be returned. I have tried various

Apply formula to current and previous rows only (Q/KDB)

☆樱花仙子☆ 提交于 2019-12-07 07:08:45
问题 I have a formula that I'd like to apply row-by-row, such that only the current and previous rows on any given row are included in calculation. Consider this data: data:([]dt:2017.01.05D19:45:00.238248239 2017.01.05D20:46:00.282382392 2017.01.05D21:47:00.232842342 2017.01.05D22:48:00.835838442 2017.01.05D20:49:00.282382392;sym:`AAPL`GOOG`AAPL`BBRY`GOOG;price:101.20 800.20 102.30 2.20 800.50;shares:500 100 500 900 100) data: dt sym price shares 2017.01.05D19:45:00:238248239 AAPL 101.20 500 2017

How to apply max function for each row in KDB?

[亡魂溺海] 提交于 2019-12-07 05:04:27
问题 I want to ensure all values in column x are no smaller than 0.5, so I do: update x:max (x 0.5) from myTable But this gives an error (in Studio For KDB+): An error occurred during execution of the query. The server sent the response: type Studio Hint: Possibly this error refers to wrong type, e.g `a+1 What's wrong? 回答1: You can try using | q)update x|0.5 from myTable 回答2: It should work. It worked for me. This is the query I used for testing: update x:max(x;0.5) from myTable -- Check semicolon

q/kdb+ windows server setup

感情迁移 提交于 2019-12-07 02:56:08
问题 I'm trying to setup qStudio in windows. While adding a new server, an error message pops up, saying: Connection does not work.java.io.IOException: java.sql.SQLException: Connection refused: connect. Used default "Server Properties" configuration: Host: localhost Port: 5000 Server Type: KDB Username: Password: Very new to Q/KDB+.. Searched in google, but didn't find the answer. please help! Thank you! 回答1: Might be a silly question but have you set up a KDB+ process yet? Download the free

How to join multiple tables

安稳与你 提交于 2019-12-06 13:35:12
问题 I'm trying to join multiple tables in q a b c key | valuea key | valueb key | valuec 1 | xa 1 | xb 2 | xc 2 | ya 2 | yb 4 | wc 3 | za The expected result is key | valuea | valueb | valuec 1 | xa | xb | 2 | ya | yb | xc 3 | za | | 4 | | | wc The can be acheieved simply with (a uj b) uj c BUT does anyone know how i can do it in functional form? I don't know how many tables i actually have I need basically a function that will go over the list and smash any number of keyed tables together... f:{

How to create a cursor in kdb?

喜夏-厌秋 提交于 2019-12-06 11:42:27
I want to iterate over all the rows in a time series, partitioned kdb database and perform some calculation at each step. In SQL this could be done with a cursor. Is there something similar in kdb? Some background: the database consist of several million time series records and I need to maintain a state for a number of objects as I progress through the rows. There are a few 'if' statements I need to run at each step. I thought to integrate my calculation in a query, but because of the number of tests I have to perform I think a cursor or something like a row callback would be more appropriate

How to query KDB table where one column is a list?

為{幸葍}努か 提交于 2019-12-06 01:38:28
I have a table in KDB where one of the columns is a list of symbols, for example:- q)table:([id:1 2 3 4 5] books:((`book1`book2);(enlist `book6);(enlist`book3);(enlist`book4);(`book2;`book5))) q)table id| books --| ------------ 1 | `book1`book2 2 | ,`book6 3 | ,`book3 4 | ,`book4 5 | `book2`book5 q) I want to find all the rows where `book2 is one of the books in the books column, how do I do this? So in the example above, I'd expect the 1st and 5th rows to be returned. I have tried various things using the "in" operator but either get an error or no results, for example :- q)select from books