Commit Graph

112 Commits

Author SHA1 Message Date
dtarkent2-sys 563970ade8 Add back typer, rich, python-dotenv — required by cli/main.py imports
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 03:29:57 +00:00
dtarkent2-sys e0ed485098 Fix .dockerignore: don't exclude requirements.txt
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 03:22:31 +00:00
dtarkent2-sys 3ac1c5ad3d Harden security, fix memory leak, clean up deps
- Add API key auth (AGENTS_API_KEY env var) on /analyze endpoints
- Add CORS_ORIGINS env var instead of hardcoded wildcard
- Add memory cleanup (30min TTL) and concurrency semaphore (max 3)
- Add 10-minute analysis timeout
- Fix ticker validation (alphanumeric check)
- Remove unused deps (redis, backtrader, parsel, rich, typer, questionary)
- Fix pyproject.toml: replace chainlit with actual FastAPI deps
- Add .dockerignore, add eval_results/ to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 03:17:11 +00:00
dtarkent2-sys ba39a81e82 Fix parallel research/risk: use async+asyncio.gather instead of ThreadPoolExecutor
Sync ThreadPoolExecutor doesn't truly parallelize inside LangGraph nodes.
Switched to async functions with asyncio.to_thread() + asyncio.gather() —
the same pattern that works for the parallel analyst node.

Result: Research (Bull+Bear) and Risk (Agg+Con+Neu) now run concurrently.
Total analysis time reduced from ~450s to ~280s (~38% faster).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:01:54 +00:00
dtarkent2-sys 12e0d507c2 Switch parallel timing logs from logger.info to print for Railway visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:18:46 +00:00
dtarkent2-sys 2484bd89e4 Switch parallel research/risk to sync ThreadPoolExecutor with timing logs
Use sync functions with pool.submit() instead of async+run_in_executor
to avoid potential asyncio event-loop interaction issues with LangGraph.
Added timing logs to diagnose parallelism.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:39:25 +00:00
dtarkent2-sys 7ff05328a8 Fix parallel research/risk: snapshot state to avoid proxy serialization
LangGraph state proxies serialize concurrent dict access, forcing
threads to run sequentially. Fix by snapshotting needed fields into
plain dicts before dispatching to ThreadPoolExecutor — same pattern
used by the working parallel analysts node.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:18:43 +00:00
dtarkent2-sys 3cd0c19b35 Parallelize research & risk debate stages for ~25% faster analysis
Run Bull+Bear researchers concurrently and all 3 risk analysts
(Aggressive/Conservative/Neutral) concurrently instead of sequentially.
With max_debate_rounds=1, there's no back-and-forth so parallel execution
is safe. Sequential mode is completely unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:45:59 +00:00
dtarkent2-sys aa654c9425 Emit final agent_update events so all dots turn green at completion
The final decision block set all agents to "completed" in buf but never
emitted agent_update SSE events for them. This left Risk stage dots as
cyan (active) and Decision dot as gray on the UI. Now emits agent_update
for any agents not yet shown as completed before the decision event.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:53:03 +00:00
dtarkent2-sys 67463a2b99 Fix agent status reset bug in stream_mode=values
With stream_mode="values", each chunk contains the full accumulated state.
The debate and risk sections were checking data fields (bull/bear history,
aggressive/conservative/neutral history) without guarding against re-processing,
causing completed agents to be reset to "in_progress" on every subsequent
chunk. This made agent and report counts appear stuck at 5/12 and 4/7.

Fix: move the _emitted flag guard to the outer if-block so the entire
section is skipped once its event has been emitted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:50:32 +00:00
dtarkent2-sys 47771849ca Clean up debug logging and fix reports count
Remove verbose debug prints added during parallel analysts development.
Fix reports showing 4/7 by updating buf.report_sections for investment_plan,
trader_investment_plan, and final_trade_decision (previously only analyst
reports were tracked).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:41:01 +00:00
dtarkent2-sys 05b319c101 debug: add chunk-level logging in stream loop 2026-02-20 11:26:37 +00:00
dtarkent2-sys 64defb3939 debug: add logging to trace analysis execution 2026-02-20 11:19:35 +00:00
dtarkent2-sys 223879bc04 feat: parallelize analyst agents for ~3x speedup
Run all 4 analysts (Market, Social, News, Fundamentals) concurrently
using asyncio.gather instead of sequentially. Each analyst gets its own
isolated message state and tool-calling loop. Cuts analyst phase from
~8-9 min to ~2-3 min (total analysis from ~11 min to ~4-5 min).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:13:16 +00:00
dtarkent2-sys f5519b9efe fix: add SSE replay buffer + fix research agent status tracking
- Replace global update_research_team_status() with local buf calls
  (was updating CLI's global buffer, not analysis-specific one)
- Add replay buffer: all events stored in memory per analysis
- Support ?last_event=N query param for reconnection replay
- Send event IDs so browser can track position
- Mark analysis as done so replay works after completion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 03:48:22 +00:00
dtarkent2-sys 777226722a fix: add SSE heartbeat to prevent Railway proxy timeout
Railway kills idle connections after ~30s. During long LLM calls
between agent stages, the SSE stream goes silent and gets dropped.
Now sends heartbeat events every 15s to keep the connection alive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 03:25:53 +00:00
dtarkent2-sys 1ded94388e Fix healthcheck path to /health for FastAPI 2026-02-20 03:17:55 +00:00
dtarkent2-sys 52228414ed Replace Chainlit with FastAPI SSE backend
Swap Chainlit chatbot UI for a minimal FastAPI service with:
- POST /analyze to start analysis
- GET /analyze/{id}/stream for SSE progress events
- GET /health for Railway healthcheck

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:43:24 +00:00
dtarkent2-sys ac782d179d feat: rebuild Chainlit UI to match CLI experience
Replaces the barebones web UI with one that mirrors the CLI:
- Agent status table with team/agent/status tracking
- Reuses CLI's MessageBuffer, update_analyst_statuses, classify_message_type
- Shows full debate transcripts (Bull/Bear, Risk team)
- Live stats (LLM calls, tokens, elapsed time)
- Collapsible Steps for each phase with full report content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:04:13 +00:00
dtarkent2-sys 76f1e0abf0 fix: use correct Claude model ID (claude-sonnet-4-6)
The old model ID claude-sonnet-4-5-20241022 returns 404. Updated to
the current claude-sonnet-4-6 for the deep thinking model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 01:52:46 +00:00
dtarkent2-sys 979ceeb89a fix: remove outdated Chainlit config, let it auto-generate
Chainlit 2.9.6 rejects the manually-created config.toml as outdated.
Let it generate its own at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:57:02 +00:00
dtarkent2-sys eade96f1c9 feat: add Chainlit web UI + Dockerfile for Railway deployment
Adds a Chainlit-based web interface that wraps TradingAgentsGraph,
streaming analyst reports, research debates, and final decisions
to the browser in real-time. Configured for Anthropic Claude models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:52:45 +00:00
dtarkent2-sys 48ef57715e docs: add Chainlit web UI design for Railway deployment
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:41:46 +00:00
Yijia Xiao 5fec171a1e
chore: add build-system config and update version to 0.2.0 2026-02-07 08:26:51 +00:00
Yijia Xiao 50c82a25b5
chore: consolidate dependencies to pyproject.toml, remove setup.py 2026-02-07 08:18:46 +00:00
Yijia Xiao 8b3068d091
Merge pull request #335 from RinZ27/security/patch-langchain-core-vulnerability
security: Patch LangGrinch vulnerability (CVE-2025-68664) (#335)
2026-02-07 00:04:44 -08:00
RinZ27 66a02b3193
security: patch LangGrinch vulnerability in langchain-core 2026-02-05 11:01:53 +07:00
Yijia Xiao e9470b69c4
TradingAgents v0.2.0: Multi-Provider LLM Support & Optimizations (#331)
Release v0.2.0: Multi-Provider LLM Support
2026-02-03 23:13:43 -08:00
Yijia Xiao b4b133eb2d
fix: add typer dependency 2026-02-04 00:39:15 +00:00
Yijia Xiao 80aab35119
docs: update README for v0.2.0 release
- TradingAgents v0.2.0 release
- Trading-R1 announcement
- Multi-provider LLM documentation
2026-02-04 00:13:10 +00:00
Yijia Xiao 393d4c6a1b
chore: add data_cache to .gitignore 2026-02-03 23:30:55 +00:00
Yijia Xiao aba1880c8c
chore: update .gitignore to official Python template 2026-02-03 23:16:38 +00:00
Yijia Xiao 6cd35179fa
chore: clean up dependencies and fix Ollama auth
- Remove unused packages: praw, feedparser, eodhd, akshare, tushare, finnhub
- Fix Ollama requiring API key
2026-02-03 23:08:12 +00:00
Yijia Xiao 102b026d23
refactor: clean up codebase and streamline documentation
- Remove debug prints from vendor routing (interface.py)
- Simplify vendor fallback to only handle rate limits
- Reorder CLI provider menu: OpenAI, Google, Anthropic, xAI, OpenRouter, Ollama
- Remove dead files: local.py, reddit_utils.py, openai.py, google.py, googlenews_utils.py, yfin_utils.py
2026-02-03 22:27:20 +00:00
Yijia Xiao 224941d8c2
feat: add post-analysis report saving and fix display truncation
- Add save prompt after analysis with organized subfolder structure
- Fix report truncation by using sequential panels instead of Columns
- Add optional full report display prompt
2026-02-03 22:27:20 +00:00
Yijia Xiao 93b87d5119
fix: analyst status tracking and message deduplication
- Add update_analyst_statuses() for unified status logic (pending/in_progress/completed)
- Normalize analyst selection to predefined ANALYST_ORDER for consistent execution
- Add message deduplication to prevent duplicates from stream_mode=values
- Restructure streaming loop so state handlers run on every chunk
2026-02-03 22:27:20 +00:00
Yijia Xiao 54cdb146d0
feat: add footer statistics tracking with LangChain callbacks
- Add StatsCallbackHandler for tracking LLM calls, tool calls, and tokens
- Integrate callbacks into TradingAgentsGraph and all LLM clients
- Dynamic agent/report counts based on selected analysts
- Fix report completion counting (tied to agent completion)
2026-02-03 22:27:20 +00:00
Yijia Xiao b06936f420
fix: improve data vendor implementations and tool signatures
- Add get_global_news for Alpha Vantage
- Fix get_insider_transactions signature (remove unused curr_date param)
- Remove unnecessary default params from API calls (sort, limit, tab)
2026-02-03 22:27:20 +00:00
Yijia Xiao b75940e901
feat: add announcements panel fetching from api.tauric.ai/v1/announcements 2026-02-03 22:27:20 +00:00
Yijia Xiao 3d040f8da4
feat: add yfinance support to accommodate community request for stability and quota 2026-02-03 22:27:20 +00:00
Yijia Xiao 50961b2477
refactor: rename risky/safe agents to aggressive/conservative 2026-02-03 22:27:20 +00:00
Yijia Xiao a3761bdd66
feat: update Ollama and OpenRouter model options
- Ollama: Add Qwen3 (8B), GPT-OSS (20B), GLM-4.7-Flash (30B)
- OpenRouter: Add NVIDIA Nemotron 3 Nano, Z.AI GLM 4.5 Air
- Add explicit Ollama provider handling in OpenAI client for consistency
2026-02-03 22:27:20 +00:00
Yijia Xiao d4dadb82fc
feat: add multi-provider LLM support with thinking configurations
Models added:
- OpenAI: GPT-5.2, GPT-5.1, GPT-5, GPT-5 Mini, GPT-5 Nano, GPT-4.1
- Anthropic: Claude Opus 4.5/4.1, Claude Sonnet 4.5/4, Claude Haiku 4.5
- Google: Gemini 3 Pro/Flash, Gemini 2.5 Flash/Flash Lite
- xAI: Grok 4, Grok 4.1 Fast (Reasoning/Non-Reasoning)

Configs updated:
- Add unified thinking_level for Gemini (maps to thinking_level for Gemini 3,
  thinking_budget for Gemini 2.5; handles Pro's lack of "minimal" support)
- Add OpenAI reasoning_effort configuration
- Add NormalizedChatGoogleGenerativeAI for consistent response handling

Fixes:
- Fix Bull/Bear researcher display truncation
- Replace ChromaDB with BM25 for memory retrieval
2026-02-03 22:27:20 +00:00
Yijia Xiao 79051580b8
feat: add multi-provider LLM support with factory pattern
- Add tradingagents/llm_clients/ with unified factory pattern
- Support OpenAI, Anthropic, Google, xAI, OpenRouter, Ollama, vLLM
- Replace direct LLM imports in trading_graph.py with create_llm_client()
- Handle provider-specific params (reasoning_effort, thinking_config)
2026-02-03 22:27:20 +00:00
Edward Sun 13b826a31d
Merge pull request #245 from TauricResearch/feat/tooloptim
Y Finance Tools Optimizations
2025-10-09 00:34:10 -07:00
Edward Sun b2ef960da7 updated readme 2025-10-09 00:32:04 -07:00
Edward Sun a5dcc7da45 update readme 2025-10-06 20:33:12 -07:00
Edward Sun 7bb2941b07 optimized yfin fetching to be much faster 2025-10-06 19:58:01 -07:00
Yijia Xiao 32be17c606
Merge pull request #235 from luohy15/data_vendor
Add Alpha Vantage API Integration and Refactor Data Provider Architecture
2025-10-05 16:01:30 -07:00
Edward Sun c07dcf026b added fallbacks for tools 2025-10-03 22:40:09 -07:00