- Upgrading the Macrobond API
Macrobond offers an API that can be used in R for Windows.
- Download any time series including values, dates and metadata.
- Convert a set of time series to a common calendar and optionally a common currency.
- Fill in missing values with a selection of methods.
- Upload your own series to the in-house database which can then be used in the Macrobond application and optionally shared with others.
To successfully use the API, you might want to learn more about the database and metadata.
The API requires Macrobond to be installed and functioning on the computer where R is run. We provide a package for R 3.2 - 4.0. We have tested R 3.2.2, R 3.4.0 and 3.3.1 (Macrobond API 1.0-3) as well as R 3.5.0 - 4.1.0 (Macrobond API 1.1-1). If you are running the 64-bit version of R, you need to use the 64-bit version of Macrobond.
The Macrobond API uses the "xts" package and requires version 0.9-7 of that package.
NB! We test that the API works with R.exe and RGui.exe. When R is used as an embedded component in other programs, it might or might not work. You need to test this yourself and we can only give limited support in those cases.
This document refers to Macrobond application version 1.24 and Macrobond API for R version 1.2-1.
The Macrobond R API comes in the form of an R binary package called "MacrobondAPI" from the Macrobond repository at https://download.macrobond.com/installation/R (you cannot browse to that URL). Here are two ways to install the Macrobond API package.
You can add this repository to the list of repositories that R will search in various ways. One option is to use the command:
setRepositories(addURLs = c(Macrobond = "https://download.macrobond.com/installation/R"))
or add the repository to the configuration file. See ?setRepositories for details.
Once you have added the Macrobond repository to your list of repositories, you can just run this R command:
- Restart R
- If you do not have "xts" installed, install it by install.packages("xts"). If you have "xts" installed, make sure you have the latest version by running update.packages("xts").
- Install the MacrobondAPI package by running install.packages("MacrobondAPI", type="win.binary", repos="https://download.macrobond.com/installation/R").
- Restart R
- Run update.packages(repos="https://download.macrobond.com/installation/R", type="win.binary").
We urge you to keep your Macrobond API for R up to date. We also suggest that you periodically upgrade the Macrobond application as described here.
Once you have installed the Macrobond API package, you can view the documentation from R like this:
You can view documentation for a specific function directly like this:
While using help available directly from within R - as described above - is the recommended way of reading the Macrobond R API documentation, you can also view it online.
There are plenty of examples in the reference documentation. There is an overview and a collection of examples to help you get started on the overview page. Most help pages for the functions have additional examples.
If you're having problems with the Macrobond R connector please contact us via https://www.macrobond.com/contact/support/ and:
- Describe what you’re trying to achieve
- Include the relevant code you tried to run
- Provide information about version of Macrobond, R and the Macrobond’s R add–in. To do it, issue those two commands:
and send us the output.