Financial Datasets
Query income statements and balance sheets through the current Financial Datasets API contracts.
Query company financial statements with FinancialDatasetsTools.
Several additional methods in this legacy toolkit 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.
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
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openai requestsExport your API keys
export FINANCIAL_DATASETS_API_KEY="your_financial_datasets_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"Run the example
Save the code above as financial_datasets_tools.py, then run:
python financial_datasets_tools.pyFull source: cookbook/91_tools/financial_datasets_tools.py