Skip to main content

Library to download data from Trading Economics API

Project description

title: "Trading Economics API"
output: html_document

#Load Data Directly Into Python

If you don’t already have a copy of Python installed on your computer, you can get it from oficial website

It's recomended to install pip, it is a package management system used to install and manage software packages written in Python. All information you can find on Then just type in Python (command line)
pip install tradingeconomics

There is a possibility to install package using easy_install
Where 'x' is last version number.

As alternatyive you can download package from and then follow the install instructions for [Python 3.x]( or [Python 2.x](

Another method is to download folder from GitHub and then place this folder in your Python library folder.

###Lets start
In command window type

import tradingeconomics as te
If you don't have APIkey just left empty space in brackets.

**Note:** Without APIkey datasets will default to returning sample data.

###How to Use

Results are available in differente formats, such as : JSON, pandas.DataFrame or dictionary.

To get calendar data for specific country, in data frame format, just type
te.getCalendarData(country = 'Italy', output_type = 'df')

In some cases initial date and end date could be specified
te.getHistoricalData(country = 'United Kingdom', indicator = 'GDP', initDate= '1990-01-01', endDate= '2015-01-01')

For several countries and indicators
te.getHistoricalData(country = ['United States', 'Germany'], indicator = ['Exports','Imports', 'GDP'], initDate= '1990-01-01', endDate= '2015-01-01')

To get stock market index just type
te.getMarketsData(marketsField = 'index', output_type = 'df')

Forecasted values for spcifique countrie, in this case Portugal.
te.getForecastData(country = 'Portugal', output_type = 'df')

Next code will give you Country/Indicator pair
te.getIndicatorData(country = 'United Kingdom', indicators = 'Imports')


Easy graphical representation
import matplotlib.pyplot as plt
mydata = te.getHistoricalData(country = 'United Kingdom', indicators = 'GDP')

and some stratistics
import numpy as np

# 1081.0103571428572
# 827.63999999999999
# 953.846661
# 2990.2
# 72.33

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
tradingeconomics-0.2.933-py2-none-any.whl (31.1 kB) Copy SHA256 hash SHA256 Wheel py2
tradingeconomics-0.2.933-py3-none-any.whl (28.9 kB) Copy SHA256 hash SHA256 Wheel py3
tradingeconomics-0.2.933.tar.gz (16.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page