The function provides a high level interface to Bloomberg Datalicense 'getdata' and 'gethistory' programs.

RblQuery(
  identifiers,
  fields,
  from = NULL,
  to = Sys.Date(),
  auto.assign = FALSE,
  env = parent.frame(),
  category = c(),
  add_headers = c(),
  overrides = c(),
  limit = 5,
  split = 100,
  frequency = 60,
  timeout = 3600,
  filename = format(Sys.time(), "%m%d%H%M%S"),
  verbose = TRUE
)

Arguments

identifiers

vector of Bloomberg identifiers. E.g. c('SXXE Index', 'SX5E Index')

fields

vector of Bloomberg fields. E.g. c('PX_LAST', 'PX_CLOSE', 'PX_OPEN', 'PX_HIGH', 'PX_LOW')

from

date or string (format YYYY-MM-DD). Start time for the 'gethistory' request. If not provided, a 'getdata' request will be made

to

date or string (format YYYY-MM-DD). End time for the 'gethistory' request. Ignored if from is not provided

auto.assign

logical. Should results be loaded to env? Ignored if from is not provided

env

where to create objects if auto.assign = TRUE

category

vector of Data License categories to enable. E.g. c('SECMASTER', 'PRICING', 'FUNDAMENTALS'). WARNING! Each DL category is billed separately, so check your DL license carefully!

add_headers

named vector of additional headers. E.g. c(PROGRAMFLAG = 'oneshot')

overrides

named vector of Bloomberg overrides. E.g. c('END_DT' = '20100101')

limit

prevent requesting data for more than this amout of identifiers. This is done to help you keeping your budget under control. Data License is billing based on the amout of instruments you request, so check your DL license carefully before increasing this limit.

split

maximum number of identifiers to process at once. Requests are split to avoid memory leaks.

frequency

the polling frequency to check if the response file is available at Bloomberg

timeout

the timeout in seconds

filename

name assigned to the remote file. Only alphanumeric characters are allowed. Invalid characters are removed.

verbose

logical. Should R report extra information on progress?

Value

A list with components

req

List of characters representing each of the request files uploaded to Bloomberg

out

List of characters representing each of the response file downloaded from Bloomberg

data

Return of RblParse

Details

The following routine to query Bloomberg is implemented:

Build the request file

see RblRequestBuilder

Upload the request file

see RblUpload

Download the response file

see RblDownload

Parse the response file

see RblParse

Examples

if (FALSE) { # \dontrun{
# Run RblConnect first
data <- RblQuery(fields = c('PX_LAST', 'PX_OPEN', 'PX_HIGH', 'PX_LOW'), 
                 identifiers = c('SXXE Index', "SX5E Index"), 
                 from = '2005-01-01')
str(data)
} # }