Say I want to store a forex rate trend in which, I receive two updates every second on average. But I don't want to store all updates against the timestamp over a day as the data would be huge. But I want to show every update in the last two minutes, every second update in the last 1 hour and so on with reducing frequencies over a day. Which algorithm/data structure is best for this?
How to store time series data in a list (or any other data structure) to get reasonable trends over a variety of horizons?
You could use a circular buffer. But generally StackOverflow is not for questions like that.