Cole MG
Cole MG

Reputation: 341

How can I sum a column by date in KDB Q?

I have a table in KDB with columns date, time, and returns. I need the cumulative returns per day stowed in a new column, but I'm not sure how to separate the sums function by date. This is what I tried:

Table: update cumreturns: sums returns from Table by date where time within (09:30:00;16:00:00)

But I get an evaluation error: date when I run it. Is my syntax off or is there another way I need to approach this?

Upvotes: 0

Views: 643

Answers (1)

Adam Bonham
Adam Bonham

Reputation: 615

you need to include the by clause before the 'from' statement, something like this

update cumReturns:sums returns by date from t

Upvotes: 2

Related Questions