Commit Graph

133 Commits

Author SHA1 Message Date
Robin Lindbladh 138c077cc6 fix: stop restoring log_states_dict after portfolio analysis
The log_states_dict is meant to accumulate per-ticker state logs.
Restoring it after propagate_portfolio() was discarding all the
detailed logs generated during the portfolio run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 18:15:27 +01:00
robinsxe 2648f91e09
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 22:52:57 +01:00
robinsxe 59a2212ff7
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 22:44:24 +01:00
Robin Lindbladh 5d09c4c984 fix: gate tracebacks behind debug flag to prevent info leakage
Only include full tracebacks in error messages when debug=True.
In non-debug mode, return clean error messages without internal
implementation details.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:16:03 +01:00
robinsxe 6f5610d82b
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 21:14:42 +01:00
Robin Lindbladh 2ce7e2b6d0 fix: broaden _log_portfolio exception catch to handle all failures
OSError only covers file I/O errors; json.dump can also raise
TypeError on non-serializable data. Use Exception to ensure logging
failures never discard analysis results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:11:49 +01:00
Robin Lindbladh 3abff48c7d fix: protect log file write and preserve log_states_dict
- Wrap _log_portfolio file I/O in try/except so a write failure
  doesn't discard the analysis results
- Preserve and restore self.log_states_dict in propagate_portfolio()
  alongside ticker and curr_state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:10:33 +01:00
Robin Lindbladh 5ac72567be fix: add config parameter to PortfolioAnalyzer constructor
Required by the configurable log directory and config passthrough
from TradingAgentsGraph that were applied via GitHub suggestions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 21:08:14 +01:00
robinsxe f3d49335d1
Update tradingagents/graph/trading_graph.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 21:07:02 +01:00
robinsxe 698b4ede4a
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 21:06:45 +01:00
robinsxe 92b527b60a
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 21:01:35 +01:00
robinsxe 0c4a912b0a
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 21:01:25 +01:00
Robin Lindbladh b3a087286b fix: remove redundant inline traceback import
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:58:18 +01:00
robinsxe 95e10bd1fd
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 20:32:32 +01:00
robinsxe 2466ec3c90
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 20:32:09 +01:00
Robin Lindbladh 85fbc48ede fix: address code review feedback
- Preserve and restore self.ticker and self.curr_state in
  propagate_portfolio() using try/finally to prevent side effects
- Use pathlib.Path for log file construction in _log_portfolio()
- Move traceback import to module level

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:20:46 +01:00
robinsxe dbd2c658e5
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 20:18:30 +01:00
robinsxe 03d7752d46
Update tradingagents/graph/portfolio_analysis.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-24 20:18:14 +01:00
Robin Lindbladh ae2c813d8a feat: add portfolio analysis for multi-stock comparison
Add PortfolioAnalyzer class that runs the full agent pipeline on multiple
stocks and produces a comparative KEEP/REDUCE/EXIT recommendation using
the deep thinking LLM. Includes per-ticker error handling, graceful
degradation on LLM failure, and result logging.

Addresses #60 and partially #406.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:10:21 +01:00
Yijia-Xiao 589b351f2a
TradingAgents v0.2.2 2026-03-22 23:47:56 +00:00
Yijia-Xiao 6c9c9ce1fd
fix: set process-level UTF-8 default for cross-platform consistency 2026-03-22 23:42:37 +00:00
Yijia-Xiao b8b2825783 refactor: standardize portfolio manager, five-tier rating scale, fix analyst status tracking 2026-03-22 23:30:29 +00:00
Yijia-Xiao 318adda0c6 refactor: five-tier rating scale and streamlined agent prompts 2026-03-22 23:07:20 +00:00
Yijia Xiao c3ba3bf428
Merge pull request #413 from CadeYu/codex/exchange-qualified-tickers
fix: preserve exchange-qualified tickers across agent prompts
2026-03-22 15:36:14 -07:00
Yijia-Xiao 7cca9c924e fix: add exponential backoff retry for yfinance rate limits (#426) 2026-03-22 22:11:08 +00:00
Yijia-Xiao bd9b1e5efa feat: add Anthropic effort level support for Claude models
Add effort parameter (high/medium/low) for Claude 4.5+ and 4.6 models,
consistent with OpenAI reasoning_effort and Google thinking_level.
Also add content normalization for Anthropic responses.
2026-03-22 21:57:05 +00:00
Yijia-Xiao 77755f0431 chore: consolidate install, fix CLI portability, normalize LLM responses
- Point requirements.txt to pyproject.toml as single source of truth
- Resolve welcome.txt path relative to module for CLI portability
- Include cli/static files in package build
- Extract shared normalize_content for OpenAI Responses API and
  Gemini 3 list-format responses into base_client.py
- Update README install and CLI usage instructions
2026-03-22 21:38:01 +00:00
Yijia-Xiao 0b13145dc0 fix: handle list content when writing report sections
Closes #400
2026-03-22 20:40:18 +00:00
Yijia-Xiao 3ff28f3559 fix: use OpenAI Responses API for native models
Enable use_responses_api for native OpenAI provider, which supports
reasoning_effort with function tools across all model families.
Removes the UnifiedChatOpenAI subclass workaround.

Closes #403
2026-03-22 20:34:03 +00:00
CadeYu 7d200d834a style: inline single-use instrument context vars 2026-03-21 21:31:38 +08:00
CadeYu 08bfe70a69 fix: preserve exchange-qualified tickers across agent prompts 2026-03-21 21:10:13 +08:00
Yijia Xiao f362a160c3
Merge pull request #379 from yang1002378395-cmyk/fix-ssl-http-client-support
fix: add http_client support for SSL certificate customization
2026-03-15 16:53:04 -07:00
阳虎 64f07671b9 fix: add http_client support for SSL certificate customization
- Add http_client and http_async_client parameters to all LLM clients
- OpenAIClient, GoogleClient, AnthropicClient now support custom httpx clients
- Fixes SSL certificate verification errors on Windows Conda environments
- Users can now pass custom httpx.Client with verify=False or custom certs

Fixes #369
2026-03-16 07:41:20 +08:00
Yijia-Xiao b19c5c18fb docs: add v0.2.1 release note to README 2026-03-15 23:39:05 +00:00
Yijia-Xiao 551fd7f074 chore: update model lists, bump to v0.2.1, fix package build
- OpenAI: add GPT-5.4, GPT-5.4 Pro; remove o-series and legacy GPT-4o
- Anthropic: add Claude Opus 4.6, Sonnet 4.6; remove legacy 4.1/4.0/3.x
- Google: add Gemini 3.1 Pro, 3.1 Flash Lite; remove deprecated
  gemini-3-pro-preview and Gemini 2.0 series
- xAI: clean up model list to match current API
- Simplify UnifiedChatOpenAI GPT-5 temperature handling
- Add missing tradingagents/__init__.py (fixes pip install building)
2026-03-15 23:34:50 +00:00
Yijia-Xiao b0f9d180f9 fix: harden stock data parsing against malformed CSV and NaN values
Add _clean_dataframe() to normalize stock DataFrames before stockstats:
coerce invalid dates/prices, drop rows missing Close, fill price gaps.
Also add on_bad_lines="skip" to all cached CSV reads.
2026-03-15 18:29:43 +00:00
Yijia-Xiao 9cc283ac22 fix: add missing console import to cli/utils.py
Seven error-handling paths used console.print() but console was never
imported, causing NameError on invalid user input.
2026-03-15 18:21:05 +00:00
Yijia-Xiao fe9c8d5d31 fix: handle comma-separated indicators in get_indicators tool
LLMs (especially smaller models) sometimes pass multiple indicator
names as a single comma-separated string instead of making separate
tool calls. Split and process each individually at the tool boundary.
2026-03-15 18:05:36 +00:00
Yijia-Xiao eec6ca4b53 fix: initialize all debate state fields in propagation.py
InvestDebateState was missing bull_history, bear_history, judge_decision.
RiskDebateState was missing aggressive_history, conservative_history,
neutral_history, latest_speaker, judge_decision. This caused KeyError
in _log_state() and reflection, especially with edge-case config values.
2026-03-15 17:54:32 +00:00
Yijia-Xiao 3642f5917c fix: add explicit UTF-8 encoding to all file open() calls
Prevents UnicodeEncodeError on Windows where the default encoding
(cp1252/gbk) cannot handle Unicode characters in LLM output.

Closes #77, closes #114, closes #126, closes #215, closes #332
2026-03-15 16:44:23 +00:00
makk9 907bc8022a
fix: pass debate round config to ConditionalLogic (#361)
* fix: pass max_debate_rounds and max_risk_discuss_rounds config to ConditionalLogic

* use config values
2026-03-15 09:31:59 -07:00
Yijia-Xiao 8a60662070 chore: remove unused chainlit dependency (CVE-2026-22218) 2026-03-15 16:16:42 +00: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