Market Summary

Learn how to get information about different stock markets.

So far, we've covered the endpoints that give us information about the securities. Now let's look at the endpoints that can give us information about the stock markets.

The endpoint https://yfapi.net/v6/finance/quote/marketSummary is the first one on the list. Using this endpoint, we can fetch information about finance markets of any specific region. This information can help the investor keep a track of the rising markets, providing more investment opportunities.

Request parameters

We can use the following query parameters with this endpoint:

Parameters

Category

Type

Description

lang

optional

string

This parameter represents the language in which we want the information, possible values include en, es, de, fr, it, and zh. The table in the Appendix shows which language each of these symbols represents.

region

optional

string

This parameter represents the region for which we want the information. The possible options for this parameter are AU, CA, DE, ES, FR, GB, HK, IN, IT, and US. The table in the Appendix shows which region each of these symbols represents.

The code below shows how we can use this endpoint to get information about Indian stock markets. Click "Run" below to get the required information.

Press + to interact
const endpointUrl = new URL('https://yfapi.net/v6/finance/quote/marketSummary');
const queryParameters = new URLSearchParams({
lang:'en',
region:'IN',
});
const headerParameters = {
'X-API-KEY': '{{API_KEY}}'
}
const options = {
method: 'GET',
headers: headerParameters
};
async function fetchMarketInfo() {
try {
endpointUrl.search = queryParameters;
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printError(error);
}
}
fetchMarketInfo();

Let's look at the code:

  • Line 1: We set the URL to https://yfapi.net/v6/finance/quote/marketSummary.

  • Lines 3–6: We add the query parameters.

  • Line 17–25: We define a function, fetchMarketInfo(). This function calls the endpoint and prints the response.

We can change the value of region in line 5 to get information about markets of other regions.

Response fields

We'll get market information that shows how those markets are performing at the moment. Some important response fields are mentioned in the table below.

Response fields

Description

quoteType

This tells us the type of market that we get in response. For example, index market or cryptocurrency.

fullExchangeName

This is the symbol of the trending securities.

regularMarketTime

The current time in the exchange timezone.

regularMarketPrice

The index of exchange at the time of the request.

regularMarketPreviousClose

The index at which the exchange closed on the previous working day.