Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-12-12 01:00:14

Eric Niebler wrote:
> Jeff Garland wrote:
>> In particular, I'm sorta surprised there isn't a moving average algorithm as
>> that's time series algorithm with a really wide applicability. Classic
>> example -- calculate a 10 day rolling average of the closing price of some
>> stock. Or calculate a 20 minute rolling average of the trading prices or
>> quotes. And, so on...there are all sorts of other applications for rolling
>> averages.
> Yep, that'd be a nice one to have. As I say in the description, the
> library is light on algorithms at the moment; the key is the
> infrastructure that makes the algorithms possible.

Yep...just a suggestion for future expansion :)

> Of
>> course, what I'm thinking is for the stock price rolling average example above
>> you might want to use gregorian::date or posix_time::ptime to represent point
>> of measurement of the stock price. I wasn't finding the requirements for the
>> offset_type...which is what I think would need to be replaced.
> Right, I should document the requirements on the offset_type. The code
> has been tested with offset_types of int and double. I think the right
> concept for offset_type is LessThanComparible.

Well, here's the thing. In date-time the 'duration_type' and the
'point_in_time_type' are different. For example, with dates you have 'date'
as the 'point_in_time' which is conceptually dimensionless and the
duration_type 'day'. If you subtract 2 points in time you get a duration. So
it's possible there would need to be a different type in the mix to make
things work. Anyway, this will be a good experiment at some point. I'd do it
myself if I only had more time.... ;-)

>> I also find the Discretization intervals interesting. Is that a standard way
>> of handling the breakdown for statistical purposes? The thing being that only
>> days and weeks are actually fixed lengths in the *messy world*...months,
>> quarters, etc are all different depending leap years and such.
> The Discretization template parameter is mostly there just for type
> checking your operations. You don't want to be adding a daily series
> with a yearly one, because that doesn't make sense. The fact that some
> years are leap years doesn't matter for the purpose of type checking.

Got it.


Boost list run by bdawes at, gregod at, cpdaniel at, john at