0

Im having trouble in ESPER.

I have a simulated stock file which conatins a lot of info.

I want to fnd all the start and stop dates when the weighted price of the BTC stock increases more than 100 times.

This is how the files looks. These are BTC stocks:

2010-07-18,0.04951,0.08585,0.05941,0.08584,75.01,0.07 2010-07-19,0.08584,0.09307,0.07723,0.0808,574,0.09 2010-07-20,0.0808,0.08181,0.07426,0.07474,262,0.08

IN ORDER EACH COMMA SEPARATION REPRESENTS:timestamp, open, high, low, close, volume, average

So basically im supposed to make a query that does what i said above^ which I cant seem to find out how. Im very new to CEP so im still reading it up.

Any help is much appreciated.

eternalStud
  • 83
  • 1
  • 8

1 Answers1

0

You could use "prev" to increase a count in a named window, or write an aggregation function against the API that aggregates the custom trend.

user650839
  • 2,594
  • 1
  • 13
  • 9
  • select firstDate.timestamp, firstDate.weightedPrice, lastDate.timestamp, lastDate.weightedPrice from pattern[ every firstDate=StockTick -> lastDate=StockTick(weightedPrice >= firstDate.weightedPrice*100) ] this is what ive come up with. What do u think? does it look correct? – eternalStud Oct 31 '14 at 19:49