# Markets Intraday Data

> Use the following API endpoints to obtain market intraday data.

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

The Intraday endpoint provides granular price data within a single trading day, including open, high, low, close, and volume at sub-daily intervals. Use it to track short-term price movements and analyze real-time market activity.

## By symbol

Max of 5 symbols

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/intraday/aapl:us,stx: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.getMarketsIntraday(symbols='aapl:us')
```

*With multi symbols:*
```python
te.getMarketsIntraday(symbols=['aapl:us','stx: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/intraday/aapl:us,stx:us?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getMarketsIntraday(symbol = 'aapl:us').then(function(data){
  console.log(data)     
});
```

*With multi symbols:*
```javascript
data = te.getMarketsIntraday(symbol = ['aapl:us','stx:us']).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/intraday/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/intraday/aapl:us,stx:us?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/intraday/{symbols}?c={your_api_key}&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:58:00",
    "Open": 178.28,
    "High": 178.37,
    "Low": 178.26,
    "Close": 178.36
  },
  {
    "Symbol": "STX:US",
    "Date": "2023-10-10T19:58:00",
    "Open": 66.545,
    "High": 66.57,
    "Low": 66.54,
    "Close": 66.57
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:57:00",
    "Open": 178.28,
    "High": 178.31,
    "Low": 178.24,
    "Close": 178.29
  },
  {
    "Symbol": "STX:US",
    "Date": "2023-10-10T19:57:00",
    "Open": 66.56,
    "High": 66.56,
    "Low": 66.545,
    "Close": 66.545
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:56:00",
    "Open": 178.29,
    "High": 178.33,
    "Low": 178.26,
    "Close": 178.29
  },
  {
    "Symbol": "STX:US",
    "Date": "2023-10-10T19:56:00",
    "Open": 66.595,
    "High": 66.6,
    "Low": 66.55,
    "Close": 66.565
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:55:00",
    "Open": 178.31,
    "High": 178.45,
    "Low": 178.3,
    "Close": 178.3
  },
  {
    "Symbol": "STX:US",
    "Date": "2023-10-10T19:55:00",
    "Open": 66.64,
    "High": 66.64,
    "Low": 66.61,
    "Close": 66.61
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:54:00",
    "Open": 178.25,
    "High": 178.4,
    "Low": 178.15,
    "Close": 178.22
  },
  {
    "Symbol": "STX:US",
    "Date": "2023-10-10T19:54:00",
    "Open": 66.59,
    "High": 66.59,
    "Low": 66.57,
    "Close": 66.58
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/intraday/{symbols}?c={your_api_key}&f=csv
```
```bash
Symbol,Date,Open,High,Low,Close
AAPL:US,10/10/2023 7:58:00 PM,178.2800,178.3700,178.2600,178.3600
STX:US,10/10/2023 7:58:00 PM,66.54500,66.5700,66.5400,66.5700
AAPL:US,10/10/2023 7:57:00 PM,178.2800,178.3100,178.2400,178.2900
```

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

| Symbol | Date | Open | High | Low | Close |
|-------|-------|-------|-------|-------|-------|
| AAPL:US | 7/12/2023 5:47:00 PM | 189.8200 | 189.8200 | 189.7900 | 189.7900 |
| STX:US | 7/12/2023 5:47:00 PM | 60.8900 | 60.8900 | 60.8650 | 60.8700 |
| AAPL:US | 7/12/2023 5:46:00 PM | 189.9500 | 189.9700 | 189.8200 | 189.8300 |

## By symbol and date

Returns intraday historical data for the specified symbol and date range, up to a maximum of 30 days. Aggregated intervals are calculated from 1-minute data, and requests are subject to a maximum processing limit of 10,000 underlying 1-minute records per request.

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/intraday/aapl:us?agr=10m&d1=2020-01-01%200:00&d2=2020-12-01%2015:30&c={your_api_key}'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getMarketsIntraday(symbols='aapl:us', initDate='2017-08-10 15:30')
```

*With end date:*
```python
te.getMarketsIntraday(symbols='aapl:us', initDate='2017-08-01',
 endDate='2017-08-08')
```

*With interval (1m, 5m, 10m, 15m, 30m, 1h, 2h, 4h)*
```python
te.getMarketsIntradayByInterval(symbol='aapl:us', initDate='2020-01-01',
 endDate='2020-12-01', interval='10m')
```

**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/intraday/aapl:us?agr=10m&d1=2020-01-01%200:00&d2=2020-12-01%2015:30&c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getMarketsIntraday(symbol = 'aapl:us', start_date = '2017-08-10 15:30').then(function(data){
  console.log(data)     
});
```

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

*With interval (1m, 5m, 10m, 15m, 30m, 1h, 2h, 4h)*
```javascript
data = te.getMarketsIntraday(symbol = 'aapl:us', start_date = '2020-01-01',
 end_date = '2020-12-01', agr = '10m').then(function(data){
  console.log(data)     
});
```

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

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

*With interval (1m, 5m, 10m, 15m, 30m, 1h, 2h, 4h)*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/intraday/aapl:us?agr=10m&d1=2020-01-01%200:00&d2=2020-12-01%2015:30&client=your_api_key");
```

**JSON**
```text
https://api.tradingeconomics.com/markets/intraday/{symbol}?c={your_api_key}&agr={interval}&d1=yyyy-mm-dd&d2=yyyy-mm-dd&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:58:00",
    "Open": 178.28,
    "High": 178.37,
    "Low": 178.26,
    "Close": 178.36
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:57:00",
    "Open": 178.28,
    "High": 178.31,
    "Low": 178.24,
    "Close": 178.29
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:56:00",
    "Open": 178.29,
    "High": 178.33,
    "Low": 178.26,
    "Close": 178.29
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:55:00",
    "Open": 178.31,
    "High": 178.45,
    "Low": 178.3,
    "Close": 178.3
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:54:00",
    "Open": 178.25,
    "High": 178.4,
    "Low": 178.15,
    "Close": 178.22
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:53:00",
    "Open": 178.34,
    "High": 178.35,
    "Low": 178.22,
    "Close": 178.23
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:52:00",
    "Open": 178.45,
    "High": 178.51,
    "Low": 178.31,
    "Close": 178.33
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:51:00",
    "Open": 178.48,
    "High": 178.55,
    "Low": 178.45,
    "Close": 178.46
  },
  {
    "Symbol": "AAPL:US",
    "Date": "2023-10-10T19:50:00",
    "Open": 178.61,
    "High": 178.61,
    "Low": 178.47,
    "Close": 178.47
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/intraday/{symbol}?c={your_api_key}&agr={interval}&d1=yyyy-mm-dd&d2=yyyy-mm-dd&f=csv
```
```bash
Symbol,Date,Open,High,Low,Close
AAPL:US,10/10/2023 7:58:00 PM,178.2800,178.3700,178.2600,178.3600
AAPL:US,10/10/2023 7:57:00 PM,178.2800,178.3100,178.2400,178.2900
AAPL:US,10/10/2023 7:56:00 PM,178.2900,178.3300,178.2600,178.2900
```

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

| Symbol | Date | Open | High | Low | Close |
|-------|-------|-------|-------|-------|-------|
| AAPL:US | 7/12/2023 5:50:00 PM | 189.8600 | 189.8600 | 189.8600 | 189.8600 |
| AAPL:US | 7/12/2023 5:49:00 PM | 189.800 | 189.8900 | 189.800 | 189.8700 |
| AAPL:US | 7/12/2023 5:48:00 PM | 189.7800 | 189.8200 | 189.7600 | 189.8100 |

## 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    |

