Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good algorithm to check for changes in data over a specified period of time?

We have around 7k financial products whose closing prices should theoretically move up and down within a certain percentage range throughout a defined period of time (say a one week or month period).

I have access to an internal system that stores these historical prices (not a relational database!). I would like to produce a report that lists any products whose price has not moved at all or less than say 10% over the time period.

I can't just compare the first value (day 1) to the value at the end (day n) as the price could potentially have moved back to what it was on the last day which would lead to a false positive while the product's price could have spiked somewhere in between of course.

Are there any established algorithms to do this in reasonable compute time?

like image 477
Patrick Avatar asked Dec 17 '22 03:12

Patrick


2 Answers

There isn't any way to do this without looking at every single day.

Suppose the data looks like such:

oooo0oooo

With that one-day spike in the middle. You're not going to catch that unless you check the day that the spike happens - in other words, you need to check every single day.

like image 132
Anon. Avatar answered Dec 19 '22 17:12

Anon.


If this needs to be checked often (for a large number of interval, like daily for the last year, and for the same set of products), you can store the high and low values of each item per week/month. By combining the right weekly and/or monthly bounds with some raw data at the edges of the interval you can get the minimum and maximum value over the interval.

like image 25
Wim Avatar answered Dec 19 '22 16:12

Wim