Commit Graph

215 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 8abd9dbd27 Merge branch 'main' of https://github.com/aguzererler/TradingAgents into copilot/add-integration-tests-y-finance-alpha-vantage 2026-03-17 15:33:17 +00:00
ahmet guzererler dc27874930
Merge pull request #9 from aguzererler/copilot/fix-allow-env-variables-override-config
fix: allow .env variables to override DEFAULT_CONFIG values
2026-03-17 16:14:14 +01:00
copilot-swe-agent[bot] 373a03d744 docs: update PROGRESS, DECISIONS, MISTAKES, CLAUDE with env override implementation
- PROGRESS.md: added env override milestone, updated test count (38 total),
  marked Mistake #9 as resolved, added all new/modified files from PR #9
- DECISIONS.md: added Decision 008 (env var config overrides),
  Decision 009 (thread-safe rate limiter), Decision 010 (broader
  vendor fallback exceptions), updated Decision 007 status to superseded
- MISTAKES.md: updated Mistake #9 status to RESOLVED, added Mistake #10
  (rate limiter held lock during sleep)
- CLAUDE.md: added env var override convention docs, updated critical
  patterns with rate limiter and config fallback key lessons, updated
  mistake count to 10

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-17 14:37:41 +00:00
copilot-swe-agent[bot] 15e87c7688 fix: move rate limiter sleep outside lock to avoid blocking threads
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-17 14:27:08 +00:00
copilot-swe-agent[bot] 2193ff3fa1 fix: allow .env variables to override DEFAULT_CONFIG values
Merged origin/main and resolved all 8 conflicting files:
- CLAUDE.md: merged MISTAKES.md ref + Project Tracking section + env override docs
- cli/main.py: kept top-level json import, kept try/except in run_pipeline
- tool_runner.py: kept descriptive comments for MAX_TOOL_ROUNDS
- alpha_vantage_common.py: kept thread-safe rate limiter, robust error handling
- interface.py: kept broader exception catch (AlphaVantageError + ConnectionError + TimeoutError)
- default_config.py: kept _env()/_env_int() env var overrides with load_dotenv() at module level
- scanner_graph.py: kept debug mode fix (stream for debug, invoke for result)
- macro_bridge.py: kept get_running_loop() over deprecated get_event_loop()

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-17 14:25:10 +00:00
copilot-swe-agent[bot] 9ac773a69d Initial plan 2026-03-17 14:12:49 +00:00
ahmet guzererler e448e06b4a
Merge pull request #7 from aguzererler/claude/youthful-hofstadter 2026-03-17 14:40:47 +01:00
Ahmet Guzererler f0e1070234 Merge origin/main, resolve conflicts keeping PR branch changes
All 6 conflicts resolved by keeping this branch's implementations:
- alpha_vantage_scanner.py, interface.py, yfinance_scanner.py (data layer)
- scanner_graph.py, scanner_setup.py (graph orchestration)
- test_scanner_graph.py (deleted — replaced by focused test files)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 08:54:50 +01:00
Ahmet Guzererler 61668fed6b feat: Complete 3-phase LLM scanner pipeline with inline tool execution
The scanner pipeline now runs end-to-end: Phase 1 (geopolitical, market
movers, sector scanners in parallel via Ollama), Phase 2 (industry deep
dive), Phase 3 (macro synthesis via OpenRouter/DeepSeek R1).

Key changes:
- Add tool_runner.py with run_tool_loop() for inline tool execution in
  scanner agents (scanner graph has no ToolNode, unlike trading graph)
- Fix vendor fallback: catch AlphaVantageError base class, raise on
  total failure instead of embedding errors in return values
- Rewrite yfinance sector perf to use SPDR ETF proxies (Sector.overview
  has no performance data)
- Fix Ollama remote host support in openai_client.py
- Add LangGraph state reducers for parallel fan-out writes
- Add --date CLI flag for non-interactive scanner invocation
- Fix .env loading to find keys from both CWD and project root
- Add hybrid LLM config (per-tier provider/backend_url)
- Add project tracking: DECISIONS.md, PROGRESS.md, MISTAKES.md
- Add 9 new test files covering exceptions, fallback, and routing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 08:41:40 +01:00
copilot-swe-agent[bot] 9389cf1303 Add integration tests for yfinance and Alpha Vantage APIs (78 tests, all passing)
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-15 14:13:02 +00:00
copilot-swe-agent[bot] 79f3ce7edd Initial plan 2026-03-15 14:05:17 +00:00
ahmet guzererler d56711a825
Merge pull request #5 from aguzererler/copilot/check-pr3-implementation
Port missing PR#3 implementations to main: MacroScannerGraph, scanner_setup, exception handling
2026-03-15 13:32:51 +01:00
copilot-swe-agent[bot] 348b17841b feat: implement missing features from PR#3 - MacroScannerGraph, fixed scanner_setup, improved exception handling
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-15 12:23:46 +00:00
copilot-swe-agent[bot] afc017f17f Initial plan 2026-03-15 12:16:05 +00:00
ahmet guzererler 08575188c3
Merge pull request #4 from aguzererler/copilot/review-last-commit
Address review feedback on Global Macro Scanner (PR #2)
2026-03-15 13:14:54 +01:00
ahmet guzererler 99a3bafc79
Merge pull request #2 from aguzererler/feature/global-macro-scanner
feat: Add Global Macro Scanner feature
2026-03-15 13:14:39 +01:00
copilot-swe-agent[bot] 44d13b6924 Implement all review feedback for Global Macro Scanner: fix exception handling, index fetching efficiency, conditional logic, CLI DRY, error prefixes, remove artifacts
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-15 10:43:26 +00:00
copilot-swe-agent[bot] edfb49d2b1 Merge branch 'feature/global-macro-scanner' of https://github.com/aguzererler/TradingAgents into copilot/review-last-commit 2026-03-15 10:38:35 +00:00
copilot-swe-agent[bot] db2210b5cc Initial plan 2026-03-15 10:37:03 +00:00
Ahmet Guzererler 7c95188bf0 Add comprehensive end-to-end tests and market analysis results for March 15, 2026
- Created new files for industry performance, market indices, market movers, sector performance, and topic news.
- Implemented end-to-end tests for scanner functionality, ensuring all tools return expected data formats and can save results to files.
- Added integration tests to verify scanner tools work seamlessly with the CLI scan command.
- Enhanced test coverage for individual scanner tools, validating output structure and content.

## Summary
The changes refactor the scanner tool invocation to use LangChain's StructuredTool `.invoke()` method consistently across the codebase. This includes updating the CLI scan command, rewriting tests to use the new invocation pattern, and correcting yfinance screener key mappings. The changes also add comprehensive end-to-end test suites for scanner functionality.

## Issues Found
| Severity | File:Line | Issue |
|----------|-----------|-------|
| WARNING | cli/main.py:1193-1218 | Inconsistent error handling - some tools check for "Error" prefix while others check for "No data" prefix, but the actual error messages from yfinance_scanner.py use different formats |
| WARNING | tradingagents/dataflows/yfinance_scanner.py:34 | The condition `if not data or 'quotes' not in data:` may not catch all error cases - yfinance screener can return empty data structures that evaluate to False but don't contain 'quotes' key |
| SUGGESTION | tests/test_scanner_tools.py:38-46 | Test could be more robust by checking for actual data content rather than just headers |
| SUGGESTION | cli/main.py:1193-1218 | Consider extracting the scanner tool invocation pattern into a helper function to reduce duplication |

## Detailed Findings

### File: cli/main.py:1193-1218
- **Confidence:** 85%
- **Problem:** The error handling checks for different prefixes ("Error" vs "No data") but the actual functions in yfinance_scanner.py return error messages with different formats (e.g., "Error fetching market movers for..."). This inconsistency could lead to improper error handling where error results are still saved to files.
- **Suggestion:** Standardize error checking by creating a helper function that checks if a result indicates an error, or modify the yfinance_scanner functions to return consistent error prefixes.

### File: tradingagents/dataflows/yfinance_scanner.py:34
- **Confidence:** 80%
- **Problem:** The condition `if not data or 'quotes' not in data:` assumes that if data exists, it will contain a 'quotes' key. However, yfinance screener might return data in different formats or empty objects that don't contain this key, leading to potential KeyError exceptions.
- **Suggestion:** Add more robust checking: `if not data or not isinstance(data, dict) or 'quotes' not in data:` to prevent attribute errors.

### File: tests/test_scanner_tools.py:38-46
- **Confidence:** 75%
- **Problem:** The test for market movers only checks that the result contains the expected header but doesn't verify that actual financial data is present in the table rows.
- **Suggestion:** Enhance the test to verify that data rows are present (e.g., check for table rows with actual data, not just headers).

### File: cli/main.py:1193-1218
- **Confidence:** 70%
- **Problem:** The scanner tool invocation pattern is repeated 5 times with only minor variations in arguments, violating the DRY principle.
- **Suggestion:** Extract this pattern into a helper function like `invoke_scanner_tool(tool, args, filename)` to reduce code duplication and improve maintainability.

## Recommendation
**APPROVE WITH SUGGESTIONS**

The changes are fundamentally sound and improve code consistency by standardizing on the StructuredTool `.invoke()` interface. The added test coverage is excellent. Addressing the minor issues noted above would further improve robustness and maintainability.
2026-03-15 11:34:54 +01:00
Ahmet Guzererler 6242af3b99 feat: Add Global Macro Scanner feature
- Added market-wide analysis capabilities (movers, indices, sectors, industries, topic news)
- Implemented yfinance and Alpha Vantage data fetching modules
- Added LangChain tools for scanner functions
- Created scanner state definitions and graph components
- Integrated scan command into CLI
- Added configuration for scanner_data vendor routing
- Included test files for scanner components

This implements a new feature for global macro scanning to identify market-wide trends and opportunities.
2026-03-14 22:22:13 +01:00
Ahmet Guzererler 405f969bd6 agents and plan 2026-03-14 12:18:13 +01:00
ahmet guzererler 7ef012f3ae
Merge pull request #1 from aguzererler/claude/heuristic-knuth
feat(cli): three-tier LLM provider setup with dynamic Ollama model listing
2026-03-13 14:35:49 +01:00
ahmet c471db80e1 feat(cli): add three-tier LLM provider setup with dynamic Ollama model listing
- Add quick/mid/deep thinking tiers, each with independent provider selection
- Fetch available Ollama models dynamically via /api/tags instead of hardcoded list
- Add mid-thinking agent selection (select_mid_thinking_agent)
- Support provider-specific thinking config (Gemini thinking level, OpenAI reasoning effort)
- Update default_config and trading_graph to wire three-tier LLM setup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 13:20:50 +01:00
Yijia Xiao f047f26df0
Merge pull request #341 from Ljx-007/fix/risk-manager-fundamental-report
fix(risk_manager): use correct state key for fundamentals report
2026-02-24 16:28:56 -08:00
Ljx-007 35856ff33e fix(risk_manager): 修复基本面报告数据源错误
- 修正了fundamentals_report从news_report获取数据的问题
- 确保fundamentals_report正确使用fundamentals_report数据源
2026-02-09 18:21:21 +08: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