Installation

The Trading Economics Application Programming Interface (API) provides direct access to 300.000 economic indicators, exchange rates, stock market indexes, government bond yields and commodity prices. You can use any programming language to get data from the Trading Economics API. For instance, for Python and Node, you can use our packages to get data easier. You can also use any server based language by passing an endpoint.

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

pip install tradingeconomics

To start using the Trading Economics Python package, open the python command line, and type:

import tradingeconomics as te
te.login('your_api_key')

If you don’t have an API key and just want to try a demo of our API:

te.login()

You can get Node.js from our NodeJs repository. Then you need to install the tradingeconomics package.
In Windows Command Prompt or Linux bash type:

npm install tradingeconomics

To start using the Trading Economics Node package:

const te = require('tradingeconomics');
te.login('your_api_key');

If you don’t have an API key and just want to try a demo of our API:

te.login()

For server based language authentication, use your API key with the endpoint.

WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/indicators?c=your_api_key");

If you don’t have an API key and just want to try a demo of our API, use guest:guest in the endpoints:

 WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/indicators?c=guest:guest");

Authorization parameters can be provided in the URL query.

curl -i "https://api.tradingeconomics.com/country/mexico/?client=your_api_key"

You can also using request Headers

curl -i "https://api.tradingeconomics.com/country/mexico/" -H "Authorization: Client your_api_key"

If you don’t have an API key and just want to try a demo of our API:

curl -i "https://api.tradingeconomics.com/country/mexico/?client=guest:guest"