Commit Graph

15 Commits

Author SHA1 Message Date
Joseph O'Brien 1db81e1fc6 feat: integrate database persistence with TradingAgentsGraph
Add database services layer with AnalysisService, TradingService, and DiscoveryService
for persisting analysis sessions, trading decisions, and discovery runs.

Integration with TradingAgentsGraph:
- Add config options: database_enabled, database_path
- Persist analysis state to database in _log_state when enabled
- Persist discovery results to database when enabled
- Save analyst reports, debates, and trading decisions

Database integration is opt-in via config setting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 11:31:21 -05:00
Joseph O'Brien c39f9aab36 Add pre-commit hooks and ruff code quality configuration
- Add .pre-commit-config.yaml with trailing whitespace, ruff linter/formatter
- Configure ruff in pyproject.toml with selected rules (E, F, W, I, UP, B, C4, SIM)
- Add F401 to unfixable to preserve re-exported imports in __init__.py files
- Fix BacktestMetrics import in backtesting/engine.py
- Update todos.md with enhanced trade discovery and database implementation tasks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 11:22:13 -05:00
Joseph O'Brien 85992fc05b chore: remove unused imports across codebase
Removed unused imports from 36 files including:
- Unused stdlib imports (json, time, re, os, signal, etc.)
- Unused typing imports (List, Dict, Optional, Tuple, Sequence, etc.)
- Unused langchain imports (AIMessage, ChatOpenAI, etc.)
- Unused langgraph imports (END, StateGraph, START, ToolNode, etc.)
- Unused project imports (DataLoader, get_config, parse_date, etc.)

Preserved intentional re-exports in:
- tradingagents/agents/utils/agent_utils.py (re-exports tool functions)
- tradingagents/dataflows/alpha_vantage.py (re-exports submodule functions)
- All __init__.py files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 04:44:37 -05:00
Joseph O'Brien b8be981bc8 feat: add type hints to function signatures across codebase
Added return type hints and parameter type hints to functions in:
- tradingagents/graph/trading_graph.py
- tradingagents/graph/reflection.py
- tradingagents/dataflows/y_finance.py
- tradingagents/dataflows/local.py
- tradingagents/backtesting/engine.py
- cli/analysis.py, cli/discovery.py, cli/display.py, cli/state.py, cli/backtest_cmd.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 03:50:49 -05:00
Joseph O'Brien 9c252fdc2c refactor: consolidate configuration management with Pydantic-based settings
- Add tradingagents/config.py with TradingAgentsSettings Pydantic model
- Centralize all environment variable handling and API key management
- Add validation for log_level, llm_provider, and numeric bounds
- Update dataflows/config.py to use central config as backend
- Update logging.py to get settings from central config
- Update API key access in alpha_vantage, brave, and tavily modules
- Replace DEFAULT_CONFIG imports with get_config() calls
- Add 20 comprehensive tests for config module

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 03:20:41 -05:00
Joseph O'Brien e862c4f803 feat: add centralized input validation for ticker symbols and dates
- Create tradingagents/validation.py with comprehensive validation functions:
  - validate_ticker/validate_tickers for ticker symbol validation
  - validate_date/validate_date_range for date validation
  - parse_date for flexible date parsing (multiple formats)
  - Helper functions: is_valid_ticker, is_valid_date, is_trading_day
  - get_previous_trading_day, get_next_trading_day utilities
- Add validation to y_finance.py (get_YFin_data_online, get_stock_stats_indicators_window)
- Add validation to trading_graph.py propagate method
- Create comprehensive test suite (55 tests) in tests/test_validation.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 03:09:05 -05:00
Joseph O'Brien f70874982a feat: add backtesting framework and fix code quality issues
- Add complete backtesting engine with portfolio simulation, metrics calculation
  (Sharpe, Sortino, max drawdown), and agent integration
- Add Pydantic data models for market data, trading, portfolio, and backtest results
- Add backtest CLI command with SMA, RSI, and hold strategies
- Fix 24+ bare exception handlers with specific exception types
- Fix hardcoded path in default_config.py (use TRADINGAGENTS_DATA_DIR env var)
- Fix unclosed file handle in local.py with context manager
- Disable store=True in OpenAI API calls for data privacy
- Fix typo: rename aggresive_debator.py to aggressive_debator.py
- Add request timeouts (30s) to alpha_vantage_common.py and googlenews_utils.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 02:55:28 -05:00
Joseph O'Brien 80e8fb0eee feat: add centralized logging module with dual output support
Add tradingagents/logging.py with JSONFormatter for structured file logs
and RichHandler for colored console output. Migrate 59 print statements
across 13 files to proper logger calls. Configure via environment
variables (TRADINGAGENTS_LOG_LEVEL, etc.) with default_config fallback.

- Rotating file handler: 10MB max, 5 backups to logs/tradingagents.log
- Rich console handler with tracebacks for development
- Logger hierarchy follows module paths (tradingagents.dataflows.*, etc.)
- 20 feature-specific tests covering core, config, migration, integration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 02:11:29 -05:00
Joseph O'Brien 3c85b21e0b Improve CLI with loading indicators and enhance discovery pipeline
- Add MultiStageLoader and LoadingIndicator classes to cli/utils.py
- Improve CLI main.py with explicit imports and UI enhancements
- Update entity_extractor.py with improved LLM provider handling
- Add Ollama embedding model configuration to memory.py
- Add get_bulk_news_alpha_vantage function to alpha_vantage_news.py
- Add discovery imports to trading_graph.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 00:49:49 -05:00
Joseph O'Brien 3f6b1e9f39 Add trending stock discovery feature
Implement a multi-stage pipeline to discover trending stocks from news:
- Entity extraction from news articles using LLM
- Stock ticker resolution via Yahoo Finance
- Sector classification and event categorization
- Scoring algorithm based on mentions, sentiment, and recency
- CLI integration with interactive stock selection and analysis flow
- Persistence layer for saving discovery results
- Comprehensive test suite for all discovery components

Update README with uv-based installation instructions and remove emojis.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:19:34 -05:00
luohy15 a6734d71bc WIP 2025-09-26 16:17:50 +08:00
mirza-samad-ahmed-baig f704828f89 Fix: Prevent infinite loops, enable reflection, and improve logging 2025-07-03 17:43:40 +05:00
Edward Sun da84ef43aa main works, cli bugs 2025-06-15 22:20:59 -07:00
maxer137 99789f9cd1 Add support for other backends, such as OpenRouter and olama
This aims to offer alternative OpenAI capable api's.
This offers people to experiment with running the application locally
2025-06-11 14:19:25 +02:00
Yijia-Xiao cc97cb6d5d chore(release): v0.1.0 – initial public release of TradingAgents 2025-06-05 04:27:57 -07:00