Imports: | httr, zoo, xts, XML, lubridate, jsonlite, xml2, stringr, magrittr, dplyr, tidyr, readr, quantmod |
Type: | Package |
Title: | Fetch Economic and Financial Time Series Data from Public Sources |
Version: | 0.3.3 |
Date: | 2024-12-16 |
Description: | Download economic and financial time series from public sources, including the St Louis Fed's FRED system, Yahoo Finance, the US Bureau of Labor Statistics, the US Energy Information Administration, the World Bank, Eurostat, the European Central Bank, the Bank of England, the UK's Office of National Statistics, Deutsche Bundesbank, and INSEE. |
License: | GPL-2 | GPL-3 [expanded from: GPL] |
RoxygenNote: | 7.2.3 |
URL: | https://github.com/abielr/pdfetch |
BugReports: | https://github.com/abielr/pdfetch/issues |
NeedsCompilation: | no |
Packaged: | 2024-12-17 02:49:33 UTC; abielr |
Author: | Abiel Reinhart [aut, cre] |
Maintainer: | Abiel Reinhart <abielr@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-12-17 03:30:02 UTC |
A package for downloading economic and financial time series from public sources.
Description
Download economic and financial time series from public sources
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling 'rhs(lhs)'.
Fetch data from U.S. Bureau of Labor Statistics
Description
Fetch data from U.S. Bureau of Labor Statistics
Usage
pdfetch_BLS(identifiers, from, to)
Arguments
identifiers |
a vector of BLS time series IDs |
from |
start year |
to |
end year. Note that the request will fail if this is a future year that is beyond the last available data point in the series. |
Value
a xts object
Examples
## Not run:
pdfetch_BLS(c("EIUIR","EIUIR100"), 2005, 2010)
## End(Not run)
Fetch data from the Bank of England Interactive Statistical Database
Description
Fetch data from the Bank of England Interactive Statistical Database
Usage
pdfetch_BOE(identifiers, from, to = Sys.Date())
Arguments
identifiers |
a vector of BoE series codes |
from |
start date |
to |
end date; if not given, today's date will be used |
Value
a xts object
See Also
http://www.bankofengland.co.uk/boeapps/iadb/
Examples
## Not run:
pdfetch_BOE(c("LPMVWYR", "LPMVWYR"), "2012-01-01")
## End(Not run)
Fetch data from the Deutsche Bundesbank
Description
Fetch data from the Deutsche Bundesbank
Usage
pdfetch_BUNDESBANK(identifiers)
Arguments
identifiers |
a vector of series codes |
Value
a xts object
See Also
https://www.bundesbank.de/en/statistics/time-series-databases
Examples
## Not run:
pdfetch_BUNDESBANK(c("BBNZ1.Q.DE.Y.H.0000.A","BBK01.BJ9069"))
## End(Not run)
Fetch data from European Central Bank's statistical data warehouse
Description
Fetch data from European Central Bank's statistical data warehouse
Usage
pdfetch_ECB(identifiers)
Arguments
identifiers |
a vector of ECB series IDs |
Value
a xts object
See Also
Examples
## Not run:
pdfetch_ECB("FM.B.U2.EUR.4F.KR.DFR.CHG")
## End(Not run)
Fetch data from the US Energy Information Administration
Description
Fetch data from the US Energy Information Administration
Usage
pdfetch_EIA(identifiers, api_key)
Arguments
identifiers |
a vector of EIA series codes |
api_key |
EIA API key |
Value
a xts object. Note that for hourly series the time zone will always be set to GMT, whereas the true time zone may be different. If you wish to use the correct time zone you must manually convert it.
See Also
Examples
## Not run:
pdfetch_EIA(c("ELEC.GEN.ALL-AK-99.A","ELEC.GEN.ALL-AK-99.Q"), EIA_KEY)
## End(Not run)
Fetch data from Eurostat
Description
Eurostat stores its statistics in data cubes, which can be browsed at https://ec.europa.eu/eurostat/data/database. To access data, specify the name of a data cube and optionally filter it based on its dimensions.
Usage
pdfetch_EUROSTAT(flowRef, from, to, ...)
Arguments
flowRef |
Eurostat dataset code |
from |
a Date object or string in YYYY-MM-DD format. If supplied, only data on or after this date will be returned |
to |
a Date object or string in YYYY-MM-DD format. If supplied, only data on or before this date will be returned |
... |
optional dimension filters for the dataset |
Value
a xts object
Examples
## Not run:
pdfetch_EUROSTAT("namq_gdp_c", FREQ="Q", S_ADJ="NSA", UNIT="MIO_EUR",
INDIC_NA="B1GM", GEO=c("DE","UK"))
## End(Not run)
Fetch description for a Eurostat dataset
Description
Fetch description for a Eurostat dataset
Usage
pdfetch_EUROSTAT_DSD(flowRef)
Arguments
flowRef |
Eurostat dataset code |
Examples
## Not run:
pdfetch_EUROSTAT_DSD("namq_gdp_c")
## End(Not run)
Fetch data from St Louis Fed's FRED database
Description
Fetch data from St Louis Fed's FRED database
Usage
pdfetch_FRED(identifiers)
Arguments
identifiers |
a vector of FRED series IDs |
Value
a xts object
See Also
Examples
## Not run:
pdfetch_FRED(c("GDPC1", "PCECC96"))
## End(Not run)
Fetch data from the French National Institute of Statistics and Economic Studies (INSEE)
Description
Fetch data from the French National Institute of Statistics and Economic Studies (INSEE)
Usage
pdfetch_INSEE(identifiers)
Arguments
identifiers |
a vector of INSEE series codes |
Value
a xts object
See Also
https://www.insee.fr/en/accueil
Examples
## Not run:
pdfetch_INSEE(c("000810635"))
## End(Not run)
Fetch data from the UK Office of National Statistics
Description
The ONS maintains multiple data products; this function can be used to retrieve data from the Time Series Explorer, see https://www.ons.gov.uk/timeseriestool
Usage
pdfetch_ONS(identifiers, dataset)
Arguments
identifiers |
a vector of ONS series codes |
dataset |
optional ONS dataset name, only used if a time series is available in multiple datasets. |
Value
a xts object
Examples
## Not run:
pdfetch_ONS(c("LF24","LF2G"), "lms")
## End(Not run)
Fetch data from World Bank
Description
Fetch data from World Bank
Usage
pdfetch_WB(indicators, countries = "all")
Arguments
indicators |
a vector of World Bank indicators |
countries |
a vector of country identifiers, which can be 2- or 3-character ISO codes. The special option "all" retrieves all countries. |
Value
a xts object
See Also
Examples
## Not run:
pdfetch_WB("NY.GDP.MKTP.CD", c("BR","MX"))
## End(Not run)
Fetch data from Yahoo Finance
Description
Fetch data from Yahoo Finance
Usage
pdfetch_YAHOO(
identifiers,
fields = c("open", "high", "low", "close", "adjclose", "volume"),
from = as.Date("2007-01-01"),
to = Sys.Date(),
interval = c("1d", "1wk", "1mo", "daily", "weekly", "monthly")
)
Arguments
identifiers |
a vector of Yahoo Finance tickers |
fields |
can be any of "open", "high", "low", "close", "volume", or "adjclose" |
from |
a Date object or string in YYYY-MM-DD format. If supplied, only data on or after this date will be returned |
to |
a Date object or string in YYYY-MM-DD format. If supplied, only data on or before this date will be returned |
interval |
the frequency of the return data, can be '1d', '1wk', or '1mo' |
Value
a xts object
See Also
Examples
## Not run:
pdfetch_YAHOO(c("^gspc","^ixic"))
pdfetch_YAHOO(c("^gspc","^ixic"), "adjclose")
## End(Not run)