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,
  data_dir = "E:/mktdata/sec/",
  output_dir = "E:/output/data/",
  look_back = 51,
  vol_mult = 2,
  period = "minutes",
  tzone = "America/New_York"
)

Arguments

symbol

A character string representing symbol or ticker.

data_dir

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

output_dir

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 ‘output_dir’ 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 ‘data_dir’ 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
data_dir <- "C:/Develop/data/hfreq/src/"
output_dir <- "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, data_dir=data_dir, output_dir=output_dir, period="15 min")

## End(Not run)


algoquant/HighFreq documentation built on Feb. 9, 2024, 8:15 p.m.