KX Community

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

Home Forums kdb+ Rounding in select statement Re: Rounding in select statement

  • roryk

    Member
    November 26, 2021 at 12:00 am

    I would define

    round:{(floor 0.5+y*i)%i:10 xexp x}

    and then you can do

    select time, sym, round[1]price from trade.

    As a bonus, this works with negative numbers too, round[-3; 12345.678] is 12000.