The Trading Economics Application Python package provides direct access to millions of time series with economic data, financial markets quotes, commodity prices, crypto currencies data and much more. It also allows you to query Trading Economics real-time economic calendar and to subscribe to updates.
pip install tradingeconomics
Install the latest version directly from GitHub
git clone https://github.com/tradingeconomics/tradingeconomics-python.git
cd tradingeconomics-python
python setup.py install
Protect your credentials! Please set your keys as environment variables before you launch your application. This lets you share your code without disclosing your credentials.
In Windows, you can permanently set environment variables using a settings window - just type "environment variables" on windows search to locate it. As an alternative, you can temporarily set them using the command line terminal.
# windows command line
set apikey='guest:guest'
export apikey='guest:guest'
import tradingeconomics as te
te.login()
import tradingeconomics as te
te.login('guest:guest')
Please replace guest:guest with your API key or we will be returning sample data.
te.getCalendarData()
te.getIndicatorData(country=['mexico', 'sweden'], output_type='df')
te.getMarketsData(marketsField = 'commodities')
te.getMarketsBySymbol(symbols='aapl:us')
te.getFinancialsData(symbol = 'aapl:us', output_type = 'df')
https://github.com/tradingeconomics/tradingeconomics-python/tree/main/examples
Try our python interface in a container without installing anything
docker run -it --name te-python tradingeconomics-python:latest