save_scrub_agg: Load, scrub, aggregate, and rbind multiple days of _TAQ_ data...

View source: R/HighFreq.R

save_scrub_aggR Documentation

Load, scrub, aggregate, and rbind multiple days of TAQ data for a single symbol, and save the OHLC time series to a single ‘*.RData’ file.

Description

Load, scrub, aggregate, and rbind multiple days of TAQ data for a single symbol, and save the OHLC time series to a single ‘*.RData’ file.

Usage

save_scrub_agg(
  symbol,
  dirin = "E:/mktdata/sec/",
  dirout = "E:/output/data/",
  lookb = 51,
  volm = 2,
  period = "minutes",
  tzone = "America/New_York"
)

Arguments

symbol

A character string representing symbol or ticker.

dirin

A character string representing directory containing input ‘*.RData’ files.

dirout

A character string representing directory containing output ‘*.RData’ files.

Details

The function save_scrub_agg() loads multiple days of TAQ data, then scrubs, aggregates, and rbinds them into a OHLC time series, and finally saves it to a single ‘*.RData’ file. The OHLC time series is stored in a variable named ‘symbol’, and then it's saved to a file named ‘symbol.RData’ in the ‘dirout’ directory. The TAQ data files are assumed to be stored in separate directories for each ‘symbol’. Each ‘symbol’ has its own directory (named ‘symbol’) in the ‘dirin’ directory. Each ‘symbol’ directory contains multiple daily ‘*.RData’ files, each file containing one day of TAQ data.

Value

An OHLC time series in xts format.

Examples

## Not run: 
# set data directories
dirin <- "C:/Develop/data/hfreq/src/"
dirout <- "C:/Develop/data/hfreq/scrub/"
symbol <- "SPY"
# Aggregate SPY TAQ data to 15-min OHLC bar data, and save the data to a file
save_scrub_agg(symbol=symbol, dirin=dirin, dirout=dirout, period="15 min")

## End(Not run)


algoquant/HighFreq documentation built on June 10, 2025, 3:54 p.m.