| to_secBATV | R Documentation |
This is like taking a snapshot of the market at the end of every second, except the volume over the second is summed.
to_secBATV(x)
alltick2sec(
getdir = getOption("FinancialInstrument.tickdir", NULL),
savedir = getOption("FinancialInstrument.secdir", NULL),
Symbols = NULL,
overwrite = FALSE,
verbose = FALSE
)
x |
the xts series to convert to 1 minute BATV |
getdir |
Directory containing tick data. If omitted, the value of
|
savedir |
Directory in which converted data will be saved. If omitted,
the value of |
Symbols |
Character vector naming instruments to convert. If
|
overwrite |
Logical. If a destination file already exists, should it be overwritten? |
verbose |
Logical. If |
From tick data with columns: “Price”, “Volume”, “Bid.Price”, “Bid.Size”, “Ask.Price”, “Ask.Size”, to data of one second frequency with columns “Bid.Price”, “Bid.Size”, “Ask.Price”, “Ask.Size”, “Trade.Price”, and “Volume”
The primary purpose of these functions is to reduce the amount of data on disk so that it will take less time to load the data into memory.
If there are no trades or bid/ask price updates in a given second, we will not make a row for that timestamp. If there were no trades, but the bid or ask price changed, then we _will_ have a row but the Volume and Trade.Price will be NA.
If there are multiple trades in the same second, Volume will be the sum of the volume, but only the last trade price in that second will be printed. Similarly, if there is a trade, and then later in the same second, there is a bid/ask update, the last Bid/Ask Price/Size will be used.
alltick2sec is used to convert the data of several files from tick to
one second frequency data.
to_secBATV returns an xts object of one second frequency.
alltick2sec returns a list of files that were converted.
to_secBATV is used by the TRTH_BackFill.R script in the
inst/parser directory of the FinancialInstrument package. These functions
are specific to to data created by that script and are not intended for
more general use.
gsee
## Not run:
getSymbols("CLU1")
system.time(xsec <- to_secBATV(CLU1))
convert.log <- alltick2sec(
getdir = "path/to/tick-data",
savedir = "path/to/second-data",
verbose = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.