Alert on state change.

2016-12-19 Thread Rudra Tripathy
Hi All, I have a use case where I am monitoring price change. Lets s say the original price is $100 in case of 20% rise , send the alert. In the stream I am getting updated prices. If in the next data $200 comes, send the alerts. Next I am getting 230 I would keep it but no alert . When I woul

Re: Alert on state change.

2016-12-19 Thread Scott Kidder
Hi Rudra, You could accomplish this with a rolling-fold on the stream of stock prices. The accumulator argument to the fold can track the last price that triggered an alert and the timestamp of the alert. When evaluating a new stock price it can compare the the price against the last one that trig