# Markets Historical Data

> Use the following API endpoints to obtain historical data for markets.

Source: https://docs.tradingeconomics.com/markets/historical/

The historical endpoint contains a time series with fields such as symbol, date, open, high, low, close, and observed value. It allows one to check the evolution of key indicators over time.

To find the symbol you need, you can use:

- [**Quotes by Category**](https://docs.tradingeconomics.com/markets/snapshot) — browse available symbols by market category (e.g., stocks, bonds, commodities).
- [**Quotes by Country**](https://docs.tradingeconomics.com/markets/country) — look up symbols filtered by country.
- [**Search**](https://docs.tradingeconomics.com/markets/search) — search for symbols by name or keyword.

## By symbol

> **Note:** The number of rows returned depends on the market and your subscription plan. For predictable results, use the [date parameters](#by-symbol-and-date) to specify the exact range you need.

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/historical/aapl:us?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.getHistorical(symbol='aapl:us')
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getHistoricalMarkets(symbol = 'aapl:us').then(function(data){
  console.log(data)     
});
```

*With multi symbols:*
```javascript
data = te.getHistoricalMarkets(symbol = ['aapl:us','gac:com']).then(function(data){
  console.log(data)     
});
```

**C#**
*Using Requests:*
```c#
using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us?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);
        }
    }
}
```

*With multi symbols:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=your_api_key");
```

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

**JSON**
```text
https://api.tradingeconomics.com/markets/historical/{symbol}?c={your_api_key}&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Date": "14/04/2026",
    "Open": 259.245,
    "High": 261.8901,
    "Low": 257.1901,
    "Close": 258.83
  },
  {
    "Symbol": "AAPL:US",
    "Date": "13/04/2026",
    "Open": 259.73,
    "High": 260.18,
    "Low": 256.66,
    "Close": 259.2
  },
  {
    "Symbol": "AAPL:US",
    "Date": "10/04/2026",
    "Open": 259.98,
    "High": 262.19,
    "Low": 259.0231,
    "Close": 260.48
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/historical/{symbol}?c={your_api_key}&f=csv
```
```bash
Symbol,Date,Open,High,Low,Close
AAPL:US,14/04/2026,259.2450,261.8901,257.1901,258.8300
AAPL:US,13/04/2026,259.7300,260.1800,256.6600,259.2000
AAPL:US,10/04/2026,259.9800,262.1900,259.0231,260.4800
```

**HTML**
```text
https://api.tradingeconomics.com/markets/historical/{symbol}?c={your_api_key}
```

| Symbol | Date | Open | High | Low | Close |
|-------|-------|-------|-------|-------|-------|
| AAPL:US | 14/04/2026 | 259.2450 | 261.8901 | 257.1901 | 258.8300 |
| AAPL:US | 13/04/2026 | 259.7300 | 260.1800 | 256.6600 | 259.2000 |
| AAPL:US | 10/04/2026 | 259.9800 | 262.1900 | 259.0231 | 260.4800 |

## By symbol and date

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/historical/aapl:us?c={your_api_key}&d1=2026-04-01&d2=2026-04-15'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
import tradingeconomics as te
te.login('your_api_key')
te.fetchMarkets(symbol='aapl:us', initDate='2026-04-01', endDate='2026-04-15')
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/markets/historical/aapl:us?c=${your_api_key}&d1=2026-04-01&d2=2026-04-15`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getHistoricalMarkets(symbol = 'aapl:us', start_date = '2026-04-01',
 end_date = '2026-04-15').then(function(data){
  console.log(data)     
});
```

**C#**
*Using Requests:*
```c#
using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us?c=your_api_key&d1=2026-04-01&d2=2026-04-15"))
    {
        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);
        }
    }
}
```

**JSON**
```text
https://api.tradingeconomics.com/markets/historical/{symbol}?c={your_api_key}&d1=yyyy-mm-dd&d2=yyyy-mm-dd&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Date": "14/04/2026",
    "Open": 259.245,
    "High": 261.8901,
    "Low": 257.1901,
    "Close": 258.83
  },
  {
    "Symbol": "AAPL:US",
    "Date": "13/04/2026",
    "Open": 259.73,
    "High": 260.18,
    "Low": 256.66,
    "Close": 259.2
  },
  {
    "Symbol": "AAPL:US",
    "Date": "10/04/2026",
    "Open": 259.98,
    "High": 262.19,
    "Low": 259.0231,
    "Close": 260.48
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/historical/{symbol}?c={your_api_key}&d1=yyyy-mm-dd&d2=yyyy-mm-dd&f=csv
```
```bash
Symbol,Date,Open,High,Low,Close
AAPL:US,14/04/2026,259.2450,261.8901,257.1901,258.8300
AAPL:US,13/04/2026,259.7300,260.1800,256.6600,259.2000
AAPL:US,10/04/2026,259.9800,262.1900,259.0231,260.4800
```

**HTML**
```text
https://api.tradingeconomics.com/markets/historical/{symbol}?c={your_api_key}&d1=yyyy-mm-dd&d2=yyyy-mm-dd
```

| Symbol | Date | Open | High | Low | Close |
|-------|-------|-------|-------|-------|-------|
| AAPL:US | 14/04/2026 | 259.2450 | 261.8901 | 257.1901 | 258.8300 |
| AAPL:US | 13/04/2026 | 259.7300 | 260.1800 | 256.6600 | 259.2000 |
| AAPL:US | 10/04/2026 | 259.9800 | 262.1900 | 259.0231 | 260.4800 |

## By multiple symbols

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?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.getHistorical(symbol='aapl:us')
```

*With multi symbols:*
```python
te.getHistorical(symbol=['aapl:us','gac:com'])
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getHistoricalMarkets(symbol = 'aapl:us').then(function(data){
  console.log(data)     
});
```

*With multi symbols:*
```javascript
data = te.getHistoricalMarkets(symbol = ['aapl:us','gac:com']).then(function(data){
  console.log(data)     
});
```

**C#**
*Using Requests:*
```c#
using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us?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);
        }
    }
}
```

*With multi symbols:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=your_api_key");
```

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

**JSON**
```text
https://api.tradingeconomics.com/markets/historical/{symbols}?c={your_api_key}&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Date": "10/10/2023",
    "Open": 178.1,
    "High": 179.72,
    "Low": 177.95,
    "Close": 178.39
  },
  {
    "Symbol": "GAC:COM",
    "Date": "10/10/2023",
    "Open": 1955.0,
    "High": 1980.0,
    "Low": 1930.0,
    "Close": 1955.0
  },
  {
    "Symbol": "GAC:COM",
    "Date": "09/10/2023",
    "Open": 1955.0,
    "High": 1980.0,
    "Low": 1930.0,
    "Close": 1955.0
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/historical/{symbols}?c={your_api_key}&f=csv
```
```bash
Symbol,Date,Open,High,Low,Close
AAPL:US,10/10/2023,178.1000,179.7200,177.9500,178.3900
GAC:COM,10/10/2023,1955.0000,1980.0000,1930.0000,1955.0000
GAC:COM,09/10/2023,1955.0000,1980.0000,1930.0000,1955.0000
```

**HTML**
```text
https://api.tradingeconomics.com/markets/historical/{symbols}?c={your_api_key}
```

| Symbol | Date | Open | High | Low | Close |
|-------|-------|-------|-------|-------|-------|
| AAPL:US | 12/07/2023 | 189.6800 | 191.7000 | 188.4700 | 189.7600 |
| GAC:COM | 11/07/2023 | 1675.0000 | 1675.0000 | 1675.0000 | 1675.0000 |
| AAPL:US | 11/07/2023 | 189.1600 | 189.3000 | 186.6000 | 188.0800 |

## By multiple symbols and date

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c={your_api_key}&d1=2017-08-01&d2=2017-08-08'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.fetchMarkets(symbol= ['aapl:us','gac:com'], initDate='2017-08-01')
```

*With end date:*
```python
te.fetchMarkets(symbol= ['aapl:us','gac:com'], initDate='2017-08-01',
 endDate='2017-08-08')
```

**JS**
*Using Requests:*
```js
const axios = require('axios');
(async () => {
    const your_api_key = 'your_api_key'
    const response = await axios.get(`https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=${your_api_key}&d1=2017-08-01&d2=2017-08-08`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getHistoricalMarkets(symbol= ['aapl:us','gac:com'], start_date = '2017-08-01').then(function(data){
  console.log(data)     
});
```

*With end date:*
```javascript
data = te.getHistoricalMarkets(symbol= ['aapl:us','gac:com'], start_date = '2017-08-01',
 end_date = '2017-08-08').then(function(data){
  console.log(data)     
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=your_api_key&d1=2017-08-01");
```

*With end date:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/historical/aapl:us,gac:com?c=your_api_key&d1=2017-08-01&d2=2017-08-08");
```

**JSON**
```text
https://api.tradingeconomics.com/markets/historical/{symbols}?c={your_api_key}&d1=yyyy-mm-dd&d2=yyyy-mm-dd&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Date": "10/10/2023",
    "Open": 178.1,
    "High": 179.72,
    "Low": 177.95,
    "Close": 178.39
  },
  {
    "Symbol": "GAC:COM",
    "Date": "10/10/2023",
    "Open": 1955.0,
    "High": 1980.0,
    "Low": 1930.0,
    "Close": 1955.0
  },
  {
    "Symbol": "GAC:COM",
    "Date": "09/10/2023",
    "Open": 1955.0,
    "High": 1980.0,
    "Low": 1930.0,
    "Close": 1955.0
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/historical/{symbols}?c={your_api_key}&d1=yyyy-mm-dd&d2=yyyy-mm-dd&f=csv
```
```bash
Symbol,Date,Open,High,Low,Close
AAPL:US,10/10/2023,178.1000,179.7200,177.9500,178.3900
GAC:COM,10/10/2023,1955.0000,1980.0000,1930.0000,1955.0000
GAC:COM,09/10/2023,1955.0000,1980.0000,1930.0000,1955.0000
```

**HTML**
```text
https://api.tradingeconomics.com/markets/historical/{symbols}?c={your_api_key}&d1=yyyy-mm-dd&d2=yyyy-mm-dd
```

| Symbol | Date | Open | High | Low | Close |
|-------|-------|-------|-------|-------|-------|
| AAPL:US	| 12/07/2023 | 189.6800 | 191.7000 | 188.4700 | 189.8200 |
| GAC:COM	| 11/07/2023 | 1675.0000 | 1675.0000 | 1675.0000 | 1675.0000 |
| AAPL:US	| 11/07/2023 | 189.1600 | 189.3000 | 186.6000 | 188.0800 |

## Response fields

| Field  | Type   | Description                             | Example      |
| -------| -------|-----------------------------------------|--------------|
| Symbol | string | Unique symbol used by Trading Economics   | "AAPL:US"   |
| Date   | string | Date of the trading session in UTC   | "13/04/2023" |
| Open   | number | Opening price of the trading session               | 161.6300    |
| High   | number | Highest price reached during the trading session  | 165.6186    |
| Low    | number | Lowest price reached during the trading session   | 161.4200    |
| Close  | number | Closing price of the trading session              | 165.5099    |

