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

View source: R/HighFreq.R

save_retsR Documentation

Load, scrub, aggregate, and rbind multiple days of TAQ data for a single symbol. Calculate returns and save them to a single ‘*.RData’ file.

Description

Load, scrub, aggregate, and rbind multiple days of TAQ data for a single symbol. Calculate returns and save them to a single ‘*.RData’ file.

Usage

save_rets(
  symbol,
  data_dir = "E:/mktdata/sec/",
  output_dir = "E:/output/data/",
  look_back = 51,
  vol_mult = 2,
  period = "minutes",
  tzone = "America/New_York"
)

Details

The function save_rets loads multiple days of TAQ data, then scrubs, aggregates, and rbinds them into a OHLC time series. It then calculates returns using function ohlc_returns(), and stores them in a variable named ‘symbol.rets’, and saves them to a file called ‘symbol.rets.RData’. 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

A time series of returns and volume in xts format.

Examples

## Not run: 
save_rets("SPY")

## End(Not run)


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