I have a table of the form
Timestamp, Symbol, Vol
and I would like to plot the aggregate daily volume per symbol in a line chart
select sum(Vol) by `date$Timestamp from Trades
gives me the plot for the daily volume. How can I get a line per symbol?
select sum(Vol) by `date$Timestamp, Symbol from Trades
Gives me two lines, one for Vol
and one constant line for the max in symbols( symbols are int values)
And as a side question... How can I tell the plot to exclude missing dates in the time series or at least have values of 0
for those dates?
If you want to multi-graph then each line to draw needs to be a separate column of our output table. Which means you'd need to pivot your results table: https://code.kx.com/q/cookbook/pivoting-tables/
For example, something like this:
{P:exec distinct sym from x;exec P#(sym!size) by minute:minute from x}select sum size by sym,time.minute from lseTradeRT where sym in `AHT.L`BARC.L`BP.L`VOD.L
but in your case replace the time.minute
with `date$Timestamp
. You should also filter on only a handful of syms or else the graph is unmanageable.