Skip to content
Docs
Get API key
Comtrade

Comtrade Historical Data

Use the following API endpoints to obtain COMTRADE historical data.

The historical endpoint contains a time series with an indicator identifier, the reference date and the observed value. It allows one to check the evolution of key indicators over time.

By symbol

Using Requests:

Python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/comtrade/historical/PRTESP24031,NORZWEXX991?c={your_api_key}'
data = requests.get(url).json()
print(data)

Or using our package:

Python
import tradingeconomics as te
te.login('your_api_key')
te.getCmtHistorical(symbol = 'PRTESP24031')

With multi symbols:

Python
te.getCmtHistorical(symbol = 'PRTESP24031, NORZWEXX991')

The response data format can be configured by appending the &f= parameter to the URL request.

Text
https://api.tradingeconomics.com/comtrade/historical/{symbols}?c={your_api_key}&f=json
JSON
[
  {
    "symbol": "PRTESP24031",
    "date": "1997-12-31T00:00:00",
    "value": 707.0
  },
  {
    "symbol": "PRTESP24031",
    "date": "1998-12-31T00:00:00",
    "value": 7020.0
  },
  {
    "symbol": "PRTESP24031",
    "date": "2000-12-31T00:00:00",
    "value": 54310.0
  }
]

Response fields

FieldTypeDescriptionExample
SymbolstringUnique symbol used by Trading Economics“NORZWEXX991”
DatestringYear of the updated series“1995-12-31T00:00:00”
ValuestringTrade value3161.0