> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Yfinance

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

## 前提条件

以下示例需要 `yfinance` 库。

```shell theme={null}
pip install -U yfinance
```

## 示例

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

```python cookbook/tools/yfinance_tools.py theme={null}
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_price`             | `bool` | `True`  | 启用获取当前股票价格信息的功能。    |
| `company_info`            | `bool` | `False` | 启用获取公司详细信息的功能。      |
| `stock_fundamentals`      | `bool` | `False` | 启用获取股票基本数据的功能。      |
| `income_statements`       | `bool` | `False` | 启用获取公司损益表的功能。       |
| `key_financial_ratios`    | `bool` | `False` | 启用获取公司关键财务比率的功能。    |
| `analyst_recommendations` | `bool` | `False` | 启用获取股票分析师建议的功能。     |
| `company_news`            | `bool` | `False` | 启用获取公司相关最新消息的功能。    |
| `technical_indicators`    | `bool` | `False` | 启用获取用于股票分析的技术指标的功能。 |
| `historical_prices`       | `bool` | `False` | 启用获取股票历史价格数据的功能。    |

## 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`    | 此函数检索用于股票分析的技术指标。 |

## 开发者资源

* 查看 [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/yfinance.py)
* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/tools/yfinance_tools.py)
