I'm doing a relatively boring query:
returns: select s: avg (target1 * signum p), l: avg(lR) by date from z
Which produces something that looks like:
date | s l
----------| ---------------------------
2001.01.02| 0.02929124 -0.02979896
2001.01.03| -0.01870611 0.04020953
2001.01.04| -0.006486651 -0.015966
2001.01.05| 0.002188851 -0.02215498
2001.01.08| 0.0001548752 0.001631526
The problem is, though z
in my query is a table 98h, the query result is a dictionary 99h, which is causing my problems further down in my code.
What could possibly be causing the type cast?
The fundamental of this is that adding a key using your "by date" filter creates a keyed table. Keyed tables are simply dictionaries mapping a table of keys to a table of values. More on this can be seen here: https://code.kx.com/q4m3/8_Tables/#841-keyed-table
Because your avg(lR) relies on the "by date" filter the only way around this is to manually unkey your returns dictionary using:
returns: 0!select s: avg (target1 * signum p), l: avg(lR) by date from z
This should unkey your table and give you a type of 98h, hopefully avoiding any errors further down the line.