KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Several question of KDB+ and Q Re: Several question of KDB+ and Q

  • Laura

    Administrator
    December 6, 2021 at 12:00 am

    Thanks for your questions!

    1. If f1 in your example is a column, you can simply assign this in your select statement e.g.

    f1var: select f1 from table1

    then f1var will be available to you to use as a local variable

    2. I’ll need a little more information to answer this question fully for you. By cointegration do you mean combining two columns into one? If so, this will depend the datatypes of the columns.

    You can see an example of combining two columns into a single column here: https://code.kx.com/q/basics/qsql/#computed-columns

    3. The drop command in SQL is similar to the delete keyword in q. You can delete a table from memory by running something like

    tables[] `aggregate_quote`aggregate_quote1`trades delete aggregate_quote1 from `. tables[] `aggregate_quote`trades

    Take care when using this. The delete keyword will only work for removing variables from a namespace and will not delete from a partitioned database, for example. More info here https://code.kx.com/q/ref/delete/

    4. I’m not familiar with ta-lib myself, but from a quick google I can see that it is a python library for technical analysis of financial data. We don’t have libraries as such for this kind of analysis – financial analysis is really q’s bread and butter, with or without use of one of our KX products. But we also have the option to integrate with python in a few different ways: https://code.kx.com/pykdb/comparisons.html

    Hope this helps!

    Laura