-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstate.py
More file actions
33 lines (27 loc) · 1.33 KB
/
Copy pathstate.py
File metadata and controls
33 lines (27 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import operator
from typing import Annotated, List, Dict, Any, TypedDict, Optional
class FinancialState(TypedDict, total=False):
# Inputs
ticker: str
# Error handling
error: str # Error message if data fetch or processing fails
success: bool # Whether the analysis was successful
# 1. Data Ingestion Agent Output
start_date: str
end_date: str
# Storing dataframe as a JSON string or dict to keep it serializable for the graph
# (In practice, passing the DF directly works in-memory, but let's keep it flexible)
historical_data: Annotated[Any, "The raw dataframe or list of dicts"]
# 2. Fundamental & Technical Agent Output
# Basic metrics like P/E, Market Cap
fundamental_metrics: Dict[str, Any]
# Technical signals (RSI, MACD values)
technical_indicators: Dict[str, Any]
# 3. Risk Agent Output
risk_metrics: Dict[str, Any] # e.g., {'max_drawdown': -0.20, 'sharpe_ratio': 1.5}
# 4. Synthesis Agent Output
recommendation: str # "Buy", "Sell", or "Hold"
risk_level: str # "Low", "Medium", "High", or "Extreme"
reasoning: str # Explanation for the recommendation
key_drivers: List[str] # List of key factors influencing the decision
final_report: str # The full explanation generated by Gemini