.Q.dpft in append mode?

648 views
Skip to first unread message

Daniel

unread,
Sep 14, 2011, 4:25:21 AM9/14/11
to Kdb+ Personal Developers

I am trying to write down to a hdb directory at different times during
the day such that at end of day I have a complete HDB.

My issue occurs with one table I have that has a list of symbols.
.Q.dpft saves this table fine at end of day but I am struggling to
find a way to append for this table intraday.

{.[hdbtabdir;();,;.Q.en[`:.]`. x]}[`table]

The above works for all tables except the one with the list.

Any advice how I can append to this table on disk intraday such that
at end of day I will have the same result as .Q.dpft?

Aaron Davies

unread,
Sep 14, 2011, 8:15:31 AM9/14/11
to personal...@googlegroups.com
On Sep 14, 2011, at 4:25 AM, Daniel wrote:

> My issue occurs with one table I have that has a list of symbols.
> .Q.dpft saves this table fine at end of day but I am struggling to
> find a way to append for this table intraday.
>
> {.[hdbtabdir;();,;.Q.en[`:.]`. x]}[`table]

details?

at a guess try

{@[hdbtabdir;x;,;.Q.en[`:.]`. x]}[`table]

pawan singh

unread,
Sep 14, 2011, 9:10:48 AM9/14/11
to personal...@googlegroups.com
here's a modified version of .Q.dpft for appending.

q)k)append : {[d;p;t]if[~&/.Q.qm'r:+.Q.en[d]`. t;'`unmappable];{[d;t;x]@[d;x;,;t[x]]}[d:.Q.par[d;p;t];r]'!r;@[d;`.d;:;!r];t}
q)append[hdbdtabdir;.z.D;`table]

At the end of the day, you might want to do a sort and put a parted attr on sym col.

regards,
pawan


--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To post to this group, send email to personal...@googlegroups.com.
To unsubscribe from this group, send email to personal-kdbpl...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.


Ajay

unread,
Sep 14, 2011, 10:11:59 AM9/14/11
to Kdb+ Personal Developers
You can write a function like this

insertIntradayData:{[dir;t] .[.Q.par[dir;.z.d;`t];();,;.Q.en[dir;t]]}

function takes 2 params i.e., hdb base dir and table

Ajay

Daniel

unread,
Sep 14, 2011, 9:17:15 PM9/14/11
to Kdb+ Personal Developers
Thanks for the suggestions.

Pawan's solution is what I was looking to do.
> > at end of day I will have the same result as .Q.dpft?- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages