save_rets | R Documentation |
*.RData
’ file.Load, scrub, aggregate, and rbind multiple days of TAQ data for a
single symbol. Calculate returns and save them to a single
‘*.RData
’ file.
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"
)
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.
A time series of returns and volume in xts format.
## Not run:
save_rets("SPY")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.