rocuinneagain
Forum Replies Created
-
rocuinneagain
MemberApril 22, 2024 at 7:29 pm in reply to: message after print to stderror not shownIf statements in q do not return data.
“The result of if is always the generic null.”
q)result:if[1b;1]
q)result
q).Q.s1 result //The generic null is returned
"::"
//You can include the date in the printed output:
q){if[x>1;-2"Warn ",string[x]," above threshold 1 ",string .z.D]} 2
Warn 2 above threshold 1 2024.04.22
code.kx.com
if control word | Reference | kdb+ and q documentation - Kdb+ and q documentation
if is a q control construct for conditional evaluation of one or more expressions.
-
We added some functionality in version 2.3.0
https://code.kx.com/pykx/2.4/release-notes/changelog.html#pykx-230
If you enable beta features as well as pykx threading all calls into q from any python thread will be run as if they were calling from the main thread which allows python multithreaded programs to use IPC connections in licensed mode.
You can enable this functionality like this:
import os
os.environ['PYKX_THREADING'] = '1'
os.environ['PYKX_BETA_FEATURES'] = '1'
import pykx as kxYou will also want to ensure that kx.shutdown_thread() is called when the script finishes. The safest way to do this is within a try – finally block like this.
if __name__ == '__main__':
try:
main()
finally:
kx.shutdown_thread()More information about this functionality and an example can be found within our documentation:
https://code.kx.com/pykx/2.4/examples/threaded_execution/threading.html
-
We added some functionality in version 2.3.0
https://code.kx.com/pykx/2.4/release-notes/changelog.html#pykx-230
If you enable beta features as well as pykx threading all calls into q from any python thread will be run as if they were calling from the main thread which allows python multithreaded programs to use IPC connections in licensed mode.
You can enable this functionality like this:
import os
os.environ['PYKX_THREADING'] = '1'
os.environ['PYKX_BETA_FEATURES'] = '1'
import pykx as kxYou will also want to ensure that kx.shutdown_thread() is called when the script finishes. The safest way to do this is within a try – finally block like this.
if __name__ == '__main__':
try:
main()
finally:
kx.shutdown_thread()More information about this functionality and an example can be found within our documentation:
https://code.kx.com/pykx/2.4/examples/threaded_execution/threading.html
-
rocuinneagain
MemberApril 19, 2024 at 12:10 pm in reply to: PyKX could not establish an IPC connection in the Flask appWe added some functionality in version 2.3.0
https://code.kx.com/pykx/2.4/release-notes/changelog.html#pykx-230
If you enable beta features as well as pykx threading all calls into q from any python thread will be run as if they were calling from the main thread which allows python multithreaded programs to use IPC connections in licensed mode.
You can enable this functionality like this:
import os
os.environ['PYKX_THREADING'] = '1'
os.environ['PYKX_BETA_FEATURES'] = '1'
import pykx as kxYou will also want to ensure that kx.shutdown_thread() is called when the script finishes. The safest way to do this is within a try – finally block like this.
if __name__ == '__main__':
try:
main()
finally:
kx.shutdown_thread()More information about this functionality and an example can be found within our documentation:
https://code.kx.com/pykx/2.4/examples/threaded_execution/threading.html
-
rocuinneagain
MemberApril 16, 2024 at 9:21 am in reply to: Natural Query Interface API fails to aggregate rdb + hdb resultsWhat is Holistic API? You may be using an internal tool which we can not answer questions on.
Standard kdb will not behave as you have outlined:
q)`:testHDB/2024.04.16/tableName/ set ([] publishTime:asc 100?.z.t;otherCol:100?100.0)
`:testHDB/2024.04.16/tableName/
q)`:testHDB/2024.04.15/tableName/ set ([] publishTime:asc 100?.z.t;otherCol:100?100.0)
`:testHDB/2024.04.15/tableName/
q)\l testHDB
q)select last publishTime from tableName where date within(.z.D-5;.z.D)
publishTime
------------
09:12:36.839 -
rocuinneagain
MemberApril 11, 2024 at 9:31 am in reply to: Could Someone Give Me Guidance on Integrating KDB+/q with Machine Learning?There are a lot of resources here: https://code.kx.com/q/ml/
Note: These show use of embedPy which is still usable but is not being actively updated. These can be however be migrated to use the current Python interface PyKX which includes notes on upgrading from embedPy.
Related to the question to you linked to you may be interested in this Websocket example interfacing with coinapi.io:
code.kx.com
Machine learning | kdb+ and q documentation - Kdb+ and q documentation
Machine-learning capabilities are at the heart of future technology development at KX. Libraries are added here as they are released. Libraries are released under the Apache 2 license, and are free for all use cases, including 64-bit and commercial use.
-
Yes you can renew it again.
-
What is the definition of handle_close?
Trying to close a handle which is already closed will throw that error.
Since you call exit 0 above the handle will be closed by the process exiting.
q)hclose 5 //Success first time
q)hclose 5 //Fails as 5 no longer exists, was closed above
'close. OS reports: Bad file descriptor
[0] hclose 5
-
Here are some links and resources. What changes you may make depend heavily on your data and use-case:
- Whitepaper: https://code.kx.com/q/wp/rt-tick/
- Tick configuration: https://code.kx.com/q/kb/kdb-tick/
- Tick architecture: https://www.defconq.tech/docs/architecture/plain
- Tick source code: https://github.com/KxSystems/kdb-tick/blob/master/tick.q
- Similar recent question: https://stackoverflow.com/questions/78278007/problems-and-solutions-for-an-increased-amount-of-tick-data-in-kdb-q
- Custom tick partitioning: https://kx.com/blog/partitioning-data-in-kdb/
- TorQ tickerplant modes: https://dataintellecttech.github.io/TorQ/Processes/#tickerplant
-
q)type"t" // t is a character atom - 'like' expects a character vector -10h q)type"IBM" // IBM is a character vector 10h q)type enlist "t" // You can enlist an atom to be a single item vector 10h q)type (),"t" // (), is useful as a conditional enlist. It enlists the atom 10h q)type (),"IBM" // It does not enlist the vector 10h
-
rocuinneagain
MemberApril 3, 2024 at 9:27 am in reply to: What is the difference between the sym files- The sym file in root of the partitioned database is an enumeration file.
- Each date does not have it’s own enumeration file.
- The sym files inside the date/table folders are columns of name sym.
These names are not enforced but it is a common practice that ticker symbols are stored in a column named ‘sym’ of type symbol and are enumerated against a file called ‘sym’.
-
Hi
- What problem/error do you see?
- Can you share the text or a screenshot?
- What operating system are you installing on?
-
Related thread: embedPy installation: os error with kdb and python – Stack Overflow
I would try:
python -m pip install libpython
If still failing see output from https://pypi.org/project/find-libpython/
pip install find_libpython
>>> from find_libpython import find_libpython
>>> find_libpython() -
rocuinneagain
MemberApril 23, 2024 at 11:05 am in reply to: Failed to Load KX Insights Core Library error when using pykx in q.
-
Can you try https://pypi.org/project/find-libpython/
pip install find_libpython
>>> from find_libpython import find_libpython
>>> find_libpython()What is the output?