is there a script which automatically creates a

“sample” partitioned database for you? i.e. it goes through the process of creating small trades and quotes tables and then saving them to the disk for a few different days partitioned by sym.

I’d write my own but then I’d have noone else’s code to compare with!

thank you for your help in advance.

On Apr 2, 2011, at 5:50 PM, K4 Monk wrote:

> “sample” partitioned database for you? i.e. it goes through the
process of creating small trades and quotes tables and then saving them
to the disk for a few different days partitioned by sym.
>
> I’d write my own but then I’d have noone else’s code to compare with!
>
> thank you for your help in advance.

there’s http://kx.com/q/taq/tq.q

i’d write it to like this, to show how to use some of the other built-in
facilities

q)sym:ascAAAAAPLCITICSCOIBMMSFT,100?4
q)ex:“NTA”
q)n:1000000
q)trade:(sym:n?sym;time:09:30:00.0+til n;price:n?2.3e;size:n?9;ex:n?ex) q)quote:([]sym:n?sym;time:09:30:00.0+til
n;bid:n?2.3e;ask:n?2.3e;bsize:n?9;asize:n?9;ex:n?ex)
q)d:2000.10.02 2000.10.03
q)d .Q.dpft[:tq;;sym;]/::sym xasc'trade`quote
trade quote
trade quote

you may also be interested in these extensions of dpft i wrote:

d .Q
/ extension of .Q.dpft to separate table name & data

k)dpfnt:{[d;p;f;n;t]if[~&/qm’r:+en[d]t;‘unmappable];{[d;t;i;x]@[d;x;:;t[x ]i]}[d:par[d;p;n];r;<r f><br>/ generalization of .Q.dpft/.Q.dpfnt to auto-partition and save a <br>multi-partition table<br>k)dcft:{[d;c;f;t]*(dpfnt[d;;f;t]).'{[t;c;p](p;?[.
t;,(=;c;p);0b;()])}[t;c]’?[;();();c]?[v t;();1b;(,c)!,c]}

they let you save a multi-day table directly, e.g.

q).Q.dcft[:tq;date;sym;trade]

where trade has a date column


See also https://code.kx.com/trac/browser/contrib/cburke/buildhdbOn Apr 3, 12:46?pm, Aaron Davies <aaron.dav…> wrote:> On Apr 2, 2011, at 5:50 PM, K4 Monk wrote:>> > “sample” partitioned database for you? i.e. it goes through the process of creating small trades and quotes tables and then saving them to the disk for a few different days partitioned by sym.>> > I’d write my own but then I’d have noone else’s code to compare with!>> > thank you for your help in advance.>> there’shttp://kx.com/q/taq/tq.q>> i’d write it to like this, to show how to use some of the other built-in facilities>> q)sym:ascAAAAAPLCITICSCOIBMMSFT,100?4> q)ex:“NTA”> q)n:1000000> q)trade:(sym:n?sym;time:09:30:00.0+til n;price:n?2.3e;size:n?9;ex:n?ex)&gt; q)quote:([]sym:n?sym;time:09:30:00.0+til n;bid:n?2.3e;ask:n?2.3e;bsize:n?9;asize:n?9;ex:n?ex)> q)d:2000.10.02 2000.10.03> q)d .Q.dpft[:tq;;sym;]/::sym xasc'tradequote&gt; trade quote&gt; trade quote&gt;&gt; you may also be interested in these extensions of dpft i wrote:&gt;&gt; \d .Q&gt; / extension of .Q.dpft to separate table name &amp; data&gt; k)dpfnt:{[d;p;f;n;t]if[~&amp;/qm'r:+en[d]t;'unmappable];{[d;t;i;x]@[d;x;:;t i]}[d:par[d;p;n];r;> / generalization of .Q.dpft/.Q.dpfnt to auto-partition and save a multi-partition table> k)dcft:{[d;c;f;t]*(dpfnt[d;;f;t]).‘{[t;c;p](p;?[`. t;,(=;c;p);0b;()])}[t;c]’?[;();();c]?[v t;();1b;(,c)!,c]}>> they let you save a multi-day table directly, e.g.>> q).Q.dcft[`:tq;`date;`sym;`trade]>> where trade has a date column</aaron.dav…>