# Indicators Peers and Components

> Use the following API endpoints to obtain peers for related indicators and countries.

Source: https://docs.tradingeconomics.com/indicators/peers/

Peers describe the relationships between different economic indicator series. A peer can be a component of an aggregate indicator (e.g., Core Inflation Rate is a component of CPI), a related series in the same domain, or a parent/derivative measure. Use these endpoints to discover how indicators connect to each other for a given country and category, or by ticker.

## By country and category

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/peers/CPI%20YOY?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.getPeers(ticker='CPI YOY')
```

**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/peers/CPI%20YOY?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
const te = require('tradingeconomics');
te.login('your_api_key');
data = te.getPeers(ticker = 'CPI YOY').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/peers/CPI%20YOY?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/peers/(ticker)?c={your_api_key}&f=json
```
```json
[
  {
    "Ticker": "CPI YOY",
    "Peer": "UNITEDSTACONPRIINDCP",
    "Relationship": 0,
    "Country": "United States",
    "Category": "Consumer Price Index CPI",
    "Title": "United States Consumer Price Index (CPI)",
    "LatestValueDate": "2023-08-31T00:00:00",
    "LatestValue": 307.03,
    "Source": "U.S. Bureau of Labor Statistics",
    "SourceURL": "http://www.bls.gov",
    "Unit": "points",
    "URL": "/united-states/consumer-price-index-cpi",
    "CategoryGroup": "Prices",
    "Adjustment": "1982-1984=100, NSA",
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "UNITEDSTACONPRIINDCP",
    "CreateDate": "2014-06-11T09:44:00",
    "FirstValueDate": "1950-01-31T00:00:00",
    "PreviousValue": 305.69,
    "PreviousValueDate": "2023-07-31T00:00:00"
  },
  {
    "Ticker": "CPI YOY",
    "Peer": "UNITEDSTACORCONPRI",
    "Relationship": 0,
    "Country": "United States",
    "Category": "Core Consumer Prices",
    "Title": "United States Core Consumer Prices",
    "LatestValueDate": "2023-08-31T00:00:00",
    "LatestValue": 309.66,
    "Source": "U.S. Bureau of Labor Statistics",
    "SourceURL": "http://www.bls.gov",
    "Unit": "points",
    "URL": "/united-states/core-consumer-prices",
    "CategoryGroup": "Prices",
    "Adjustment": "1982-1984=100, SA",
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "UNITEDSTACORCONPRI",
    "CreateDate": "2013-06-18T16:46:00",
    "FirstValueDate": "1957-01-31T00:00:00",
    "PreviousValue": 308.80,
    "PreviousValueDate": "2023-07-31T00:00:00"
  },
  {
    "Ticker": "CPI YOY",
    "Peer": "USACORECPIRATE",
    "Relationship": 1,
    "Country": "United States",
    "Category": "Core Inflation Rate",
    "Title": "United States Core Inflation Rate",
    "LatestValueDate": "2023-08-31T00:00:00",
    "LatestValue": 4.30,
    "Source": "U.S. Bureau of Labor Statistics",
    "SourceURL": "https://www.bls.gov",
    "Unit": "percent",
    "URL": "/united-states/core-inflation-rate",
    "CategoryGroup": "Prices",
    "Adjustment": "1982-1984=100, NSA",
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "USACORECPIRATE",
    "CreateDate": "2012-10-02T14:16:00",
    "FirstValueDate": "1957-02-28T00:00:00",
    "PreviousValue": 4.70,
    "PreviousValueDate": "2023-07-31T00:00:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/peers/(ticker)?c={your_api_key}&f=csv
```
```bash
Ticker,Peer,Relationship,Country,Category,Title,LatestValueDate,LatestValue,Source,SourceURL,Unit,URL,CategoryGroup,Adjustment,Frequency,HistoricalDataSymbol,CreateDate,FirstValueDate,PreviousValue,PreviousValueDate
CPI YOY,UNITEDSTACONPRIINDCP,0,United States,Consumer Price Index CPI,United States Consumer Price Index (CPI),8/31/2023 12:00:00 AM,307.03,U.S. Bureau of Labor Statistics,http://www.bls.gov,points,/united-states/consumer-price-index-cpi,Prices,"1982-1984=100, NSA",Monthly,UNITEDSTACONPRIINDCP,6/11/2014 9:44:00 AM,1/31/1950 12:00:00 AM,305.69,7/31/2023 12:00:00 AM
CPI YOY,UNITEDSTACORCONPRI,0,United States,Core Consumer Prices,United States Core Consumer Prices,8/31/2023 12:00:00 AM,309.66,U.S. Bureau of Labor Statistics,http://www.bls.gov,points,/united-states/core-consumer-prices,Prices,"1982-1984=100, SA",Monthly,UNITEDSTACORCONPRI,6/18/2013 4:46:00 PM,1/31/1957 12:00:00 AM,308.80,7/31/2023 12:00:00 AM
CPI YOY,USACORECPIRATE,1,United States,Core Inflation Rate,United States Core Inflation Rate,8/31/2023 12:00:00 AM,4.30,U.S. Bureau of Labor Statistics,https://www.bls.gov,percent,/united-states/core-inflation-rate,Prices,"1982-1984=100, NSA",Monthly,USACORECPIRATE,10/2/2012 2:16:00 PM,2/28/1957 12:00:00 AM,4.70,7/31/2023 12:00:00 AM
```

**HTML**
```text
https://api.tradingeconomics.com/peers/(ticker)?c={your_api_key}
```

| Ticker | Peer	| Relationship | Country | Category |	Title |	LatestValueDate |	LatestValue |	Source | SourceURL | Unit	| URL	| CategoryGroup	| Adjustment | Frequency | HistoricalDataSymbol	| CreateDate | FirstValueDate	| PreviousValue	| PreviousValueDate
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| CPI YOY | TEDSTACONPRIINDCP |	0 |	United States |	Consumer Price Index CPI | United States Consumer Price Index (CPI)	| 5/31/2023 12:00:00 AM |	304.13 | U.S. Bureau of Labor Statistics |	http://www.bls.gov | points |	/united-states/consumer-price-index-cpi |	Prices | "1982-1984=100, NSA" |	Monthly	| UNITEDSTACONPRIINDCP | 6/11/2014 9:44:00 AM	| 1/31/1950 12:00:00 AM |	303.36 | 4/30/2023 12:00:00 AM |
| CPI YOY	| UNITEDSTACORCONPRI | 0| United States |	Core Consumer Prices | United States Core Consumer Prices	| 5/31/2023 12:00:00 AM	| 307.82 | U.S. Bureau of Labor Statistics |	http://www.bls.gov | points	| /united-states/core-consumer-prices |	Prices | "1982-1984=100, SA" | Monthly | UNITEDSTACORCONPRI |	6/18/2013 4:46:00 PM | 1/31/1957 12:00:00 AM | 306.49 |	4/30/2023 12:00:00 AM |
| CPI YOY	| USACORECPIRATE | 1 | United States | Core Inflation Rate | United States Core Inflation Rate | 5/31/2023 12:00:00 AM | 5.30	| U.S. Bureau of Labor Statistics	| https://www.bls.gov	| percent	| /united-states/core-inflation-rate |Prices | "1982-1984=100, NSA" | Monthly | USACORECPIRATE | 10/2/2012 2:16:00 PM | 2/28/1957 12:00:00 AM | 5.50 | 4/30/2023 12:00:00 AM |

**JSON**
```text
https://api.tradingeconomics.com/peers/country/(country)/(category)?c={your_api_key}&f=json
```
```json
[
  {
    "Ticker": "MEXFRINRDPST",
    "Peer": "MEXFRINRDPST",
    "Relationship": -1,
    "Country": "Mexico",
    "Category": "Deposit Interest Rate",
    "Title": "Deposit Interest Rate in Mexico",
    "LatestValueDate": "2023-07-31T00:00:00",
    "LatestValue": 4.95,
    "Source": "IMF",
    "SourceURL": "https://www.imf.org",
    "Unit": "percent",
    "URL": "/mexico/deposit-interest-rate",
    "CategoryGroup": "inflation rate",
    "Adjustment": "",
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "MEXFRINRDPST",
    "CreateDate": "2015-12-03T14:37:00",
    "FirstValueDate": "1976-01-31T00:00:00",
    "PreviousValue": 4.63,
    "PreviousValueDate": "2023-06-30T00:00:00"
  },
  {
    "Ticker": "MEXICOBANBALSHE",
    "Peer": "MEXICOBANBALSHE",
    "Relationship": -1,
    "Country": "Mexico",
    "Category": "Banks Balance Sheet",
    "Title": "Mexico Banks Balance Sheet",
    "LatestValueDate": "2023-08-31T00:00:00",
    "LatestValue": 10702998.84,
    "Source": "Banco de México",
    "SourceURL": "http://www.banxico.org.mx",
    "Unit": "MXN Million",
    "URL": "/mexico/banks-balance-sheet",
    "CategoryGroup": "inflation rate",
    "Adjustment": "NSA",
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "MEXICOBANBALSHE",
    "CreateDate": "2014-09-08T15:29:00",
    "FirstValueDate": "2000-12-31T00:00:00",
    "PreviousValue": 10608854.67,
    "PreviousValueDate": "2023-07-31T00:00:00"
  },
  {
    "Ticker": "MEXICOBANBALSHE",
    "Peer": "MEXICOCENBANBALSHE",
    "Relationship": 0,
    "Country": "Mexico",
    "Category": "Central Bank Balance Sheet",
    "Title": "Mexico Central Bank Balance Sheet",
    "LatestValueDate": "2023-09-30T00:00:00",
    "LatestValue": 4204904816.00,
    "Source": "Banco de México",
    "SourceURL": "https://www.banxico.org.mx/",
    "Unit": "MXN Thousand",
    "URL": "/mexico/central-bank-balance-sheet",
    "CategoryGroup": "inflation rate",
    "Adjustment": "NSA",
    "Frequency": "Monthly",
    "HistoricalDataSymbol": "MEXICOCENBANBALSHE",
    "CreateDate": "2014-08-14T17:50:00",
    "FirstValueDate": "1985-12-31T00:00:00",
    "PreviousValue": 4001809952.00,
    "PreviousValueDate": "2023-08-31T00:00:00"
  }
]
```

**CSV**
```text
https://api.tradingeconomics.com/peers/country/(country)/(category)?c={your_api_key}&f=csv
```
```bash
Ticker,Peer,Relationship,Country,Category,Title,LatestValueDate,LatestValue,Source,SourceURL,Unit,URL,CategoryGroup,Adjustment,Frequency,HistoricalDataSymbol,CreateDate,FirstValueDate,PreviousValue,PreviousValueDate
MEXFRINRDPST,MEXFRINRDPST,-1,Mexico,Deposit Interest Rate,Deposit Interest Rate in Mexico,7/31/2023 12:00:00 AM,4.95,IMF,https://www.imf.org,percent,/mexico/deposit-interest-rate,inflation rate,,Monthly,MEXFRINRDPST,12/3/2015 2:37:00 PM,1/31/1976 12:00:00 AM,4.63,6/30/2023 12:00:00 AM
MEXICOBANBALSHE,MEXICOBANBALSHE,-1,Mexico,Banks Balance Sheet,Mexico Banks Balance Sheet,8/31/2023 12:00:00 AM,10702998.84,Banco de México,http://www.banxico.org.mx,MXN Million,/mexico/banks-balance-sheet,inflation rate,NSA,Monthly,MEXICOBANBALSHE,9/8/2014 3:29:00 PM,12/31/2000 12:00:00 AM,10608854.67,7/31/2023 12:00:00 AM
MEXICOBANBALSHE,MEXICOCENBANBALSHE,0,Mexico,Central Bank Balance Sheet,Mexico Central Bank Balance Sheet,9/30/2023 12:00:00 AM,4204904816.00,Banco de México,https://www.banxico.org.mx/,MXN Thousand,/mexico/central-bank-balance-sheet,inflation rate,NSA,Monthly,MEXICOCENBANBALSHE,8/14/2014 5:50:00 PM,12/31/1985 12:00:00 AM,4001809952.00,8/31/2023 12:00:00 AM
```

**HTML**
```text
https://api.tradingeconomics.com/peers/country/(country)/(category)?c={your_api_key}
```

| Ticker | Peer	| Relationship | Country | Category |	Title |	LatestValueDate |	LatestValue |	Source | SourceURL | Unit	| URL	| CategoryGroup	| Adjustment | Frequency | HistoricalDataSymbol	| CreateDate | FirstValueDate	| PreviousValue	| PreviousValueDate
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| MEXFRINRDPST | MEXFRINRDPST |	-1 | Mexico |	Deposit Interest Rate | Deposit Interest Rate in Mexico	| 3/31/2023 12:00:00 AM |	4.57 | IMF |	http://www.imf.org | percent | /mexico/deposit-interest-rate | inflation rate | | Monthly	| MEXFRINRDPST | 12/3/2015 2:37:00 PM	| 1/31/1976 12:00:00 AM |	4.43 | 2/28/2023 12:00:00 AM |
| MEXICOBANBALSHE | MEXICOBANBALSHE | -1 | Mexico |	Banks Balance Sheet | Mexico Banks Balance Sheet | 4/30/2023 12:00:00 AM | 10335903.02 | Banco de México |	http://www.banxico.org.mx | MXN Million | /mexico/banks-balance-sheet | inflation rate | NSA | Monthly	| MEXICOBANBALSHE | 9/8/2014 3:29:00 PM | 12/31/2000 12:00:00 AM | 10169075.64 | 3/31/2023 12:00:00 AM |
| MEXICOBANBALSHE | MEXICOCENBANBALSHE | 0 | Mexico |	Central Bank Balance Sheet | Mexico Central Bank Balance Sheet | 5/31/2023 12:00:00 AM | 4537124968.00 | Banco de México |	http://www.banxico.org.mx/ | MXN Thousand | /mexico/central-bank-balance-sheet | inflation rate | NSA | Monthly | MEXICOCENBANBALSHE | 8/14/2014 5:50:00 PM | 12/31/1985 12:00:00 AM |	4515771451.00 | 4/30/2023 12:00:00 AM |

<!-- 
## Series by country

**PYTHON**
*Using Requests:*
```python
import requests
your_api_key = 'your_api_key'
url = f'https://api.tradingeconomics.com/peers/country/mexico?c={your_api_key}'
data = requests.get(url).json()
print(data)
```
*Or using our package:*
```python
te.getPeers(country='mexico')
```

**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/peers/country/mexico?c=${your_api_key}`)
    console.log(response.data)
})()
```
*Or using our package:*
```javascript
data = te.getPeers(country = 'mexico').then(function(data){
  console.log(data)       
});
```

**C#**
*Using Requests:*
```c#
new HttpRequestMessage(new HttpMethod("GET"), "https://api.tradingeconomics.com/peers/country/mexico?c=your_api_key");
```

**JSON**
```text
https://api.tradingeconomics.com/peers/country/(country)?c={your_api_key}&f=json
```
```bash

```

**CSV**
```text
https://api.tradingeconomics.com/peers/country/(country)?c={your_api_key}&f=csv
```
```bash

```

**HTML**
```text
https://api.tradingeconomics.com/peers/country/(country)?c={your_api_key}
```

| Ticker | Peer	| Relationship | Country | Category |	Title |	LatestValueDate |	LatestValue |	Source | SourceURL | Unit	| URL	| CategoryGroup	| Adjustment | Frequency | HistoricalDataSymbol	| CreateDate | FirstValueDate	| PreviousValue	| PreviousValueDate
|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| 2738A38 | 2738A38 |	-1 | Mexico |	Government Budget | Mexico Government Budget | 12/31/2022 12:00:00 AM | -3.40 | Secretaria de Hacienda y Credito Publico | http://www.hacienda.gob.mx | percent of GDP | /mexico/government-budget | Government | | Yearly | 2738A38 | 4/28/2014 3:47:00 PM	| 12/31/1990 12:00:00 AM | -3.80 | 12/31/2021 12:00:00 AM |
| 2738A38 | MEXDEBT2GDP |	0 | Mexico | Government Debt to GDP | Mexico Government Debt to GDP | 12/31/2021 12:00:00 AM | 49.60 | Secretaria de Hacienda y Credito Publico | http://www.gob.mx | percent of GDP | /mexico/government-debt-to-gdp | Government | | Yearly | MEXDebt2GDP | 4/28/2014 3:47:00 PM | 12/31/1990 12:00:00 AM | 51.30 | 12/31/2020 12:00:00 AM |
| GMXN10YR | GMXN10YR |	-1 | Mexico |	Government Bond 10Y | Mexico Government Bond 10Y | 7/11/2023 12:00:00 AM | 8.97 | Secretaria de Hacienda y Credito Publico | | percent | /mexico/government-bond-yield | Markets | | Daily | GMXN10YR | 11/15/2012 11:38:00 AM | 7/31/2001 12:00:00 AM | 8.95 | 7/10/2023 12:00:00 AM |

-->

## Relationship types

The `Relationship` field describes what the peer is relative to the queried indicator (not the opposite direction).

| Value | Type       | Description                                                                 | Example                                                        |
|-------|------------|-----------------------------------------------------------------------------|----------------------------------------------------------------|
| 0     | Related    | The peer is a related indicator in the same domain.                         | US Unemployment Rate is related with US Non Farm Payrolls.     |
| 1     | Component  | The peer is a component of the queried indicator.                           | Private Unemployment Rate is a component of Unemployment Rate. |
| 2     | Parent     | The peer is a parent (broader aggregate) of the queried indicator.          | Unemployment Rate is a parent of Unemployment Rate among Females. |
| 3     | Derivative | The peer is a derived transformation of the queried indicator.              | Unemployment Rate MoM is a derivative of Unemployment Rate YoY. |
| 4     | Underlying | The peer is the underlying base series for the queried indicator.           | Unemployment Rate is the underlying of Unemployment Rate MoM.  |

## Response fields

| Field                | Type   | Description                                                                                     | Example                           |
| ---------------------| -------|-------------------------------------------------------------------------------------------------|-----------|
| Ticker               | string | Unique ticker code used by Trading Economics to identify the indicator.                           | "CPI YOY"                         |
| Peer                 | string | Related or comparable ticker code.                               | "MEXFRINRDPST"                    |
| Relationship         | number | Numeric code indicating the peer's relationship to the ticker (see [Relationship types](#relationship-types) above). | 0                                 |
| Country              | string | Name of the country associated with the indicator.                         | "Mexico"                          |
| Category             | string | Name of the economic or financial category.                                | "Deposit Interest Rate"           |
| Title                | string | Readable title combining country and category.                              | "Deposit Interest Rate in Mexico" |
| LatestValueDate      | string | Date of the most recently released value, in UTC.        | "2023-01-31T00:00:00"             |
| LatestValue          | number | Most recent published value for the indicator.                    | 4.19                              |
| Source               | string | Organization or institution providing the data.                         | "IMF"                             |
| SourceURL            | string | Direct URL link to the original data source (if available).       | "https://www.imf.org"             |
| Unit                 | string | Unit of measurement for the value.                                     | "percent"                         |
| URL                  | string | Hyperlink to the indicator page on Trading Economics.              | "/mexico/deposit-interest-rate"   |
| CategoryGroup        | string | Broad classification group for the indicator.                    | "Inflation Rate"                  |
| Adjustment           | string | Description of any adjustments.  | "1982-1984=100, NSA"              |
| Frequency            | string | Frequency at which the data is reported.                       | "Monthly"                         |
| HistoricalDataSymbol | string | Unique identifier used by Trading Economics for the data series.    | "UNITEDSTACONPRIINDCP"            |
| CreateDate           | string | Date and time when the indicator was added to the database.       | "2014-06-11T09:44:00"             |
| FirstValueDate       | string | Date of the first available historical observation (ISO 8601 format).     | "1950-01-31T00:00:00"             |
| PreviousValue        | number | Value released prior to the latest one.                   | 300.84                            |
| PreviousValueDate    | string | Release date of the previous value.                       | "2023-02-28T00:00:00"             |

