API libraries

You can connect to the API using a variety of languages. Most of the libraries are available for download on Github.

Python (Github)

The inquisitor module allows to download and manage series data from the API.

from inquisitor import Inquisitor
token = '<40 char token>'
ticker_list  = ["GDPQES", "GDPQFR"]
qbuilder = Inquisitor(token)
df = qbuilder.series(ticker=ticker_list)

R (Github)

The R package to connect to the API can be downloaded from GitHub using the install_github command (requires Rtools in Windows). Alternatively the fetch function can be copied and included directly to environment.

install.packages("devtools")
library(devtools)
install_github("inquirim/inquirim")
library(inquirim)
token <- ''# fill with your API token
library(ggplot2)
library(reshape)
ticker_list <-c("GDPQES", "GDPQFR")
result_set <- fetch(ticker_list, token)
df <- result_set$data
melted<-melt(df,id= 'Dates')
ggplot(melted,aes(x=Dates,y=value,group=variable,color=variable) )+
	geom_line()+
	scale_x_date()

Excel (Github)

Installing

The script query_module.vb can be pasted in the Visual Basic Editor of an Excel file, either in a custom module or in the Workbook code.

For instance, in a file named Book1.xls you can copy-paste the query_module.vb code by modifying the Book1.xls Visual Basic which is found in this path:

Developer > Visual Basic > VBAProject(Book1) > Excel Objects > ThisWorkbook > Right click and View code.

You may edit the sheet name ("Sheet1") and cell address ("A10") where the table will be written, the econdb.com/api URL you want to fetch, and write a valid token to identify your inquirim.com account.

Finally, run the subroutine Inquirim_Wrap to download or refresh the data table.

Valid URL examples
  • https://www.econdb.com/api/series/?ticker=GDPYUS,GDPYFR
  • https://www.econdb.com/api/datasets/?source=UN
  • https://www.econdb.com/api/sources/

Julia (Github)

Installing

Pkg.clone("git://github.com/inquirim/inquisitorjl.git")

Running
Pkg.clone("git://github.com/inquirim/inquisitorjl.git")
include(Pkg.dir() * "/inquisitorjl/inquirimFetch.jl")
ticker_list = ["GDPQES", "GDPQFR"]
token = "<your API token here>"
df = fetchInquirim(ticker_list, token)
df

Matlab

There is no official module to connect to the API written in Matlab. However, you can make use of the snippet below to submit queries to /api/ticker. In it we assume that the modules JSON and urlread2 are in the path (links to MatlabCentral/fileExchange: JSON, urlread2).

token = "<your API token here>";
url = 'http://www.econdb.com/api/series/?format=json';
headersIn = struct('name', 'Authorization','value',strcat('Token ',token));
res = urlread2(url, 'GET','',headersIn);

data = JSON.parse(res),
data.results{1}

Stata

To download statistics to Stata, the appropriate Stata command is copy. Point copy to the API /series/ endpoint, and request the output in CSV format. Set the token parameter to your account API token. Make sure the Stata application has permissions to write on the current directory, or else, set the current directory where the permission is granted.

copy "https://www.econdb.com/api/series/?ticker=GDPQES,GDPQFR&format=csv&token=<api_token>" raw.csv
import delim raw.csv, delimiter(",") rowrange(11)
gen date2 = date(ticker, "YMD")
tsset date2
twoway (tsrline gdpqes gdpqfr)

C++ (Github)

Inquirimfetch is a tiny class that uses the C++ library curl to get ticker data in json format. This is an example of use:

#include <iostream>
#include "inquirimfetch.h"
int main() {
    InquirimFetch* ifetch = new InquirimFetch();
    ifetch->set_token("<API_TOKEN>");
     string* tickers = new string[1];
    tickers[0] = "GDPQES";
    cout <<  ifetch->get(tickers,"both","19000101","21000101","json");
    return (0);
}