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}

import tradingeconomics as te
te.login('your_api_key')
te.getHistoricalData(country='mexico', indicator='gdp')
const te = require('tradingeconomics');
te.login('your_api_key');
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");
CountryCategoryDateTimeCloseFrequencyHistoricalDataSymbolLastUpdate
MexicoGDP12/31/2020 12:00:00 AM1090.5100YearlyWGDPMEXI6/30/2023 3:54:00 PM
MexicoGDP12/31/2021 12:00:00 AM11272.8400YearlyWGDPMEXI12/30/2022 12:46:00 PM
MexicoGDP12/31/2022 12:00:00 AM1414.1900YearlyWGDPMEXI6/30/2023 3:54:00 PM

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

te.getHistoricalData(country=['mexico', 'sweden'], indicator=['gdp','population'], 
 initDate='2015-01-01')
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");
CountryCategoryDateTimeCloseFrequencyHistoricalDataSymbolLastUpdate
MexicoGDP12/31/2022 12:00:00 AM1414.1900YearlyWGDPMEXI6/30/2023 3:54:00 PM
MexicoPopulation12/31/2022 12:00:00 AM129.0000YearlyMEX SP.POP.TOTL5/30/2023 6:48:00 PM
SwedenGDP12/31/2022 12:00:00 AM585.9400YearlyWGDPSWED6/30/2023 3:55:00 PM

/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')
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");
CountryCategoryDateTimeCloseFrequencyHistoricalDataSymbolLastUpdate
MexicoGDP12/31/2022 12:00:00 AM1414.1900YearlyWGDPMEXI6/30/2023 3:54:00 PM
MexicoPopulation12/31/2022 12:00:00 AM129.0000YearlyMEX SP.POP.TOTL5/30/2023 6:48:00 PM
SwedenGDP12/31/2022 12:00:00 AM585.9400YearlyWGDPSWED6/30/2023 3:55:00 PM

By ticker

Get historical data by specific ticker

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

te.getHistoricalByTicker(ticker = 'USURTOT', start_date = '2015-03-01')   
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");
CountryCategoryDateTimeCloseFrequencyHistoricalDataSymbolLastUpdate
United StatesUnemployment Rate4/30/2023 12:00:00 AM3.4000MonthlyUSURTOT6/2/2023 12:30:00 PM
United StatesUnemployment Rate5/31/2023 12:00:00 AM3.7000MonthlyUSURTOT7/7/2023 12:30:00 PM
United StatesUnemployment Rate6/30/2023 12:00:00 AM3.6000MonthlyUSURTOT7/7/2023 12:30:00 PM

Latest updates

Get historical latest updates

/historical/updates

te.getHistoricalUpdates()
data = te.getHistoricalUpdates().then(function(data){
  console.log(data)       
});
WebRequest request = WebRequest.Create("https://api.tradingeconomics.com/historical/updates?c=guest:guest");
CountryCategoryHistoricalDataSymbolLastUpdate
United StatesConsumer CreditUNITEDSTACONCRE7/10/2023 7:01:00 PM
NicaraguaForeign Direct InvestmentNICARAGUAFORDIRINV7/10/2023 5:17:00 PM
Dominican RepublicExternal Debt to GDPDOMEDTG7/10/2023 4:29:00 PM

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’.