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

# Financial Datasets

> Query income statements and balance sheets through the current Financial Datasets API contracts.

Query company financial statements with `FinancialDatasetsTools`.

> [!WARNING]
>
> Several additional methods in Agno v2.7.2 target older Financial Datasets endpoint or parameter contracts. This example registers only `get_income_statements` and `get_balance_sheets`, which match the [current Financial Datasets OpenAPI](https://financialdatasets.ai/openapi.json).

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

agent = Agent(
    name="Financial Statement Agent",
    tools=[
        FinancialDatasetsTools(
            include_tools=["get_income_statements", "get_balance_sheets"]
        )
    ],
    description="Analyze company income statements and balance sheets.",
    instructions=[
        "Use the financial statement tools for the requested ticker.",
        "Compare important metrics across periods when relevant.",
        "Format the result clearly and identify the source periods.",
    ],
    markdown=True,
)

if __name__ == "__main__":
    agent.print_response(
        "Get the most recent income statement for AAPL and highlight key metrics",
        stream=True,
    )
    agent.print_response(
        "Analyze the balance sheets for MSFT over the last 3 years. "
        "Focus on debt-to-equity ratio and cash position.",
        stream=True,
    )
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai requests
```

**2. Export your API keys**

```bash Mac/Linux theme={null}
export FINANCIAL_DATASETS_API_KEY="your_financial_datasets_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:FINANCIAL_DATASETS_API_KEY="your_financial_datasets_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `financial_datasets_tools.py`, then run:

```bash theme={null}
python financial_datasets_tools.py
```

Full source: [cookbook/91\_tools/financial\_datasets\_tools.py](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/financial_datasets_tools.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.