Historical

The API also provides historical data using the same parameters as Indicator snapshot data.

By country and indicator

Get historical data by specific country and indicator. It’s possible to use one or multiple countries and indicators, also a date range

/historical/country/{country}/indicator/{indicator}

te.getHistoricalData(country='mexico', indicator='gdp', output_type='df')
data = te.getHistoricalData(country = 'mexico', indicator = 'gdp').then(function(data){
  console.log(data)       
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/historical/country/mexico/indicator/gdp?c=guest:guest");

/historical/country/{countries}/indicator/{indicators}/{yyyy-mm-dd}

te.getHistoricalData(country=['mexico', 'sweden'], indicator=['gdp','population'], 
 initDate='2015-01-01', output_type='df')
data = te.getHistoricalData(country = ['mexico','sweden'], indicator = ['gdp','population'], 
 start_date = '2015-01-01').then(function(data){
  console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/historical/country/mexico,sweden/indicator/gdp,population/2015-01-01?c=guest:guest");

/historical/country/{countries}/indicator/{indicators}/{yyyy-mm-dd}/{yyyy-mm-dd}

te.getHistoricalData(country=['mexico', 'sweden'], indicator=['gdp','population'], 
 initDate='2015-01-01', endDate='2015-12-31', output_type='df')
data = te.getHistoricalData(country = ['mexico','sweden'], indicator = ['gdp','population'], 
 start_date = '2015-01-01', end_date = '2015-12-31').then(function(data){
  console.log(data)
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/historical/country/mexico,sweden/indicator/gdp,population/2015-01-01/2015-12-31?c=guest:guest");

By ticker

Get historical data by specific ticker

/historical/ticker/{ticker}/{yyyy-mm-dd}

te.getHistoricalByTicker(ticker = 'USURTOT', start_date = '2015-03-01', output_type='df')   
data = te.getHistoricalData(ticker = 'usurtot', start_date = '2015-03-01' ).then(function(data){
  console.log(data)       
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/historical/ticker/USURTOT/2015-03-01?c=guest:guest");

Latest updates

Get historical latest updates

/historical/updates

te.getHistoricalUpdates(output_type='df')
data = te.getHistoricalUpdates().then(function(data){
  console.log(data)       
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/historical/updates?c=guest:guest");

Response fields

FieldTypeDescriptionExample
CountrystringCountry name“Mexico”
CategorystringIndicator category name“GDP”
Date TimestringRelease time and date in UTC“2021-12-31T00:00:00”
ClosenumberValue *1272.8400
FrequencystringFrequency of the indicator“Yearly”
HistoricalDataSymbolstringUnique symbol used by TradingEconomics“WGDPMEXI”
LastUpdatestringTime when new data was inserted or changed“2022-12-30T12:46:00”

Fields in ‘Latest updates’

FieldTypeDescriptionExample
CountrystringCountry name“Mexico”
CategorystringIndicator category name“GDP”
HistoricalDataSymbolstringUnique symbol used by TradingEconomics“WGDPMEXI”
LastUpdatestringTime when new data was inserted or changed“2022-12-30T12:46:00”

*Python package response field returns Value instead of ‘Close’.