scrub_agg | R Documentation |
Scrub a single day of TAQ data, aggregate it, and convert to OHLC format.
scrub_agg(
taq,
look_back = 51,
vol_mult = 2,
period = "minutes",
tzone = "America/New_York"
)
period |
The aggregation period. |
The function scrub_agg()
performs:
index timezone conversion,
data subset to trading hours,
removal of duplicate time stamps,
scrubbing of quotes with suspect bid-ask spreads,
scrubbing of quotes with suspect price jumps,
cbinding of mid prices with volume data,
aggregation to OHLC using function to.period()
from package xts,
Valid 'period' character strings include: "minutes", "3 min", "5 min", "10 min", "15 min", "30 min", and "hours". The time index of the output time series is rounded up to the next integer multiple of 'period'.
A OHLC time series in xts format.
# Create random TAQ prices
taq <- HighFreq::random_taq()
# Aggregate to ten minutes OHLC data
ohlc <- HighFreq::scrub_agg(taq, period="10 min")
chart_Series(ohlc, name="random prices")
# scrub and aggregate a single day of SPY TAQ data to OHLC
ohlc <- HighFreq::scrub_agg(taq=HighFreq::SPY_TAQ)
chart_Series(ohlc, name=symbol)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.