[R-SIG-Finance] Rounding time series to nearest 5mn

Brian G. Peterson brian at braverock.com
Mon Feb 15 01:20:28 CET 2010


Kanin Kaninski wrote:
> Josh, Jeff, thank you for your answers. 
> 
> Jeff, I totally agree with you re: dangers of changing time stamps on observations. 
> 
> The issue here is that the data is pulled from BBG and should be in 5mn increments, so even though the time stamp shows 04:59, I'm 99% sure it really means 05:00. 
> 
> I guess you would argue that its more correct to keep it as 04:59 given that xts can handle this but my "quick and dirty" testing at this stage will suffer some intial productivity if I do this. Not super clean, but will get me through until I find out why the data from Bloomberg is not retrieved in multiples of 5mn...
> 
> Thank you again for your quick replies. Much appreciated.

What is likely happening with the BBG data is the same thing that happens with 
to.period in xts.  The last observation in the bar is returned, and it will 
likely not fall exactly on the bar.

You may also want to look at digits.secs, because 00:00:00.0001 is not the same 
as 00:00:00

align.time will work 'better' (more like you expect) in xts if you get higher 
frequency data from your data provider, apply to.period, and then align.time. 
This is the application it was written for, to take high frequency data and 
align it nicely in lower frequency bars.  In these cases, you should not see 
some of the odd things that you seem to be getting from trying to align your 
Bloomberg bars.

Regards,

    - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list