> ## 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.

# 金融数据集工具

## 代码

```python cookbook/tools/financial_datasets_tools.py theme={null}
from agno.agent import Agent
from agno.tools.financial_datasets import FinancialDatasetsTools

agent = Agent(
    name="Financial Data Agent",
    tools=[
        FinancialDatasetsTools(),  # 用于访问金融数据
    ],
    description="您是一位金融数据专家，帮助用户分析股票和加密货币的金融信息。",
    instructions=[
        "当收到金融查询时：",
        "1. 根据查询类型使用适当的金融数据集方法",
        "2. 清晰地格式化金融数据并突出关键指标",
        "3. 对于财务报表，在相关时比较重要指标与上期数据",
        "4. 在适当时计算增长率和趋势",
        "5. 优雅地处理错误并提供有意义的反馈",
    ],
    markdown=True,
    show_tool_calls=True,
)

# 示例 1：财务报表
print("\n=== 利润表示例 ===")
agent.print_response(
    "获取 AAPL 的最新利润表并突出关键指标",
    stream=True,
)

# 示例 2：资产负债表分析
print("\n=== 资产负债表分析示例 ===")
agent.print_response(
    "分析 MSFT 过去 3 年的资产负债表。重点关注负债股本比和现金头寸。",
    stream=True,
)

```

## 用法

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="设置您的 API 凭证">
    ```bash theme={null}
    export FINANCIAL_DATASETS_API_KEY=xxx
    ```
  </Step>

  <Step title="安装库">
    ```bash theme={null}
    pip install -U agno
    ```
  </Step>

  <Step title="运行 Agent">
    <CodeGroup>
      ```bash Mac theme={null}
        python cookbook/tools/financial_datasets_tools.py
      ```

      ```bash Windows theme={null}
        python cookbook/tools/financial_datasets_tools.py
      ```
    </CodeGroup>
  </Step>
</Steps>
