Tool

Access Financial Data via Yahoo Finance

LlamaIndex tool giving an agent free access to a company's stock, news, and financial data.

Works with yahoo finance

78
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Integrate with Yahoo Finance to retrieve comprehensive company financial data, including stock prices, news, and statements, for analysis and decision-making.

Outcomes

What it gets done

01

Retrieve stock prices and basic company information.

02

Fetch the latest news articles related to specific companies.

03

Access balance sheets, income statements, and cash flow data.

04

Obtain analyst recommendations for stock investments.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-tool-tools-yahoo-finance | bash

Overview

Yahoo Finance Tool

The Yahoo Finance Tool wires Yahoo Finance into a LlamaIndex agent as six callable functions covering a company's balance sheet, income statement, cash flow, news, basic info, and analyst recommendations, with no API key required. Use it when an agent needs a company's financial statements, stock info, news, or analyst sentiment. It requires no account setup, but only covers the six data types it exposes.

What it does

The Yahoo Finance Tool connects to Yahoo Finance and gives an agent access to a company's stock, news, and financial data. It exposes six functions: balance_sheet (a company's balance sheet), income_statement (its income statement), cash_flow (its cash flow), stock_news (its latest news), stock_basic_info (basic info including price), and stock_analyst_recommendations (analyst recommendations).

When to use - and when NOT to

Use it when an agent needs a company's financial statements, stock price, news, or analyst sentiment -- for example "What is the price of Apple stock?" or "What is the latest news about Apple?" It requires no API key or account setup, but its scope is limited to the six data types it exposes -- balance sheet, income statement, cash flow, news, basic info, and analyst recommendations.

Inputs and outputs

Install with:

pip install llama-index-tools-yahoo-finance

Attach it to an agent with no extra setup:

from llama_index.tools.yahoo_finance import YahooFinanceToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = YahooFinanceToolSpec()
agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("What is the price of Apple stock?"))
print(await agent.run("What is the latest news about Apple?"))

Given a company, each of the six functions returns its own slice of data -- financial statements, news, basic info, or analyst recommendations -- with no query parameters beyond the company itself.

Who it's for

Developers building agents that need company financial data, stock info, or news without integrating a dedicated market-data API.

Source README

Yahoo Finance Tool

This tool connects to Yahoo Finance and allows an Agent to access stock, news, and financial data of a company.

Installation

pip install llama-index-tools-yahoo-finance

Usage

Here's an example of how to use this tool:

from llama_index.tools.yahoo_finance import YahooFinanceToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = YahooFinanceToolSpec()
agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("What is the price of Apple stock?"))
print(await agent.run("What is the latest news about Apple?"))

The tools available are:

balance_sheet: A tool that returns the balance sheet of a company.

income_statement: A tool that returns the income statement of a company.

cash_flow: A tool that returns the cash flow of a company.

stock_news: A tool that returns the latest news about a company.

stock_basic_info: A tool that returns basic information about a company including price.

stock_analyst_recommendations: A tool that returns analyst recommendations for a company.

This loader is designed to be used as a way to load data as a Tool in a Agent.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.