KX Community

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

Home Forums KX Academy Issue with Window Join Re: Issue with Window Join

  • megan_mcp

    Administrator
    July 11, 2023 at 12:00 am

    Hi , just to add to ‘s reply;

    • It’s because wj uses the last-most quote out side of the window as well as quotes in the window (that last-most quote is called the “prevailing” quote in the notes).  If this is not the desired result and you strictly want stuff in the window only, you use wj1

    If I use your example to explain:

    t:([]sym:3#`JPM;time:09:30:01 09:30:04 09:30:08;price:120 123 121) 
    q:([]sym:10#`JPM;time:asc 09:30:00,09:30:00,09:30:01,09:30:02,09:30:03,09:30:04,09:30:05,09:30:05,09:30:07,09:30:07;ask:(102,91,93,102,91,96,102,103,97,95);bid:(107,100,93,108,93,108,106,99,101,102);rn:1+til 10) 
    windows: -2 1+: t[`time] 
    wj[windows;`sym`time;t;(q;(max;`ask);(min;`bid);((::);`rn))]
    • That last-most quote only is taken when there is no quote right at the exact window start time (you can see this in the second row of the result, we had a quote exactly at window start time 09:30:02, so the last-most quote outside the window isn’t included in that case, for the third row it was because no quote exactly at 09:30:06)