The Data Scientist edition of Macrobond includes the following API enhancements. If they sound like something you’d like to try out, you can learn more and request a trial here.
One significant feature of Data Scientist is that it includes access to revision history for many series in our database. This makes it possible to
- See what data points were updated and exactly what changes were made with each revision
- Get a vintage version of a series in order to perform an analysis using only information available at that time
- See how a value has been revised over time
The revision data we currently carry includes up to two years of history from primary sources, as well as extensions in specific cases – for example: ONS, BLS, BEA, FED and OECD data. Our coverage focuses on forecasts, national accounts, labor market, trade, product, balance of payments, as well as foreign and public finance. Regionally, the focus is on G20 countries with a priority on larger economies initially. During 2020, we will work to expand both the geographies and categories covered.
Some Examples of Data Scientist Revision History
To find out if a series stores revision history, you can either look for the metadata attribute “StoresRevisionHistory” or use the method HasRevisions in Python/MATLAB or getHasRevisions in R.
Here is an example in R that downloads the revision history for the series usgdp and plots the first and second release.
seriesGdp <- FetchOneTimeSeriesWithRevisions(“usgdp”)
firstRelease <- getNthRelease(seriesGdp, 0)
secondRelease <- getNthRelease(seriesGdp, 1)
x <- MakeXtsFromUnifiedResponse(c(firstRelease, secondRelease))
Here is another example that will show the UK GDP vintages for 2017-2020:
seriesGdp <- FetchOneTimeSeriesWithRevisions(“gbgdp”)
s2017 <- series2018 <- getVintage(seriesGdp, as.Date(“2017-01-01”))
s2018 <- series2018 <- getVintage(seriesGdp, as.Date(“2018-01-01”))
s2019 <- series2018 <- getVintage(seriesGdp, as.Date(“2019-01-01”))
s2020 <- series2018 <- getVintage(seriesGdp, as.Date(“2020-01-01”))
x <- MakeXtsFromUnifiedResponse(c(s2017, s2018, s2019, s2020))
rebased <- sweep(x[‘2015-01-01/’], 2, as.numeric(x[‘2015-01-01’]), “/”)
Another feature that’s now available to Data Scientist users is the ability to search the database filtering different metadata attributes through the APIs.
One common use case of API search is to use the RegionKey attribute to look for key series. The series in the “Concept & Category” tree that you can see in the Macrobond application all have this metadata. You can use the APIs to inspect the metadata of the series and learn what values this attribute has for different series. There are examples how to do that in our Macrobond API documentation.
Here is an example in Python that searches for GDP series in a set of regions:
c = win32com.client.Dispatch(“Macrobond.Connection”)
d = c. Database
query = d.CreateSearchQuery()
query.AddAttributeValueFilter(“Region”, [“us”, “gb”, “cn”])
result = d.Search(query).Entities
for s in result:
text print (s.Name)
The output is: