0

I am unable to solve a certain problem in Esper. I have to check if the current Tick value goes up from yesterday Max Value. Here is the code with returns me max and min of every 24 hr.

insert into
DayEnd
select
max(last) as high,
min(last) as low,
security
from
Tick.std:groupwin(security).win:time_batch(1440 minutes) group by security;

I have to running it on multiple securities so i have to check it for every security.

Ahmad.Masood
  • 1,289
  • 3
  • 21
  • 40

1 Answers1

1

A batch window is not the right way for such a large batch window. This is because a batch window retains all events.

Use a context declaration instead. Contexts allow you to frame the lifecycle of the analysis. An example is below and more examples are in the solution patters. This example is 2 statements, version 4.10, syntax not checked:

create context Batch24Hour as start @now ends after 24 hours;

context Batch24Hour select max(last) as high, min(last) as low, security from Tick group by security output when terminated;

user650839
  • 2,594
  • 1
  • 13
  • 9
  • Ok i get your point. Its better to user context. But i am still confused that how i will use this "high" value and check if in next day tick goes above this value or not. I have to do this for every security .(I am new with Esper so might requires a bit detail explanation.). – Ahmad.Masood Sep 22 '13 at 23:01