Skip to content

YFinance Tool

The YFinance Tool lets you pull financial data for any publicly traded company directly from Yahoo Finance. Just enter the stock symbol, choose what kind of information you need, and the component will return the data so you can use it in your automation workflow.

How it Works

When you run the component, it uses the yfinance Python library to connect to Yahoo Finance’s public API.

  1. Stock Symbol – The ticker (e.g., AAPL for Apple, GOOG for Alphabet).
  2. Information to request – Pick from a list of options such as “Ticker Info”, “News”, or other data fields that Yahoo Finance exposes.
  3. Number of News – If you selected “News”, this tells the component how many recent news articles to return (default is 5).

The component then fetches the requested data, formats it into a readable string, and outputs it as a list of Data objects. It also provides a Tool object that can be used by other parts of the Nappai system to call the same functionality programmatically.

Inputs

  • Information to request: Choose the type of data you want from Yahoo Finance. Options include basic ticker information, recent news, and other financial metrics.
  • Number of News: When “News” is selected, specify how many news articles to retrieve. The default is 5.
  • Stock Symbol: Enter the ticker symbol of the company you want data for (e.g., AAPL, GOOG).

Outputs

  • Tool: A reusable tool object that can be called by other components or workflows.
  • Data: A list of Data objects containing the requested financial information. If you asked for news, each article is returned as a separate Data item; otherwise, the result is wrapped in a single Data object.

Usage Example

  1. Drag the YFinance Tool into your workflow.
  2. Set Stock Symbol to MSFT.
  3. Choose Information to requestTicker Info.
  4. Leave Number of News at the default (it won’t be used).
  5. Connect the Data output to a Display component or a Data Store component to view or save the information.

The workflow will fetch Microsoft’s current ticker information and display it in the next component.

  • Stock Price Component – Retrieves the latest price for a ticker.
  • Financial Ratios Component – Calculates key ratios like P/E, EPS, etc.
  • News Aggregator Component – Pulls news from multiple sources, not just Yahoo Finance.

Tips and Best Practices

  • Use the exact ticker symbol; a typo will return no data.
  • If you only need a quick snapshot, choose “Ticker Info” instead of “News” to keep the response small.
  • For large news requests, consider increasing the limit only if you need more context, as each article adds to the payload size.
  • Combine the YFinance Tool with a Filter component to extract specific fields (e.g., market cap, dividend yield).

Security Considerations

  • The component accesses Yahoo Finance over the public internet; ensure your Nappai instance has outbound internet access.
  • No sensitive credentials are required, but keep your network secure to prevent unauthorized data access.
  • The data returned is public market information, so no special compliance handling is needed.