aggregatePrice: Aggregate a time series to within open/close bounds

Description Usage Arguments

Description

Function returns new time series as an xts object. The observations are always previous-tick observations. If marketopen is set to before the start of the time series ts, the timestamp is discarded and the first returned timestamp is the first in-fact time stamp. The ts object can contain multiple days of data.

Usage

1
2
3
aggregatePrice(ts, on = "minutes", k = 1, marketopen = "08:30:00",
  marketclose = "15:15:00", pad = TRUE, pad.arg = NA_real_,
  aggr.vec = numeric(0))

Arguments

ts

xts object to be aggregated; index(ts) is POSIXct. It contains intraday observations of a security price, potentially for multiple days.

on

character, indicating the time scale at which the series will be aggregated: "seconds", "minutes" or "hours".

k

positive integer, aggregation is performed every k ons

marketopen

string in format "HH:MM:SS", start of trading time.

marketclose

string in format "HH:MM:SS", end of trading time.

pad.na

logical, if TRUE, any time when the previous tick is earlier than k times on, the latter time stamp is populated with NA_real.


piotrek-orlowski/diveRgence documentation built on May 25, 2019, 7:14 a.m.