getBBG: Bloomberg data as zoo object

Description Usage Arguments Value Examples

View source: R/getBBG.R

Description

Returns Bloomberg data as zoo object; it relies on Rblpapi package but simplifies download and output

Usage

1
2
3
4
getBBG(tickers, field = "PX_LAST", names,
  start = (LastDayInMonth(Sys.Date()) - 3 * 365),
  end = as.Date(Sys.Date() - 1), time, freq = "MONTHLY", na = TRUE,
  last = FALSE, fut_dt = FALSE)

Arguments

tickers

character vector of Bloomberg ticker(s)

field

optional character vector of Bloomberg field(s)

names

optional character vector of column name(s) for zoo object; default uses 'tickers' vector

start

optional start date for data download; format is 'dd/mm/yyyy'

end

optional end date for data download; format is 'dd/mm/yyyy'

time

optional string to specify start date; options are 'D' (Days), 'W' (Weeks), 'M' (Months), 'Q' (Quarters), 'Y' (Years), or 'YTD' (Year-to-Date), e.g. '3M', '4Q', '5Y', 'YTD'

freq

optional frequency for data download; options are 'DAILY', 'WEEKLY', 'MONTHLY', 'QUARTERLY', 'YEARLY'; default is 'MONTHLY'

na

optional boolean to replace NAs with the last observation if set to FALSE

last

optional boolean to toggle appending of the latest data points

fut_dt

optional boolean to toggle deletion of data points that lie in the future

Value

returns a zoo object with the downloaded Bloomberg data

Examples

1
2
3
4
5
zoo <- getBBG(tickers = 'VIX Index', time = 'YTD')
zoo <- getBBG(tickers = 'VIX Index', names = 'VIX', freq = 'DAILY', time = '30Y', na = FALSE)
zoo <- getBBG(tickers = c('CPI YOY Index', 'PPI YOY Index'), names = c('CPI', 'PPI'), start = '01/01/2000')
zoo <- getBBG(tickers = c('CPI YOY Index', 'PPI YOY Index'), names = c('CPI', 'PPI'), start = '01/01/2000', end = '01/01/2018')
zoo <- getBBG(tickers = c('NAPMPMI', 'MPMIEZMA', 'MPMIEMMA'), names = c('United States (ISM)', 'Eurozone', 'Emerging Markets'), time = '3Y')

kilianreber/chartbookR documentation built on July 19, 2019, 9:48 a.m.