Pull stock fundamentals from SEC filings for valuation

A multi-agent framework for systematic stock analysis and portfolio construction, implementing concepts from BlackRock's "AlphaAgents" research. Task: A multi-agent framework for systematic stock analysis and portfolio construction, implementing concepts from BlackRock's "AlphaAgents" research. The system orchestrates three specialized AI agents (Valuation, Sentiment, Fundamental) plus a Coordinator to analyze stocks and evaluate performance through backtesting. Setup Environment & Dependencies Python Requirements: Ensure you're using Python 3.11 or later. Ensure you're using Python 3.11 or later. This version is required for optimal compatibility with LangGraph. This version is required for optimal compatibility with LangGraph. Create Virtual Environment & Install Dependencies: # Create virtual environment python -m venv .venv # Activate virtual environment source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies pip install -r requirements.txt Create Virtual Environment & Install Dependencies: financialdatasets.ai Integration: API Key: Set environment variable FINANCIAL_DATASETS_API_KEY with your API key financialdatasets.ai Integration: API Key: Set environment variable FINANCIAL_DATASETS_API_KEY with your API key Environment Setup: # Option 1: Set environment variable export FINANCIAL_DATASETS_API_KEY="your_api_key_here" # Option 2: Create .env file in project root echo "FINANCIAL_DATASETS_API_KEY=your_api_key_here" > .env Environment Setup: How to Run Note: Make sure your virtual environment is activated before running: Important: The pipeline only allows decision date (the “as-of” date) from 2024-08-01 to 2024-08-31 and will reject other dates. Design Agent Logic Valuation Agent: Calculates annualized return and volatility from 90-day price history BUY: Return >15% AND volatility <30% SELL: Return <-5% OR volatility >50% Uses BlackRock paper formulas for risk-adjusted momentum Sentiment Agent: Processes news articles using VADER sentiment analysis Combines title and snippet for richer context BUY: Average sentiment >0.4 (~75th percentile) SELL: Average sentiment <-0.03 (below neutral) Analyzes 5-10 news articles per ticker per date Fundamental Agent: Evaluates fundamental metrics (1-5 scale) Averages scores across all available factors BUY: Average score >4.0 (strong fundamentals) SELL: Average score <2.0 (weak fundamentals) Covers valuation, growth, profitability, financial strength ⚙️ Configuration: All agent decision thresholds are fully configurable via config/agent_config.yaml - no code changes required to adjust BUY/SELL/HOLD criteria. For example, change buy_return_threshold: 15.0 to 10.0 to make the valuation agent more aggressive (buy stocks with lower returns). Coordinator Rule Weighted Consensus: Valuation: 40% weight, Sentiment: 30%, Fundamental: 30% BUY: Weighted vote ≥0.4 threshold SELL: Weighted vote ≤0.2 threshold HOLD: Between thresholds (0.2-0.4) Portfolio construction: BUY stocks get full weight (1.0), HOLD stocks get half weight (0.5), SELL stocks excluded (0.0) Data Collection Price Data Source: financialdatasets.ai API for daily data Fallback: Cached CSV files when API unavailable News Data Source: Generated by ChatGPT Agent mode from reputable financial news sources Fields: title, snippet, date, source_url Fundamental Data Source: Generated by ChatGPT Agent mode from SEC 10-Q Metrics: Revenue Growth YTD (%), Operating Margin (%), Net Cash Position ($M), Free Cash Flow ($M), CapEx Intensity (%) Each metric includes: value: The calculated financial metric direction: Trend analysis (improving/declining/stable) score: 1-5 rating (5 = excellent, 1 = poor) explanation: Justification for the trend analysis source_url: SEC filing URL for verification derivation: Exact calculation showing how the metric was derived Multi-Agent Workflow Architecture Individual Stock Analysis (ticker_workflow.py): LangGraph Orchestration: Uses StateGraph to coordinate 3 specialized agents + coordinator Parallel Execution: Valuation, Sentiment, and Fundamental agents run simultaneously for each stock Workflow: START → [Valuation || Sentiment || Fundamental] → Coordinator → END Output: Single BUY/SELL/HOLD decision per stock with detailed reasoning Portfolio Analysis (portfolio_workflow.py): Subgraph Architecture: Uses ticker_workflow as a reusable subgraph component Parallel Stock Analysis: Runs 4 ticker subgraphs simultaneously (AAPL || MSFT || NVDA || TSLA) Workflow: START → [AAPL_subgraph || MSFT_subgraph || NVDA_subgraph || TSLA_subgraph] → Portfolio_Builder → END; tools: ChatGPT Agent. Human role: The original post does not say how a person stayed involved.; limitations: Prerequisites include Python 3.11+, a valid financialdatasets.ai API key, and specific cached data for fallback. The system is constrained to a single backtest period (August 2024) and assumes no transaction costs or slippage. Integration uncertainty exists regarding the reliability of ChatGPT-generated news and fundamental data, which requires manual verification against SEC filings. Human approval is mandatory for any threshold adjustments in agent_config.yaml..

Tools

ChatGPT Agent

Published on Agent Work Atlas:

Overview

A multi-agent framework for systematic stock analysis and portfolio construction, implementing concepts from BlackRock's "AlphaAgents" research.

Workflow

A multi-agent framework for systematic stock analysis and portfolio construction, implementing concepts from BlackRock's "AlphaAgents" research. The system orchestrates three specialized AI agents (Valuation, Sentiment, Fundamental) plus a Coordinator to analyze stocks and evaluate performance through backtesting. Setup Environment & Dependencies Python Requirements: Ensure you're using Python 3.11 or later. Ensure you're using Python 3.11 or later. This version is required for optimal compatibility with LangGraph. This version is required for optimal compatibility with LangGraph. Create Virtual Environment & Install Dependencies: # Create virtual environment python -m venv .venv # Activate virtual environment source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies pip install -r requirements.txt Create Virtual Environment & Install Dependencies: financialdatasets.ai Integration: API Key: Set environment variable FINANCIAL_DATASETS_API_KEY with your API key financialdatasets.ai Integration: API Key: Set environment variable FINANCIAL_DATASETS_API_KEY with your API key Environment Setup: # Option 1: Set environment variable export FINANCIAL_DATASETS_API_KEY="your_api_key_here" # Option 2: Create .env file in project root echo "FINANCIAL_DATASETS_API_KEY=your_api_key_here" > .env Environment Setup: How to Run Note: Make sure your virtual environment is activated before running: Important: The pipeline only allows decision date (the “as-of” date) from 2024-08-01 to 2024-08-31 and will reject other dates. Design Agent Logic Valuation Agent: Calculates annualized return and volatility from 90-day price history BUY: Return >15% AND volatility <30% SELL: Return <-5% OR volatility >50% Uses BlackRock paper formulas for risk-adjusted momentum Sentiment Agent: Processes news articles using VADER sentiment analysis Combines title and snippet for richer context BUY: Average sentiment >0.4 (~75th percentile) SELL: Average sentiment <-0.03 (below neutral) Analyzes 5-10 news articles per ticker per date Fundamental Agent: Evaluates fundamental metrics (1-5 scale) Averages scores across all available factors BUY: Average score >4.0 (strong fundamentals) SELL: Average score <2.0 (weak fundamentals) Covers valuation, growth, profitability, financial strength ⚙️ Configuration: All agent decision thresholds are fully configurable via config/agent_config.yaml - no code changes required to adjust BUY/SELL/HOLD criteria. For example, change buy_return_threshold: 15.0 to 10.0 to make the valuation agent more aggressive (buy stocks with lower returns). Coordinator Rule Weighted Consensus: Valuation: 40% weight, Sentiment: 30%, Fundamental: 30% BUY: Weighted vote ≥0.4 threshold SELL: Weighted vote ≤0.2 threshold HOLD: Between thresholds (0.2-0.4) Portfolio construction: BUY stocks get full weight (1.0), HOLD stocks get half weight (0.5), SELL stocks excluded (0.0) Data Collection Price Data Source: financialdatasets.ai API for daily data Fallback: Cached CSV files when API unavailable News Data Source: Generated by ChatGPT Agent mode from reputable financial news sources Fields: title, snippet, date, source_url Fundamental Data Source: Generated by ChatGPT Agent mode from SEC 10-Q Metrics: Revenue Growth YTD (%), Operating Margin (%), Net Cash Position ($M), Free Cash Flow ($M), CapEx Intensity (%) Each metric includes: value: The calculated financial metric direction: Trend analysis (improving/declining/stable) score: 1-5 rating (5 = excellent, 1 = poor) explanation: Justification for the trend analysis source_url: SEC filing URL for verification derivation: Exact calculation showing how the metric was derived Multi-Agent Workflow Architecture Individual Stock Analysis (ticker_workflow.py): LangGraph Orchestration: Uses StateGraph to coordinate 3 specialized agents + coordinator Parallel Execution: Valuation, Sentiment, and Fundamental agents run simultaneously for each stock Workflow: START → [Valuation || Sentiment || Fundamental] → Coordinator → END Output: Single BUY/SELL/HOLD decision per stock with detailed reasoning Portfolio Analysis (portfolio_workflow.py): Subgraph Architecture: Uses ticker_workflow as a reusable subgraph component Parallel Stock Analysis: Runs 4 ticker subgraphs simultaneously (AAPL || MSFT || NVDA || TSLA) Workflow: START → [AAPL_subgraph || MSFT_subgraph || NVDA_subgraph || TSLA_subgraph] → Portfolio_Builder → END

Reported result

The source describes a prototype with no reported live trading success or verified financial gains. It produces deterministic backtest results for August 2024, outputting BUY/SELL/HOLD decisions and portfolio weights. Actual performance metrics are unknown beyond the simulated backtest window, and the system explicitly lacks transaction cost modeling. A measurable acceptance check would be verifying that the pipeline rejects dates outside 2024-08-01 to 2024-08-31.

Human role

The original post does not say how a person stayed involved.

Limitations

Prerequisites include Python 3.11+, a valid financialdatasets.ai API key, and specific cached data for fallback. The system is constrained to a single backtest period (August 2024) and assumes no transaction costs or slippage. Integration uncertainty exists regarding the reliability of ChatGPT-generated news and fundamental data, which requires manual verification against SEC filings. Human approval is mandatory for any threshold adjustments in agent_config.yaml.

Try it

Act as a financial data engineer. I need to set up a multi-agent stock analysis prototype using LangGraph. 1. **Environment Setup**: Create a Python 3.11 virtual environment. Install dependencies from requirements.txt. Set the environment variable FINANCIAL_DATASETS_API_KEY to [replaceable_api_key]. 2. **Data Configuration**: Ensure cached price data exists in data/raw/prices/ for tickers [replaceable_tickers, e.g., AAPL, MSFT]. Configure the pipeline to only accept decision dates between 2024-08-01 and 2024-08-31. 3. **Agent Logic**: Implement three agents: Valuation (90-day return/volatility), Sentiment (VADER on news), and Fundamental (1-5 score from SEC 10-Q). Set Coordinator weights to Valuation 40%, Sentiment 30%, Fundamental 30%. 4. **Execution**: Run the pipeline for a single sample date, e.g., 2024-08-15. 5. **Verification**: Check that the output files picks.csv and performance.csv are generated. Verify that no future data was used (leakage check). 6. **Human Review**: Present the sample output to me for approval before running the full backtest. Do not proceed if the date is outside the allowed range. Deliverables: A working local script, sample output CSVs, and a log of the execution. If API keys are missing, use cached CSVs and flag this in the output.

Original source

Source reports are not independently verified. Publication date is the catalog publication date, not the original article date.

More cases · Finance & legal