
Boost Users : 
Subject: [Boostusers] Boost.DateTime library to synthesise timeseries data?
From: Riskybiz (riskybizlive_at_[hidden])
Date: 20141219 05:40:06
Dear boostusers,
It's my first time trying this and hope that someone may be able to
enlighten me about which aspects of the Boost.DateTime library will help
solve this problem...
I have some timeseries data which is time stamped with
boost::posix_time::ptime values. From this baseseries I would like to
synthesise higher interval timeseries. For example, a baseseries of 1
second timeseries data could be used to synthesise a timeseries of any
greater interval; 2 seconds, 5 seconds, 86400 seconds (1 day) etc. Or 1
minute baseseries data could be used to synthesise, 2 min, 15min, 60 min
timeseries etc.
It is entirely possible that any given baseseries time point could be
absent i.e. there could be time gaps in the baseseries.
I have an idea to use boost::posix_time::time_period to create regularly
temporally spaced 'buckets' of the required time interval; into which the
baseseries data elements would accumulate and thus allow the synthesising
of the higher interval timeseries. Each 'bucket' represents one higher
interval timeseries data element.
It is important that the 'buckets' are aligned with natural multiples of the
time interval for which they are accumulating. So for example a 10 second
synthesised timeseries would have boost::posix_time::time_period 'buckets'
like so at: 110, 1120, 2130, 3140, 4150 & 5160 seconds time_periods.
The first data element of the baseseries could fall at any time, it could
be on the 7th second of a minute, equally it could be on the 59th minute of
an hour. Somehow the first boost::posix_time::time_period 'bucket' for a
particular synthesised interval must be set such that it spans the correct
period of time and ends on a multiple of the timeseries interval which is
being synthesised. Put simply, that first baseseries data element needs to
fall into a correctly aligned time_period 'bucket'.
Using Boost.Date_Time how could the boost::posix_time::ptime of the first
data element of the baseseries be examined and the first time_period
'bucket' be correctly aligned to the relevant begin and end times for the
synthesised timeseries? I envisage subsequent 'buckets' will be created by
incrementing forward in time from the datum of the first.
With grateful thanks for any assistance,
Riskybiz.
Boostusers list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net