Finnhub.io icon

Finnhub.io

Consume Finnhub.io API

Overview

The Forex Rates [PREMIUM] operation of the Finnhub.io n8n node retrieves real-time foreign exchange (forex) rates for a specified base currency. This node is useful for workflows that require up-to-date currency conversion data, such as financial dashboards, automated trading strategies, or reporting tools that need to display or process current forex rates.

Practical examples:

  • Automatically update product prices in multiple currencies based on live exchange rates.
  • Monitor and alert when certain currency pairs reach specific thresholds.
  • Integrate with accounting systems to convert transaction amounts to a base currency.

Properties

Name Type Meaning
Base String Base currency for which to retrieve forex rates. Defaults to EUR if not specified. Example: "USD".

Output

The node outputs a JSON object containing the latest forex rates relative to the specified base currency. The structure typically includes:

{
  "base": "USD",
  "date": "2024-06-10",
  "rates": {
    "EUR": 0.92,
    "GBP": 0.79,
    "JPY": 155.3,
    ...
  }
}
  • base: The base currency used for the rates.
  • date: The date/time of the rates.
  • rates: An object mapping each target currency code to its exchange rate against the base.

Note: The actual output fields may vary depending on the Finnhub API response.

Dependencies

  • External Service: Requires access to the Finnhub.io API.
  • API Key: You must provide a valid Finnhub API key via n8n credentials named finnhub.
  • n8n Configuration: No special configuration beyond setting up the Finnhub credential.

Troubleshooting

Common Issues:

  • Invalid API Key: If your API key is missing or incorrect, you may receive authentication errors. Ensure your Finnhub credential is set up correctly in n8n.
  • Rate Limits: Finnhub enforces rate limits, especially for free accounts. Exceeding these will result in error messages from the API.
  • Unsupported Currency Code: If an invalid or unsupported base currency is provided, the API may return an error or empty results.

Common Error Messages:

  • "401 Unauthorized": Check your API key and Finnhub credential setup.
  • "429 Too Many Requests": You have exceeded your rate limit; wait before making more requests or upgrade your plan.
  • "400 Bad Request": Likely due to an invalid base currency or malformed request.

Links and References

Discussion