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>
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>
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>
- 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>
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>
- 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>
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>
Apply review suggestions: use concise `or` pattern for API key
resolution, consolidate tests into parameterized subTest, move
import to module level per PEP 8.
GoogleClient now accepts the unified `api_key` parameter used by
OpenAI and Anthropic clients, mapping it to the provider-specific
`google_api_key` that ChatGoogleGenerativeAI expects. Legacy
`google_api_key` still works for backward compatibility.
Resolves TODO.md item #2 (inconsistent parameter handling).