Overview
Concrete tool for retrieving financial market data including stock prices, historical data, and market indicators.
Description
The FinanceToolkit fetches financial data from external APIs using `tenacity` for retry logic and OpenAI for data processing. It supports historical data, stock prices, and market indicators. Integrates with the EvoAgentX Tool/Toolkit framework. The companion StockToolkit creates `APITool` instances for fetching stock symbols, prices, and market data using the `api_converter` pattern.
Usage
- Financial analysis: Attach to agents for investment analysis workflows.
- Market data: Retrieve stock prices and historical market data.
- Trading workflows: Use in combination with database tools for data persistence.
Code Reference
Source Location
Signature
# finance_tool.py — Financial data retrieval with retry logic
class FinanceToolkit(Toolkit):
def __init__(self, ...)
# Tools: get_stock_price, get_historical_data, get_market_indicators
# stock_tool.py — Stock market data tools via APITool pattern
def create_stock_tool(...) -> APITool
# Creates APITool instances for stock data fetching
Import
from evoagentx.tools.finance_tool import FinanceToolkit
from evoagentx.tools.stock_tool import create_stock_tool
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| symbol |
str |
Yes |
Stock ticker symbol
|
| start_date |
str |
No |
Start date for historical data
|
| end_date |
str |
No |
End date for historical data
|
Outputs
| Name |
Type |
Description
|
| get_stock_price returns |
dict |
Current stock price data
|
| get_historical_data returns |
List[dict] |
Historical price records
|
Usage Examples
Financial Data Agent
from evoagentx.tools.finance_tool import FinanceToolkit
from evoagentx.agents.customize_agent import CustomizeAgent
from evoagentx.models.model_configs import OpenAILLMConfig
agent = CustomizeAgent(
name="FinanceAgent",
description="Analyze stock market data",
prompt="Analyze the stock {symbol} and provide investment insights.",
llm_config=OpenAILLMConfig(model="gpt-4o-mini", openai_key="sk-..."),
inputs=[{"name": "symbol", "type": "str", "description": "Stock symbol"}],
outputs=[{"name": "analysis", "type": "str", "description": "Investment analysis"}],
parse_mode="title",
tools=[FinanceToolkit()],
)
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.