KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ sum quantity by symbol, price and timestamps within 1ms

  • sum quantity by symbol, price and timestamps within 1ms

    Posted by wael on May 26, 2025 at 3:43 pm

    I have a table t with columns: symbol, side, price, time, and qty.
    I want to sum the qty by those columns but also group rows where the time values are ≤1ms apart.
    for example

    symbol  side  time                           price  qty  
    --------------------------------------------------------  
    x       1     2019.09.07D00:00:00.127000000   100    15  
    x       1     2019.09.07D00:00:00.128000000   100    10

    becomes

    symbol  side  time                            price  qty  
    --------------------------------------------------------  
    x       1     2019.09.07D00:00:00.128000000   100    25

    How can I achieve this? Thanks.

    wael replied 4 days, 7 hours ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.