This function uses the Bloomberg API to retrieve ticks for the requested security.
getTicks(security, eventType = "TRADE", startTime = Sys.time() - 60 * 60,
endTime = Sys.time(), verbose = FALSE, returnAs = getOption("blpType",
"data.frame"), tz = Sys.getenv("TZ", unset = "UTC"),
con = defaultConnection())
A character variable describing a valid security ticker
A character variable describing an event, default is ‘TRADE’.
A Datetime object with the start time, defaults to one hour before current time
A Datetime object with the end time, defaults to current time
A boolean indicating whether verbose operation is desired, defaults to ‘FALSE’
A character variable describing the type of return object; currently supported are ‘data.frame’ (also the default), ‘data.table’, ‘fts’, ‘xts’ and ‘zoo’
A character variable with the desired local timezone, defaulting to the value ‘TZ’ environment variable, and ‘UTC’ if unset
A connection object as created by a blpConnect
call, and retrieved via the internal function
defaultConnection
.
Depending on the value of ‘returnAs’, either a ‘data.frame’ or ‘data.table’ object also containing non-numerical information such as condition codes, or a time-indexed container of type ‘fts’, ‘xts’ and ‘zoo’ with a numeric matrix containing only ‘value’ and ‘size’.
# NOT RUN {
res <- getTicks("ES1 Index")
str(res)
head(res, 20)
res <- getTicks("ES1 Index", returnAs="data.table")
str(res)
head(res, 20)
# }
Run the code above in your browser using DataLab