cancel
Showing results for 
Search instead for 
Did you mean: 

Using multiple sym files in one partitioned table

lan
New Contributor II
I want to save daily stock positions in partitioned table so I can analyse performance of each trader. The position table is like:

account | sym     | volume | cost
---------------------------------------
`trader1   |`AAPL   |100 | 169.78
`trader2   |`MSFT  |400 | 121.40
`trader1   |`FB        |200 | 181.33
...

Sym file is designed for saving space. I think account is quite similar here, they are both repeated and in a limited domain. So I want to set the account field as enumerated column too.
I tried invoke .Q.dpft with field list `account`sym but got 'length error. Directly set the partitioned domain using output of .Q.en also get unexpected result.

Is possible to using multiple sym files for just one partitioned table?

Thanks.
3 REPLIES 3

Flying
New Contributor III
It's possible, though I don't think it's necessary in your case. Just splay the table using a single sym would probably be easier and sufficient for the requirement.

If you insist on having different sym files per column, I'd strongly recommend this white paper: https://code.kx.com/v2/wp/symfiles/

Jonathan_Foster
New Contributor
Hi suarezzz,

When you enumerate a table it will enumerate over all sym columns. There is no need to specify account and sym as they will be picked up on. This will generate an index as such of all symbols in the table between all sym columns. 

You can as you suggested partition a table with multiple sym files. Though this is necessary only in exceptional circumstances, for instance if you're concerned about bloating. It is also worth noting that unless you are capturing hundreds of thousands of positions, a splayed table may suffice for your needs.

lan
New Contributor II
Thank you, Jonathan!
I didn't know that before. your answer helps a lot.