# Forecasts for Markets

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

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

Trading Economics forecasts are built using a proprietary global macro model that takes into account our analysts’ expectations, correlations between countries, and a set of logical relationships between different indicators.

## By category

category = (index, currency, crypto, commodity, bond)

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/forecasts/index?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.getMarketsForecasts(category='index')
```

**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/forecasts/index?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getMarketsForecast(category = 'index').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/forecasts/index?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.

**JSON**
```text
https://api.tradingeconomics.com/markets/forecasts/index?c={your_api_key}&f=json
```
```json
[
  {
    "Symbol": "AEX:IND",
    "Country": "Netherlands",
    "Date": "2023-10-11T13:52:06.22",
    "Type": "index",
    "Last": 740.23,
    "Unit": "Index Points",
    "URL": "/netherlands/stock-market",
    "Importance": 190,
    "Forecast1": 709.9859,
    "ForecastDate1": "2023-12-31",
    "Forecast2": 693.63515,
    "ForecastDate2": "2024-03-31",
    "Forecast3": 677.72042,
    "ForecastDate3": "2024-06-30",
    "Forecast4": 662.09637,
    "ForecastDate4": "2024-09-30"
  },
  {
    "Symbol": "ADSMI:IND",
    "Country": "United Arab Emirates",
    "Date": "2023-10-11T00:00:00",
    "Type": "index",
    "Last": 9647.76,
    "Unit": "Index Points",
    "URL": "/united-arab-emirates/stock-market",
    "Importance": 330,
    "Forecast1": 9598.3758,
    "ForecastDate1": "2023-12-31",
    "Forecast2": 9443.2485,
    "ForecastDate2": "2024-03-31",
    "Forecast3": 9290.0726,
    "ForecastDate3": "2024-06-30",
    "Forecast4": 9139.8236,
    "ForecastDate4": "2024-09-30"
  },
  {
    "Symbol": "ALSIUG:IND",
    "Country": "Uganda",
    "Date": "2023-10-11T00:00:00",
    "Type": "index",
    "Last": 923.89,
    "Unit": "Index Points",
    "URL": "/uganda/stock-market",
    "Importance": 999,
    "Forecast1": 879.8882,
    "ForecastDate1": "2023-12-31",
    "Forecast2": 833.637,
    "ForecastDate2": "2024-03-31",
    "Forecast3": 789.8004,
    "ForecastDate3": "2024-06-30",
    "Forecast4": 748.1929,
    "ForecastDate4": "2024-09-30"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/forecasts/index?c={your_api_key}&f=csv
```
```bash
Symbol,Country,Date,Type,Last,Unit,URL,Importance,Forecast1,ForecastDate1,Forecast2,ForecastDate2,Forecast3,ForecastDate3,Forecast4,ForecastDate4
AEX:IND,Netherlands,10/11/2023 1:53:07 PM,index,740.2400,Index Points,/netherlands/stock-market,190,709.9859,2023-12-31,693.63515,2024-03-31,677.72042,2024-06-30,662.09637,2024-09-30
ADSMI:IND,United Arab Emirates,10/11/2023 12:00:00 AM,index,9647.7600,Index Points,/united-arab-emirates/stock-market,330,9598.3758,2023-12-31,9443.2485,2024-03-31,9290.0726,2024-06-30,9139.8236,2024-09-30
ALSIUG:IND,Uganda,10/11/2023 12:00:00 AM,index,923.8900,Index Points,/uganda/stock-market,999,879.8882,2023-12-31,833.6370,2024-03-31,789.8004,2024-06-30,748.1929,2024-09-30
```

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

| Symbol | Country | Date | Type | Last | Unit | URL | Importance | Forecast1 | ForecastDate1 | Forecast2 | ForecastDate2 | Forecast3 | ForecastDate3 | Forecast4 | ForecastDate4 |
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| AEX:IND | Netherlands | 7/13/2023 5:33:10 PM | index | 775.7600 | Index Points | /netherlands/stock-market | 190 | 733.9284 | 2023-09-30 | 714.8644 | 2023-12-31 | 696.2524 | 2024-03-31 | 678.1680 | 2024-06-30 |
| ADSMI:IND | United Arab Emirates | 7/13/2023 12:00:00 AM  | index | 9627.0400 | Index Points | /united-arab-emirates/stock-market | 330 | 9423.5919| 2023-09-30 | 9246.8756 | 2023-12-31 | 9073.0405 | 2024-03-31 | 8902.0866 | 2024-06-30 |
| ALSIUG:IND | Uganda | 7/13/2023 12:00:00 AM | index | 1031.6800 | Index Points | /uganda/stock-market | 999 | 966.8174 | 2023-09-30 | 914.2697| 2023-12-31 | 864.6867 | 2024-03-31 | 817.7617| 2024-06-30 |

## By symbol

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/markets/forecasts/symbol/AAPL:US,DAX:IND,INDU:IND?c={your_api_key}'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getMarketsForecasts(symbol='aapl:us')
```

*With multi symbols:*
```python
te.getMarketsForecasts(symbol=['AAPL:US','DAX:IND',
 'INDU:IND'])
```

**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/forecasts/symbol/AAPL:US,DAX:IND,INDU:IND?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getMarketsForecast(symbol = 'aapl:us').then(function(data){
    console.log(data)     
});

```

*With multi symbols:*
```javascript
data = te.getMarketsForecast(symbol = ['AAPL:US','DAX:IND',
 'INDU:IND']).then(function(data){
    console.log(data)     
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/forecasts/symbol/aapl:us?c=your_api_key");
```

*With multi symbols:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/markets/forecasts/symbol/BULGARIAGOVB10Y:GOV,LITHUANIAGOVBON10Y:GOV,GBGB10YR:GOV?c=your_api_key");
```

**JSON**
```text
https://api.tradingeconomics.com/markets/forecasts/symbol/{symbols}?c={your_api_key}&f=json
```
```json
[
  {
    "Symbol": "AAPL:US",
    "Country": "United States",
    "Date": "2023-10-11T13:53:08.263",
    "Type": "stocks",
    "Last": 178.8601,
    "Unit": "USD",
    "URL": "/aapl:us",
    "Importance": 500,
    "Forecast1": 172.69777,
    "ForecastDate1": "2023-12-31",
    "Forecast2": 168.0349,
    "ForecastDate2": "2024-03-31",
    "Forecast3": 163.4979,
    "ForecastDate3": "2024-06-30",
    "Forecast4": 159.0835,
    "ForecastDate4": "2024-09-30"
  },
  {
    "Symbol": "DAX:IND",
    "Country": "Germany",
    "Date": "2023-10-11T13:54:29.037",
    "Type": "index",
    "Last": 15467.3,
    "Unit": "Index Points",
    "URL": "/germany/stock-market",
    "Importance": 70,
    "Forecast1": 14871.8704,
    "ForecastDate1": "2023-12-31",
    "Forecast2": 14523.1086,
    "ForecastDate2": "2024-03-31",
    "Forecast3": 14180.4388,
    "ForecastDate3": "2024-06-30",
    "Forecast4": 13848.4298,
    "ForecastDate4": "2024-09-30"
  },
  {
    "Symbol": "INDU:IND",
    "Country": "United States",
    "Date": "2023-10-11T13:54:44.333",
    "Type": "index",
    "Last": 33800.25,
    "Unit": "Index Points",
    "URL": "/indu:ind",
    "Importance": 2,
    "Forecast1": 32505.57534,
    "ForecastDate1": "2023-12-31",
    "Forecast2": 31627.9248,
    "ForecastDate2": "2024-03-31",
    "Forecast3": 30773.9708,
    "ForecastDate3": "2024-06-30",
    "Forecast4": 29943.0736,
    "ForecastDate4": "2024-09-30"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/markets/forecasts/symbol/{symbols}?c={your_api_key}&f=csv
```
```bash
Symbol,Country,Date,Type,Last,Unit,URL,Importance,Forecast1,ForecastDate1,Forecast2,ForecastDate2,Forecast3,ForecastDate3,Forecast4,ForecastDate4
AAPL:US,United States,10/11/2023 1:55:08 PM,stocks,177.8500,Index Points,/aapl:us,500,172.69777,2023-12-31,168.0349,2024-03-31,163.4979,2024-06-30,159.0835,2024-09-30
DAX:IND,Germany,10/11/2023 1:54:29 PM,index,15467.3000,Index Points,/germany/stock-market,70,14871.8704,2023-12-31,14523.1086,2024-03-31,14180.4388,2024-06-30,13848.4298,2024-09-30
INDU:IND,United States,10/11/2023 1:54:44 PM,index,33800.2500,Index Points,/indu:ind,2,32505.57534,2023-12-31,31627.9248,2024-03-31,30773.9708,2024-06-30,29943.0736,2024-09-30
```

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

| Symbol | Country | Date | Type | Last | Unit | URL | Importance | Forecast1 | ForecastDate1 | Forecast2 | ForecastDate2 | Forecast3 | ForecastDate3 | Forecast4 | ForecastDate4 |
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| AAPL:US | United States | 7/13/2023 6:25:17 PM | stocks | 190.7700 | USD | /aapl:us | 500 | 185.4935 | 2023-09-30 | 180.4480 | 2023-12-31 | 175.5398 | 2024-03-31 | 170.7652 | 2024-06-30 |
| DAX:IND | Germany | 7/13/2023 6:25:37 PM | index | 16150.7000 | Index Points | /germany/stock-market | 70 | 15164.94446 | 2023-09-30 | 14738.97164 | 2023-12-31 | 14323.9212 | 2024-03-31 | 13921.35348 | 2024-06-30 |
| INDU:IND | United States | 7/13/2023 6:25:09 PM | index | 34422.1100 | Index Points | /united-states/stock-market | 1 | 32817.2912 | 2023-09-30 | 31923.3169 | 2023-12-31 | 31056.3305 | 2024-03-31 | 30212.9585 | 2024-06-30 |

## Response fields

| Field           | Type   | Description                                                   |Example                      |
| ----------------| -------|---------------------------------------------------------------|-----------------------------|
| Symbol          | string | Unique symbol used by Trading Economics .                 | "AEX:IND"                   |
| Country	      | string | Name of the country associated with the indicator.        | "Netherlands"               |
| Date	          | string | Date of the reported value, in UTC format.                | "2023-04-17T12:02:51.543"   |
| Type            | string | Name of the market category                               | "index"                     |
| Last            | number | Latest released forecast                                  | 760.3300            |
| Unit            | string | Unit of measurement for the value. | "Index Points"              |
| URL             | string | Hyperlink to the indicator page on Trading Economics.     | "/netherlands/stock-market" |
| Importance      | number | Indicator importance from 0 (lowest) to 1000 (highest).   | 190                         |
| Forecast1       | number | Forecast for the next quarter.                            | 737.4159            |
| ForecastDate1   | number | Release date associated with Forecast1.                   | 2023-06-30                  |
| Forecast2       | number | Forecast for the next quarter following Forecast1         | 714.1932            |
| ForecastDate2   | number | Release date associated with Forecast2.                   | 2023-09-30                  |
| Forecast3       | number | Forecast for the next quarter following Forecast2         | 691.65576            |
| ForecastDate3   | number | Release date associated with Forecast3.                   | 2023-12-31                  |
| Forecast4       | number | Forecast for the next quarter following Forecast3         | 669.87972            |
| ForecastDate4   | number | Release date associated with Forecast4.                   | 2024-03-31                  |

