I don't think .q.load
does what you're expecting - the return of this function is simply a null symbol. I think instead you need to use .q.get
e.g.
jmcmurray@host ~/hdb $ pyq
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> q.load("sym")
k('`sym')
>>> np.array(q.get(":2014.04.21/trades").select())
array([('AAPL', '2014-04-21T08:00:37.853000000', 'O', 25.33, 5048),
('AAPL', '2014-04-21T08:00:58.840000000', 'O', 25.35, 4580),
('AAPL', '2014-04-21T08:01:40.150000000', 'O', 25.35, 5432), ...,
('YHOO', '2014-04-21T16:29:06.868000000', 'L', 35.32, 4825),
('YHOO', '2014-04-21T16:29:43.655000000', 'L', 35.32, 6125),
('YHOO', '2014-04-21T16:29:57.229000000', 'L', 35.36, 41)],
dtype=[('sym', 'O'), ('time', '<M8[ns]'), ('src', 'O'), ('price', '<f8'), ('size', '<i4')])
>>>
Note here I first use .q.load
to load the sym
file, as the symbol columns are enumerated. Then I load one splayed table from my HDB, which should be equivalent to your splayed table.
I also use .select()
on the table as .q.get()
simply maps the table into memory (same as get
in KDB), it's necessary to use select
to pull the actual data into memory.