Trading Economics | Packages Installation

The Trading Economics Application Programming Interface (API) is available in different programming languages. Providing several request methods to query our databases, with samples available in different programming languages, it is the best way to access data in JSON, XML or CSV formats. In addition, you can also use the Trading Economics packages listed below to have easy access to the API.

Install the tradingeconomics package using pip, a package management system used to install and manage software packages written in Python.

pip install tradingeconomics

Using package

import tradingeconomics as te                #1
te.login('your_api_key')                     #2
data = te.getIndicatorData(country='mexico') #3
  • #1 Imports Trading Economics Python package

  • #2 Calls the authentication method

  • #3 Makes a call to the API. You can change the parameters to what you like

By default, the response will be a list of dictionaries.

You can also change the output type to Pandas dataframe:

data = te.getIndicatorData(country='mexico', output_type='df')

Pre-requirements

Install the tradingeconomics package using npm, a package management system used to install and manage software packages written in JavaScript. In Windows Command Prompt or Linux bash type:

npm install tradingeconomics

Using package

const te = require('tradingeconomics');                              //1
te.login('your_api_key');                                            //2
data = te.getIndicatorData(country = 'mexico').then(function(data){  //3
});
  • //1 Imports Trading Economics Node.js package

  • //2 Calls the authentication method

  • //3 Makes a call to the API. You can change the parameters to what you like

By default, Node.js package shows data as array of Javascript objects.