### Added
- **Hyper-Immutability (Physically Secured State)**: Implemented `FactLedger` (TypedDict) and `write_once_enforce` reducer in `agent_states.py` to cryptographically lock data reality.
- Ledger is hashed (SHA-256) upon creation.
- Wrapped in `MappingProxyType` to prevent any downstream agent from mutating the facts.
- **The Data Registrar (Parallel Gatekeeper)**: Created `DataRegistrar` node (`tradingagents/agents/data_registrar.py`) that acts as the Single Source of Truth.
- **Parallel I/O**: Fetches Price, Fundamentals, News, and Insider data concurrently (4x speedup over sequential).
- **Partial Poisoning Guard**: Hard "Fail-Fast" if critical domains (Price, Fundamentals) are missing.
- **Freshness Simulation**: Configurable `TRADING_MODE` (simulation/production) to allow rigorous testing without stale-data aborts.
### Fixed
- **Hallucination Vectors (The Lobotomy)**: Removed ALL tool access from `Market`, `Social`, `News`, and `Fundamentals` analysts.
- Analysts now consume exclusively from `FactLedger`.
- Eliminated "Tool Use Loop" latency and potential for agents to fetch divergent data.
- **Graph Wiring**: Refactored `setup.py` to route `START` -> `Data Registrar` -> `Market Analyst` -> Parallel Fan-Out.
- `Market Analyst` now triggers `Social`, `News`, and `Fundamentals` analysts **concurrently**.
- Added `Analyst Sync` node to synchronize parallel branches.
- Added `Analyst Sync` node to synchronize parallel branches.
- reduced total runtime by ~50% by overlapping heavy LLM/Tool operations.
- **Fail Fast Scraper**: Optimized `googlenews_utils.py` to timeout after ~30s (down from 3m) when blocked, ensuring rapid failover to backup vendors.
### Fixed
- **API Error 400 (Dangling Tool Use)**: Fixed crash in `Fundamentals Analyst` and others caused by unhandled tool exceptions (e.g. Rate Limits).
- Wrapped all tools in `fundamental_data_tools.py`, `news_data_tools.py`, `core_stock_tools.py`, and `technical_indicators_tools.py` with `try/except` blocks.
- Tools now return error strings instead of crashing, ensuring stricter API compliance and system resilience.
- Removed dependency on client-side `marked.js` and CDNs.
- Reports are now fully offline-capable.
- Cleaned up JSON keys to remove `.md` extensions for cleaner data structure.
- **Google News Adapter**: Implemented `get_google_global_news` adapter in `google.py` to match the standard `(curr_date, look_back_days)` interface, adhering to the Adapter Pattern and fixing signature mismatches.
- **Robust Demo Script**: Created `run_agent.py` (replacing demo scripts) with:
- Automatic `.env` loading.
- `backend_url` handling (clearing OpenAI defaults when using Anthropic).
- Hardened configuration for "Deep Analysis" (Debate Rounds=2).
- Pre-configured Google News vendor to bypass AlphaVantage rate limits.
### Fixed
- **Rate Limit Crash**: Fixed `AlphaVantageRateLimitError` by switching default news vendor to Google in `run_agent.py`.
- **Relative Strength Determinism**: Upgraded `market_analyst.py` to calculate a mathematical `risk_multiplier` (0.0x - 1.5x) based on the Asset Regime vs. SPY Regime correlation, removing LLM "confidence" hallucinations from position sizing.
- **Portfolio Awareness (Rule 72)**: Implemented State Persistence (`portfolio`, `cash_balance`) and a hard-coded Stop Loss check in `trading_graph.py`. If a position's unrealized PnL drops below -10%, the system forces a "LIQUIDATE" order, bypassing all AI debate.
- **Self-Tuning Architecture**: Updated `reflection.py` to output a structured JSON block (`UPDATE_PARAMETERS`) instead of prose advice, enabling future automated parameter optimization.
Override Logic Mismatches: Fixed critical Enum-to-String type mismatch in
apply_trend_override
that was silencing the "Safety Valve" logic.
Data Pipeline Failures: Injected robust error handling and type checking in
market_analyst.py
to identify why RegimeDetector receives invalid data (causing "UNKNOWN" regimes).
Gemini 404 Errors: Removed invalid/deprecated model names causing 404s
- **Configurable Embeddings Truncation**: Added `EMBEDDING_TRUNCATION_LIMIT` env var (default 1000) to prevent `413 Payload Too Large` errors with local models.
- Replace hardcoded column indices with column name lookup
- Add mapping for all supported indicators to their expected CSV column names
- Handle missing columns gracefully with descriptive error messages
- Strip whitespace from header parsing for reliability
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Replace FinnHub with Alpha Vantage API in README documentation
- Implement comprehensive Alpha Vantage modules:
- Stock data (daily OHLCV with date filtering)
- Technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands, ATR)
- Fundamental data (overview, balance sheet, cashflow, income statement)
- News and sentiment data with insider transactions
- Update news analyst tools to use ticker-based news search
- Integrate Alpha Vantage vendor methods into interface routing
- Maintain backward compatibility with existing vendor system
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>