views:

30

answers:

1

I am using Complex Event Processing (Esper) technology to provide a real-time candlestick calculations in my system. I am doing fine with calculating values, however I find it difficult to ensure that candle window starts at full minutes (for one minute candle) and ends before the next minute starts (i.e. candle 1[06:00.000 - 06:00.999], candle 2[06:01.000 - 06:01.999], etc... ). Is there a pattern or command in Esper's query language that is able to provide such functionality?

I'd appreciate constructive comments and directions.

A: 

In Esper you can use a pattern to fire every minute at the zero second, i.e.
insert into TriggerEvent select * from pattern[pattern[every timer:interval(1 min).] // named window to hold candle data, compute next candle on TriggerEvent select * from NamedWindowCandle .... // delete old data on TriggerEvent delete from NamedWindowCandle

-rg

Rainer Guessner