Home › Forums › kdb+ › What is the difference between wj and wj1? › Re: What is the difference between wj and wj1?
-
You are seeing the same results as your
t2
has an entry for every secondIf we swap
til 9
for2*til 9
we can create gaps and then you can see the differences wherewj
will bring in prevailing values butwj1
will not.t1:([]sym:3#`ibm;time:07:01:01 07:01:03 07:01:05;price:100 101 105); a:101 103 103 104 104 107 108 107 108; b:98 99 102 103 103 104 106 106 107; t2:([]sym:`ibm; time:07:00:58+2*til 9; ask:a; bid:b); c:`sym`time; w:-2 1+:t1.time; o1:wj[w;c;t1;(t2;(max;`ask);(min;`bid))]; o2:wj1[w;c;t1;(t2;(max;`ask);(min;`bid))]; o1~o2; // 0b; q)wj[w;c;t1;(t2;(::;`ask);(::;`bid))] sym time price ask bid ------------------------------------------ ibm 07:01:01 100 101 103 103 98 99 102 ibm 07:01:03 101 103 103 104 99 102 103 ibm 07:01:05 105 103 104 104 102 103 103 q)wj1[w;c;t1;(t2;(::;`ask);(::;`bid))] sym time price ask bid ---------------------------------- ibm 07:01:01 100 103 103 99 102 ibm 07:01:03 101 103 104 102 103 ibm 07:01:05 105 104 104 103 103