Finnhub.io icon

Finnhub.io

Consume Finnhub.io API

Overview

The Indices Constituents operation of the Index resource in this custom n8n node allows users to retrieve the list of constituent symbols (i.e., the companies or assets) that make up a specific financial index from the Finnhub.io API. This is useful for workflows that need to analyze, monitor, or process the components of indices such as the S&P 500 (^GSPC), NASDAQ, or other global indices.

Common scenarios:

  • Fetching all current members of an index for further data enrichment or analysis.
  • Automating portfolio construction or rebalancing based on index composition.
  • Integrating with other nodes to fetch detailed data for each constituent.

Example:
A user wants to get the list of all stocks currently included in the S&P 500 index and then fetch their latest prices.

Properties

Name Type Meaning
Symbol String The symbol representing the index whose constituents you want to fetch. Example: ^GSPC for S&P 500.

Output

The output will be a JSON object containing the list of constituent symbols for the specified index. The structure typically includes:

{
  "symbol": "^GSPC",
  "constituents": [
    "AAPL",
    "MSFT",
    "GOOGL",
    ...
  ]
}
  • symbol: The index symbol queried.
  • constituents: An array of strings, each representing a constituent's ticker symbol.

Note: If the node supports binary output, it is not relevant for this operation.

Dependencies

  • Finnhub.io API key: You must configure valid Finnhub credentials in n8n.
  • n8n configuration: Ensure the Finnhub credential is set up and accessible by the node.

Troubleshooting

Common issues:

  • Invalid or missing API key: The node will fail if the Finnhub API key is not provided or is incorrect.
  • Incorrect symbol: Using an invalid or unsupported index symbol may result in empty results or errors.
  • API rate limits: Exceeding Finnhub's free tier limits can cause errors or throttling.

Error messages and resolutions:

  • 401 Unauthorized: Check your Finnhub API key configuration.
  • 404 Not Found: Verify the index symbol is correct and supported by Finnhub.
  • 429 Too Many Requests: Wait before retrying or upgrade your Finnhub plan.

Links and References

Discussion