Historical
The historical endpoint contains a time series with an indicator identifier, the reference date, the last update date and the observed value. It allows one to check the evolution of key indicators over time.
By ID
Using Requests:
import requests
api_key = 'YOUR_API_KEY'
url = f'https://api.tradingeconomics.com/eurostat/historical/24804?c={api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
import tradingeconomics as te
te.login('your_api_key')
te.getHistoricalEurostat(ID = '24804')
Using Requests:
const axios = require('axios');
(async () => {
const api_key = 'YOUR_API_KEY'
const response = await axios.get(`https://api.tradingeconomics.com/eurostat/historical/24804?c=${api_key}`)
console.log(response.data)
})()
Or using our package:
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getEurostatHistorical(id = '24804').then(function(data){
console.log(data)
});
Using Requests:
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/eurostat/historical/24804?c=your_api_key"))
{
request.Headers.TryAddWithoutValidation("Upgrade-Insecure-Requests", "1");
var response = await httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
}
The response data format can be configured by appending the &f= parameter to the URL request.
ID | Date | Value | LastUpdate |
---|---|---|---|
24804 | 12/31/2020 12:00:00 AM | 2.4000 | 4/20/2021 11:16:00 PM |
24804 | 12/31/2019 12:00:00 AM | 1.8000 | 7/2/2020 5:46:00 PM |
24804 | 12/31/2018 12:00:00 AM | 2.1000 | 7/2/2020 5:46:00 PM |
/eurostat/historical/{id}?f=json
[{"ID":24804,"Date":"2020-12-31T00:00:00","Value":2.4000,"LastUpdate":"2021-04-20T23:16:00"},{"ID":24804,"Date":"2019-12-31T00:00:00","Value":1.8000,"LastUpdate":"2020-07-02T17:46:00"},{"ID":24804,"Date":"2018-12-31T00:00:00","Value":2.1000,"LastUpdate":"2020-07-02T17:46:00"}]
/eurostat/historical/{id}?f=csv
ID,Date,Value,LastUpdate
24804,12/31/2020 12:00:00 AM,2.4000,4/20/2021 11:16:00 PM
24804,12/31/2019 12:00:00 AM,1.8000,7/2/2020 5:46:00 PM
24804,12/31/2018 12:00:00 AM,2.1000,7/2/2020 5:46:00 PM
/eurostat/historical/{id}?f=xml
<ArrayOfEurostat.eurostatHistorical xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/APILib.DB">
<Eurostat.eurostatHistorical>
<Date>2020-12-31T00:00:00</Date>
<ID>24804</ID>
<LastUpdate>2021-04-20T23:16:00</LastUpdate>
<Value>2.4000</Value>
</Eurostat.eurostatHistorical>
<Eurostat.eurostatHistorical>
<Date>2019-12-31T00:00:00</Date>
<ID>24804</ID>
<LastUpdate>2020-07-02T17:46:00</LastUpdate>
<Value>1.8000</Value>
</Eurostat.eurostatHistorical>
<Eurostat.eurostatHistorical>
<Date>2018-12-31T00:00:00</Date>
<ID>24804</ID>
<LastUpdate>2020-07-02T17:46:00</LastUpdate>
<Value>2.1000</Value>
</Eurostat.eurostatHistorical>
</ArrayOfEurostat.eurostatHistorical>
By ID and date
Using Requests:
import requests
api_key = 'YOUR_API_KEY'
url = f'https://api.tradingeconomics.com/eurostat/historical/24804?d1=2015-01-01&c={api_key}'
data = requests.get(url).json()
print(data)
Or using our package:
te.getHistoricalEurostat(ID = '24804', initDate = '2015-01-01')
With end date:
te.getHistoricalEurostat(ID = '24804', initDate = '2016-01-01',
endDate = '2020-01-01')
Using Requests:
const axios = require('axios');
(async () => {
const api_key = 'YOUR_API_KEY'
const response = await axios.get(`https://api.tradingeconomics.com/eurostat/historical/24804?d1=2015-01-01&c=${api_key}`)
console.log(response.data)
})()
Or using our package:
data = te.getEurostatHistorical(id = '24804', start_date = '2016-01-01').then(function(data){
console.log(data)
});
With end date:
data = te.getEurostatHistorical(id = '24804', start_date = '2016-01-01',
end_date = '2020-01-01').then(function(data){
console.log(data)
});
Using Requests:
using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/eurostat/historical/24804?d1=2015-01-01&c=your_api_key"))
/eurostat/historical/{id}?d1={yyyy-mm-dd}
ID | Date | Value | LastUpdate |
---|---|---|---|
24804 | 12/31/2020 12:00:00 AM | 2.4000 | 4/20/2021 11:16:00 PM |
24804 | 12/31/2019 12:00:00 AM | 1.8000 | 7/2/2020 5:46:00 PM |
24804 | 12/31/2018 12:00:00 AM | 2.1000 | 7/2/2020 5:46:00 PM |
/eurostat/historical/{id}?d1={yyyy-mm-dd}&f=json
[{"ID":24804,"Date":"2020-12-31T00:00:00","Value":2.4000,"LastUpdate":"2021-04-20T23:16:00"},{"ID":24804,"Date":"2019-12-31T00:00:00","Value":1.8000,"LastUpdate":"2020-07-02T17:46:00"},{"ID":24804,"Date":"2018-12-31T00:00:00","Value":2.1000,"LastUpdate":"2020-07-02T17:46:00"}]
/eurostat/historical/{id}?d1={yyyy-mm-dd}&f=csv
ID,Date,Value,LastUpdate
24804,12/31/2020 12:00:00 AM,2.4000,4/20/2021 11:16:00 PM
24804,12/31/2019 12:00:00 AM,1.8000,7/2/2020 5:46:00 PM
24804,12/31/2018 12:00:00 AM,2.1000,7/2/2020 5:46:00 PM
/eurostat/historical/{id}?d1={yyyy-mm-dd}&f=xml
<ArrayOfEurostat.eurostatHistorical xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/APILib.DB">
<Eurostat.eurostatHistorical>
<Date>2020-12-31T00:00:00</Date>
<ID>24804</ID>
<LastUpdate>2021-04-20T23:16:00</LastUpdate>
<Value>2.4000</Value>
</Eurostat.eurostatHistorical>
<Eurostat.eurostatHistorical>
<Date>2019-12-31T00:00:00</Date>
<ID>24804</ID>
<LastUpdate>2020-07-02T17:46:00</LastUpdate>
<Value>1.8000</Value>
</Eurostat.eurostatHistorical>
<Eurostat.eurostatHistorical>
<Date>2018-12-31T00:00:00</Date>
<ID>24804</ID>
<LastUpdate>2020-07-02T17:46:00</LastUpdate>
<Value>2.1000</Value>
</Eurostat.eurostatHistorical>
</ArrayOfEurostat.eurostatHistorical>
Response fields
Field | Type | Description | Example |
---|---|---|---|
ID | number | Trading Economics unique identifier | 24804 |
Date | string | Release time and date in UTC | “2020-12-31T00:00:00” |
Value | number | Value | 2.4000 |
LastUpdate | string | Time when new data was inserted or changed | “2021-04-20T23:16:00” |