Home › Forums › kdb+ › sym flipping back and forth when creating continues futures contacts based on volume › Re: sym flipping back and forth when creating continues futures contacts based on volume
-
Full answer on SO.
TL;DR: find cumulative maxima; eliminate recurrences; upsert into an empty table; fill nulls
Eliminating recurrences uses a vector idiom inherited from APL that flags duplicate items in a list. In APL its
(??x)?x?x
, which translates easily into q as(til count x)<>x?x
.