16 KiB
16 KiB
Changelog
All notable changes to the TradingAgents project will be documented in this file.
[Unreleased] - 2026-01-14
Added
- Standalone HTML Reports: Refactored report generation to perform server-side Markdown-to-HTML rendering using Python.
- Removed dependency on client-side
marked.jsand CDNs. - Reports are now fully offline-capable.
- Cleaned up JSON keys to remove
.mdextensions for cleaner data structure.
- Removed dependency on client-side
- Google News Adapter: Implemented
get_google_global_newsadapter ingoogle.pyto 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
.envloading. backend_urlhandling (clearing OpenAI defaults when using Anthropic).- Hardened configuration for "Deep Analysis" (Debate Rounds=2).
- Pre-configured Google News vendor to bypass AlphaVantage rate limits.
- Automatic
Fixed
- Rate Limit Crash: Fixed
AlphaVantageRateLimitErrorby switching default news vendor to Google inrun_agent.py. - Interface Mismatch: Fixed
TypeErroringet_global_newswhere string dates were passed to integer arguments. - Logi Crash: Fixed
TypeErrorinTradingAgentsGraph.apply_trend_overridecaused by duplicate arguments in the method call. - Broken Entry Point: Updated
startAgent.shto point to the correctrun_agent.pyscript instead of a non-existent file.
[Unreleased] - 2026-01-14 (Performance & Logic Upgrade)
Changed
- Risk Star Topology (Strategy 2): Replaced sequential "Round Robin" risk debate with a parallel "Fan-Out / Fan-In" architecture.
Tradernow triggersRisky,Safe, andNeutralanalysts simultaneously.- Implemented
Risk Syncnode andmerge_risk_statesreducer (AgentStates) to handle concurrent updates safely. - Reduced Risk Phase latency by ~60%.
- Batch Reflection (Strategy 1): Consolidated 5 sequential reflection calls into a single "Session Audit" call, reducing token usage and latency by ~80% in the post-trade phase.
- Parallel I/O (Strategy 3): Refactored
tradingagents/dataflows/local.py(Reddit News) to useThreadPoolExecutor(max 10 workers), achieving 5x-10x speedup in data fetching.
Added
- Rejection Loops (Self-Correction): Upgraded
EnhancedConditionalLogicto allow agents to reject weak arguments and force a revision loop (Bull -> Bull) instead of passing bad data downstream. - Trader Mental Models (Logic Patch): Injected "Critical Mental Models" into
trader.pysystem prompt to fix "Value Trap" bias.- CapEx: Explicitly defined Strategic CapEx as "Moat Building" (Bullish) for platform monopolies.
- Regulation: Reframed Antitrust Risk as a "Chronic Condition" (Position Sizing) rather than "Terminal Disease" (Panic Sell).
Changed
- Parallel Architecture (AsyncIO): Refactored
setup.pyto implement a "Fan-Out / Fan-In" pattern using LangGraph.Market Analystnow triggersSocial,News, andFundamentalsanalysts concurrently.- Added
Analyst Syncnode to synchronize parallel branches. - Added
Analyst Syncnode to synchronize parallel branches. - reduced total runtime by ~50% by overlapping heavy LLM/Tool operations.
- Fail Fast Scraper: Optimized
googlenews_utils.pyto 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 Analystand 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, andtechnical_indicators_tools.pywithtry/exceptblocks. - Tools now return error strings instead of crashing, ensuring stricter API compliance and system resilience.
- Wrapped all tools in
[Unreleased] - 2026-01-14 (Architecture Hardening)
Added
- Subgraph Isolation (The Sandbox): Refactored
Social,News, andFundamentalsanalysts to run in their own isolatedStateGraphcontainers.- Implemented
Init_Clearnode to wipe message history at the start of each subgraph. - Prevents cross-contamination of tool calls between parallel analysts (fixing "Dangling Tool Use" API Error 400).
- Implemented
- Strict State Schemas (Type Safety): Defined
SocialAnalystState,NewsAnalystState, andFundamentalsAnalystStateinagent_states.py.- Restricts analyst subgraphs to only access necessary inputs (
company,date) and write specific outputs (report). - Eliminates "global state leakage" risks.
- Restricts analyst subgraphs to only access necessary inputs (
- Universal Notification System: Implemented a unified factory pattern (
get_notifier) innotifications.pysupporting:- CallMeBot: Free WhatsApp notifications (Personal Use).
- Telegram: Free Bot API notifications (Reliable Alternative).
- Twilio: Enterprise-grade WhatsApp notifications.
- Zero-dependency implementation (using
requests).
Fixed
- Concurrent Write Conflict: Resolved
InvalidUpdateErrorin LangGraph during parallel "Fan-In".- Implemented
reduce_overwritelogic inAgentState. - Allows parallel subgraphs to return identical read-only inputs (
company_of_interest) without triggering race condition errors.
- Implemented
[Released] - 2026-01-13
Added
- Dynamic Parameter Tuning (The Learning Loop): Implemented full self-reflection cycle. The Reflector agent now parses its own advice into JSON (
rsi_period,stop_loss_pct), persists it todata_cache/runtime_config.json, and the Market Analyst loads it to tune the Regime Detector in real-time. - Audit Archival: Every tuning event is now archived to
results/{TICKER}/{DATE}/runtime_config.jsonfor historical auditing, ensuring we can reproduce why parameters changed on any given day. - Atomic Persistence: Implemented
agent_utils.write_json_atomicto prevent race conditions during config saves. - Centralized Config: Moved hardcoded paths to
default_config.py(DRY principle).
Fixed
- Reflector Logic Gap: The Reflector was previously "shouting into the void"—making suggestions but having no mechanism to apply them. This circuit is now closed.
[Unreleased] - 2026-01-11
Added
- Insider Veto Protocol (Rule B): Hard-coded safety gate in
trading_graph.pythat blocks ALL buy signals if Net Insider Selling exceeds $50M while the stock is in a technical downtrend (Price < 50 SMA). This prevents "Falling Knife" catches. - Relative Strength Determinism: Upgraded
market_analyst.pyto calculate a mathematicalrisk_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 intrading_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.pyto output a structured JSON block (UPDATE_PARAMETERS) instead of prose advice, enabling future automated parameter optimization. - Gemini 2.0 & 3.0 Support: Updated
cli/utils.pyto supportgemini-2.0-flash,gemini-2.5-flash-lite,gemini-2.5-pro,gemini-3-flash-previewandgemini-3-pro-previewmodels. - Console Debugging: Added explicit console print statements for critical "Smoking Gun" debug traces in
market_analyst.pyandtrading_graph.py.
Changed
- Mandatory Regime Detection: Modified
graph/setup.pyto Force-Execute theMarket Analystnode as the first step in every workflow. This permanently fixes the "UNKNOWN Regime" bug by ensuring context is established before any fundamental analysis begins. - Data Robustness: Patched
y_finance.pyandalpha_vantage_news.pyto accept**kwargsandcurr_date, resolving crashes in theroute_to_vendorpipeline when passing standardized arguments.
Fixed
- Override Logic Mismatches: Fixed critical Enum-to-String type mismatch in
apply_trend_overridethat was silencing the "Safety Valve" logic. - Data Pipeline Failures: Injected robust error handling and type checking in
market_analyst.pyto identify whyRegimeDetectorreceives invalid data (causing "UNKNOWN" regimes). - Gemini 404 Errors: Removed invalid/deprecated model names causing 404s.
- Reflector Regime Integration: Updated
reflection.pyto incorporate market regime context, ensuring post-trade analysis understands the 'Why' behind regime-based decisions.
[Unreleased] - 2026-01-10
Added
- Global Market News: Implemented
get_global_market_newsin Alpha Vantage module to support generic market news (topics: economy_macro, financial_markets), fixing the lack of a primary vendor for global news. - Configurable Embeddings Truncation: Added
EMBEDDING_TRUNCATION_LIMITenv var (default 1000) to prevent413 Payload Too Largeerrors with local models. - Local Embedding Service Support: Added support for Anthropic to use local embedding service via URL
- Anthropic doesn't provide embeddings API, so users can run Hugging Face Text Embeddings Inference (TEI) in Docker
- Configure via
EMBEDDING_API_URLenvironment variable (default:http://localhost:11434/v1) - Configure model via
EMBEDDING_MODELenvironment variable (default:all-MiniLM-L6-v2) - Keeps main application lightweight - heavy dependencies (PyTorch) isolated in separate container
- Environment Variable Configuration: Added comprehensive environment variable support for all LLM providers and embedding configuration
OPENAI_API_URL- Custom OpenAI API endpointANTHROPIC_API_URL- Custom Anthropic API endpointGOOGLE_API_URL- Custom Google API endpointOPENROUTER_API_URL- Custom OpenRouter API endpointOLLAMA_API_URL- Custom Ollama API endpointEMBEDDING_PROVIDER- Choose embedding provider:local,openai,google,ollamaEMBEDDING_API_URL- Custom embedding API endpoint (for Ollama or Docker service)EMBEDDING_MODEL- Custom embedding model name
- Anthropic Claude 4.5 Thinking Models: Added support for latest Anthropic thinking models
claude-sonnet-4-5-thinking- Advanced reasoning with extended thinkingclaude-opus-4-5-thinking- Premier reasoning with extended thinking- Removed older Claude models (3.5, 3.7, 4.0) to focus on latest thinking models
- Documentation: Created comprehensive guides and verification tools
docs/LOCAL_EMBEDDINGS.md- Complete guide for local embeddings setupverify_local_embeddings.py- Verification script for sentence-transformersverify_ollama_embeddings.py- Verification script for Ollama (optional)- Updated
.env.examplewith all new configuration options
Changed
- Dependency Cleanup: Removed
sentence-transformersfromrequirements.txtto keep main application lightweight. - Virtual Environment: Recreated
.venvto ensure a clean state without unused heavy dependencies. - Embedding Architecture: Refactored
tradingagents/agents/utils/memory.pyto support multiple embedding providers with clean separation of concerns- Automatic provider selection based on LLM provider
- Local embeddings as default for Anthropic and Ollama providers
- Maintained backward compatibility with existing API-based embeddings
- CLI Provider Selection: Updated
cli/utils.pyto use environment variables for all LLM provider API URLs with sensible defaults - Configuration Documentation: Enhanced
.env.examplewith detailed comments and examples for all configuration options
Fixed
- Global News Failure: Resolved
RuntimeError: All vendor implementations failedforget_global_newsby correctly mapping Alpha Vantage and implementing the missing fallback logic. - Error Reporting: Improved
interface.pyto propagate detailed error messages from failed vendors to help debugging. - Embedding Crash: Fixed crashes when processing large documents with local embedding models by enforcing strict token limits via truncation.
- Anthropic Embedding Error: Resolved
404 Not Founderror when using Anthropic as LLM provider by implementing automatic fallback to local embeddings (Anthropic doesn't provide an embeddings API)
Technical Debt
- None - All changes follow SOLID principles with proper separation of concerns
[Unreleased] - 2026-01-09
Added
- Blindfire Protocol Activated: Fully integrated
TickerAnonymizerinto all analyst agents (Market,News,Fundamentals,Social) and data tools. The LLM now only sees "ASSET_XXX" in prompts, preventing data contamination. - Anonymization Middleware: Implemented transparent request interception in
core_stock_tools.pyand other tool files to deanonymize inputs and anonymize outputs automatically. - State Persistence: Added auto-persistence to
TickerAnonymizer(ticker_map.json) to ensure consistent ticker mapping across isolated agent and tool instances. - API Key Verification: Added
verify_google_key.pyscript to isolate and verify Google API Key functionality for embeddings. - Environment Management: Added
load_dotenvtocli/main.pyandverify_google_key.pyto ensure.envvariables are correctly loaded. - Start Script Enhancements: Updated
start.shto check forGOOGLE_API_KEYexistence and warn the user. - Debug Logging: Added temporary debug logging (commented out) in
memory.pyfor API key verification.
Fixed
- Embedding Model Error: Fixed
BadRequestError/404 Not Foundwhen using Google (Gemini) provider by explicitly settingtext-embedding-004and using the Google-compatible OpenAI endpoint (generativelanguage.googleapis.com). - Data Fetching Failure: Resolved
RuntimeError: All vendor implementations failed for method 'get_fundamentals'by implementing a fallback toyfinanceintradingagents/dataflows/y_finance.pyand registering it ininterface.py. - Report Saving Crash: Fixed
TypeError: write() argument must be str, not listincli/main.pyby converting structured list content to string before writing to files. - API Rate Limiting: Added
max_retrieshandling (exponential backoff) to bothChatGoogleGenerativeAI(10 retries) andOpenAIembedding client (5 retries). - Import Errors: Fixed
NameError: name 'tool' is not definedby restoringlangchain_coreimports in data tools that were accidentally removed during Blindfire integration. - Payload Size Error: Implemented input truncation (max 9000 chars) in
memory.py. - Display Layer De-Anonymization: Added
deanonymize_texttoTickerAnonymizerand patchedcli/main.pyto reverse-map "ASSET_XXX" to real company names in the final report, effectively resolving "[Company Name]" placeholders for the user while keeping the internal system blind. - Alpaca Integration: Added
tradingagents/dataflows/alpaca.pyto supportget_stock_datavia Alpaca Data API v2. Registered as a vendor option ininterface.pyanddefault_config.py. RequiresALPACA_API_KEYandALPACA_API_SECRETin.env. - CRITICAL FIX: Memory Leak: Implemented
FinancialSituationMemory.clear()andTradingAgentsGraph.reset_memory()to wipe agent context between runs. This prevents hallucinations from bleeding across days in long simulations. - CRITICAL FIX: Blind Logs: Updated
_log_stateto explicitly capturemarket_regimeandregime_metrics, ensuring we can audit decision logic relative to market conditions. - CRITICAL FIX: Crash Prevention: Added guard logic in
propagate()to handle "Dead State" (Rejected Trades) gracefully, preventing crashes whenprocess_signaltries to read non-existent buy prices.
Changed
- LLM Configuration: Updated
tradingagents/default_config.pyandcli/utils.pyto use valid Gemini model names (e.g.,gemini-1.5-flash,gemini-1.5-pro) andgemini-pro. - Vendor Configuration: Updated default
fundamental_datavendor to "alpha_vantage, yfinance" to ensure fallback availability.