Hello,


If I have an incoming stream of financial transaction.  (i.e. ticks from Interactive Brokers.)

I would like to calculate bars for a given time period.  (i.e. 10 minute bars)

I'm "rolling my own" code and don't want to relay on an opaque function from a package.

The goal is to have bars fall on the same time as the clock
9:00
9:10
9:20
etc..


One thought was to perform a mod on the epoch time

if (epoch %% 600 < 0){  make bar}

However, since the ticks flow in at random times, this is not reliable.  MOST of the time there will be at least one tick every second, so it will work, but what if there isn't a tick on the exact second that borders a bar. If there isn't a transaction on the "goal" second, then we won't trigger the rule based on epoch %% 600

Any thoughts on a reliable and fast way to do this?


--
Noah Silverman
UCLA Department of Statistics
8117 Math Sciences Building #8208
Los Angeles, CA 90095


	[[alternative HTML version deleted]]

