Title: | Query Data Series from Bank of Mexico |
---|---|
Description: | Allows to retrieve time series of all indicators available in the Bank of Mexico's Economic Information System (<http://www.banxico.org.mx/SieInternet/>). |
Authors: | DGIE - Banco de México |
Maintainer: | Noé Palmerin <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-12-03 06:32:12 UTC |
Source: | CRAN |
This is an utility function, it allows to obtain a data.frame from the vector returned by
getSeriesData
.
getSerieDataFrame(series, idSerie)
getSerieDataFrame(series, idSerie)
series |
A vector containing data series. This is the vector returned by
|
idSerie |
A string intentifying the series required, it can only be one. |
A data.frame containing the required data series.
## Not run: ## You need a valid token to run the example setToken("token") series <- getSeriesMetadata(c("SF43718","SF46410","SF46407")) serie <- getSerieDataFrame(series, "SF43718") ## End(Not run)
## Not run: ## You need a valid token to run the example setToken("token") series <- getSeriesMetadata(c("SF43718","SF46410","SF46407")) serie <- getSerieDataFrame(series, "SF43718") ## End(Not run)
Recovers last value of the indicated time series (up to 100) from SIE.
getSeriesCurrentValue(series)
getSeriesCurrentValue(series)
series |
A vector containing idSeries |
This function queries the last value of each series requested. This value corresponds to the last one published by Banco de México.
The data series are queried throught the SIE API.
This API requieres that every request is identified by a token. The token can be requested
here.
Once the query token has been obtained and prior to use any function from this Package,
the token must be set in the current query session, using the function setToken
.
A data.frame containing the data series requested.
## Not run: ## You need a valid token to run the example setToken(token) idSeries <- c("SF43718","SF46410","SF46407") seriesDataFrame <- getSeriesCurrentValue(idSeries) serieDataFrame <- getSeriesCurrentValue("SF43718") ## End(Not run)
## Not run: ## You need a valid token to run the example setToken(token) idSeries <- c("SF43718","SF46410","SF46407") seriesDataFrame <- getSeriesCurrentValue(idSeries) serieDataFrame <- getSeriesCurrentValue("SF43718") ## End(Not run)
Recovers data of the indicated time series (up to 100) from SIE.
getSeriesData(series, startDate = NULL, endDate = NULL)
getSeriesData(series, startDate = NULL, endDate = NULL)
series |
A vector containing idSeries |
startDate |
A string with "yyyy-MM-dd" format. Defines the date on which the period of obtained data starts. |
endDate |
A string with "yyyy-MM-dd" format. Defines the date on which the period of obtained data concludes. |
The data series are queried throught the SIE API.
This API requieres that every request is identified by a token. The token can be requested
here.
Once the query token has been obtained and prior to use any function from this Package,
the token must be set in the current query session, using the function setToken
.
To get a data.frame representing one data series use getSerieDataFrame
.
A vector containing the data series requested.
## Not run: ## You need a valid token to run the example setToken("token") idSeries <- c("SF43718","SF46410","SF46407") series <- getSeriesData(idSeries, '2016-01-01','2018-07-12') serie <- getSeriesData("SF43718") ## End(Not run)
## Not run: ## You need a valid token to run the example setToken("token") idSeries <- c("SF43718","SF46410","SF46407") series <- getSeriesData(idSeries, '2016-01-01','2018-07-12') serie <- getSeriesData("SF43718") ## End(Not run)
Recovers metadata of the indicated time series (up to 100) from SIE.
getSeriesMetadata(series, locale = "en")
getSeriesMetadata(series, locale = "en")
series |
A vector containing idSeries. |
locale |
A string defining the language of the metadata. It can be obtained either in English ("en") or Spanish ("es"). |
The series metadata are queried throught the SIE API.
This API requieres that every request is identified by a token. The token can be requested
here.
Once the query token has been obtained and prior to use any function from this Package,
the token must be set in the current query session, using the function setToken
.
The information can be obtained either in English ("en") or Spanish ("es"), defining the parameter locale. By default the metadata are retrieved in English.
A data.frame containing the required metadata.
## Not run: ## You need a valid token to run the example setToken(token) series <- getSeriesMetadata(c("SF43718","SF46410","SF46407")) serie <- getSeriesMetadata("SF43718") ## End(Not run)
## Not run: ## You need a valid token to run the example setToken(token) series <- getSeriesMetadata(c("SF43718","SF46410","SF46407")) serie <- getSeriesMetadata("SF43718") ## End(Not run)
Set the token required to query series from SIE.
setToken(token)
setToken(token)
token |
A string that corresponds to the query token obtained. |
This configuration is required prior to any function call pertaining to this package. The API used by siebanxicor requires that every request made, be identified by a token. Otherwise the query will be rejected. In order to work properly with this package is necessary to get a token here.
Before any request can be made with other functions, the obtained token must be set.
# an own token must be obtained token <- "d4b584b43a1413f56e5abdcc0f9e74db112ce9bb2f1580c80cb252f5a18b30a21" setToken(token)
# an own token must be obtained token <- "d4b584b43a1413f56e5abdcc0f9e74db112ce9bb2f1580c80cb252f5a18b30a21" setToken(token)
This package is aimed at querying data series from Banco de México.
siebanxicor allows to retrieve the time series of all indicators available in SIE. This tool aims at developers and analysts who seek to make automatic the retrieval of the economic information published by Banco de México.
This package uses the SIE API to obtain the data series published. This API requires that every request be identified by a token. This query token can be obtained here. The query token can be used in multiple requests, as long as the query limits are respected (more information).
To start using the functions included in this package, is mandatory first to set the token
using setToken
:
token <- "d4b584b43a1413f56e5abdcc0f9e74db112ce9bb2f1580c80cb252f5a18b30a21" setToken(token)
The string token is only an example, an own token must be generated in the aforementioned link.
Once the token has been set, the data series can be retrieved using getSeriesData
:
idSeries <- c("SF43718","SF46410","SF46407") series <- getSeriesData(idSeries)
The time period retrieved can be limited using the parameters startDate
and endDate
.
These parameters are strings that represent a date in the format "yyyy-MM-dd".
If one of these dates is omitted the entire data are returned.
idSeries <- c("SF43718","SF46410","SF46407") series <- getSeriesData(idSeries, startDate='2016-01-01',endDate='2018-07-12')
It is also possible to query only the current value of certain time series. The function getSeriesCurrentValue
accomplishes this task:
idSeries <- c("SF43718","SF46410","SF46407") seriesDataFrame <- getSeriesCurrentValue(idSeries) serieDataFrame <- getSeriesCurrentValue("SF43718")
The value returned is the last one published in SIE.
The series metadata can be queried with the function getSeriesMetadata
:
series <- getSeriesMetadata(c("SF43718","SF46410","SF46407"))
The idSeries requiered to use this package can be found in SIE and in the "Series catalogue"