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");
Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
---|---|---|---|---|---|---|
Mexico | GDP | 12/31/2020 12:00:00 AM | 1090.5100 | Yearly | WGDPMEXI | 6/30/2023 3:54:00 PM |
Mexico | GDP | 12/31/2021 12:00:00 AM | 11272.8400 | Yearly | WGDPMEXI | 12/30/2022 12:46:00 PM |
Mexico | GDP | 12/31/2022 12:00:00 AM | 1414.1900 | Yearly | WGDPMEXI | 6/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");
Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
---|---|---|---|---|---|---|
Mexico | GDP | 12/31/2022 12:00:00 AM | 1414.1900 | Yearly | WGDPMEXI | 6/30/2023 3:54:00 PM |
Mexico | Population | 12/31/2022 12:00:00 AM | 129.0000 | Yearly | MEX SP.POP.TOTL | 5/30/2023 6:48:00 PM |
Sweden | GDP | 12/31/2022 12:00:00 AM | 585.9400 | Yearly | WGDPSWED | 6/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");
Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
---|---|---|---|---|---|---|
Mexico | GDP | 12/31/2022 12:00:00 AM | 1414.1900 | Yearly | WGDPMEXI | 6/30/2023 3:54:00 PM |
Mexico | Population | 12/31/2022 12:00:00 AM | 129.0000 | Yearly | MEX SP.POP.TOTL | 5/30/2023 6:48:00 PM |
Sweden | GDP | 12/31/2022 12:00:00 AM | 585.9400 | Yearly | WGDPSWED | 6/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");
Country | Category | DateTime | Close | Frequency | HistoricalDataSymbol | LastUpdate |
---|---|---|---|---|---|---|
United States | Unemployment Rate | 4/30/2023 12:00:00 AM | 3.4000 | Monthly | USURTOT | 6/2/2023 12:30:00 PM |
United States | Unemployment Rate | 5/31/2023 12:00:00 AM | 3.7000 | Monthly | USURTOT | 7/7/2023 12:30:00 PM |
United States | Unemployment Rate | 6/30/2023 12:00:00 AM | 3.6000 | Monthly | USURTOT | 7/7/2023 12:30:00 PM |
Latest updates
Get historical latest 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");
Country | Category | HistoricalDataSymbol | LastUpdate |
---|---|---|---|
United States | Consumer Credit | UNITEDSTACONCRE | 7/10/2023 7:01:00 PM |
Nicaragua | Foreign Direct Investment | NICARAGUAFORDIRINV | 7/10/2023 5:17:00 PM |
Dominican Republic | External Debt to GDP | DOMEDTG | 7/10/2023 4:29:00 PM |
Response fields
Field | Type | Description | Example |
---|---|---|---|
Country | string | Country name | “Mexico” |
Category | string | Indicator category name | “GDP” |
Date Time | string | Release time and date in UTC | “2021-12-31T00:00:00” |
Close | number | Value * | 1272.8400 |
Frequency | string | Frequency of the indicator | “Yearly” |
HistoricalDataSymbol | string | Unique symbol used by TradingEconomics | “WGDPMEXI” |
LastUpdate | string | Time when new data was inserted or changed | “2022-12-30T12:46:00” |
Fields in ‘Latest updates’
Field | Type | Description | Example |
---|---|---|---|
Country | string | Country name | “Mexico” |
Category | string | Indicator category name | “GDP” |
HistoricalDataSymbol | string | Unique symbol used by TradingEconomics | “WGDPMEXI” |
LastUpdate | string | Time when new data was inserted or changed | “2022-12-30T12:46:00” |
*Python package response field returns Value instead of ‘Close’.