YFinanceTools 可以让代理访问 Yahoo Finance 提供的股票数据、财务信息等。

前提条件

以下示例需要 yfinance 库。

pip install -U yfinance

示例

以下代理将提供有关 NVDA(英伟达公司)的股票价格和分析师建议的信息。

cookbook/tools/yfinance_tools.py
from agno.agent import Agent
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, stock_fundamentals=True)],
    show_tool_calls=True,
    description="You are an investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
    instructions=["Format your response using markdown and use tables to display data where possible."],
)
agent.print_response("Share the NVDA stock price and analyst recommendations", markdown=True)

Toolkit 参数

参数类型默认值描述
stock_priceboolTrue启用获取当前股票价格信息的功能。
company_infoboolFalse启用获取公司详细信息的功能。
stock_fundamentalsboolFalse启用获取股票基本数据的功能。
income_statementsboolFalse启用获取公司损益表的功能。
key_financial_ratiosboolFalse启用获取公司关键财务比率的功能。
analyst_recommendationsboolFalse启用获取股票分析师建议的功能。
company_newsboolFalse启用获取公司相关最新消息的功能。
technical_indicatorsboolFalse启用获取用于股票分析的技术指标的功能。
historical_pricesboolFalse启用获取股票历史价格数据的功能。

Toolkit 功能

功能描述
get_current_stock_price此函数检索公司的当前股票价格。
get_company_info此函数检索公司的详细信息。
get_historical_stock_prices此函数检索公司的历史股票价格。
get_stock_fundamentals此函数检索股票的基本数据。
get_income_statements此函数检索公司的损益表。
get_key_financial_ratios此函数检索公司的关键财务比率。
get_analyst_recommendations此函数检索股票的分析师建议。
get_company_news此函数检索与公司相关的最新消息。
get_technical_indicators此函数检索用于股票分析的技术指标。

开发者资源