Commit Graph

95 Commits

Author SHA1 Message Date
Andrew Kaszubski bdff87a571 feat(agents): add Macro Analyst with FRED interpretation - Fixes #14
Implements Macro Analyst agent for economic regime detection and FRED data
interpretation. The agent analyzes macroeconomic indicators to identify
market regimes and provide investment implications.

Features:
- Economic regime detection (expansion, contraction, goldilocks, stagflation)
- Yield curve analysis (normal, inverted, flat, steep)
- Monetary policy stance classification (hawkish, dovish, neutral, emergency)
- Inflation regime tracking (deflation, low, target, elevated, high)
- Recession probability calculation based on yield curve inversions
- Real rate analysis for policy restrictiveness

Tools:
- get_economic_regime_analysis: GDP, unemployment, inflation regime detection
- get_yield_curve_analysis: 2Y-10Y spread analysis with recession probability
- get_monetary_policy_analysis: Fed policy stance interpretation
- get_inflation_regime_analysis: CPI/PCE trajectory and asset implications

Tests: 57 unit tests covering all classification logic, edge cases, and
integration scenarios.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 17:23:30 +11:00
Andrew Kaszubski 8522b4bd53 feat(agents): add Momentum Analyst with multi-TF analysis - Fixes #13
Implements specialized Momentum Analyst agent with:
- Multi-timeframe ROC (Rate of Change) analysis across periods
- ADX (Average Directional Index) trend strength measurement
- RSI momentum divergence detection for reversal signals
- create_momentum_analyst factory for LangChain integration

Tests: 47 unit tests covering ROC, ADX, RSI, divergence detection

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 17:12:01 +11:00
Andrew Kaszubski ae7899a6fc feat(dataflows): add data caching layer with rate limit awareness - Fixes #12
Implements [DATA-11] Data caching layer - FRED rate limits with:
- CacheEntry: Generic cache entries with TTL and metadata
- CacheStats: Hit/miss/stale statistics tracking
- RateLimitState: Per-source rate limit tracking with exponential backoff
- MemoryCache: In-memory LRU cache backend
- FileCache: File-based JSON cache backend
- DataCache: Main cache with source-specific TTLs and stale-while-rate-limited
- @cached decorator: Function result caching

Features:
- Multi-backend support (memory, file)
- TTL-based expiration with configurable per-source defaults
- Stale-while-revalidate when rate limited
- Thread-safe operations throughout
- 41 tests covering all components

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 16:51:48 +11:00
Andrew Kaszubski 2c802647e4 feat(dataflows): add vendor registry pattern for extensible data vendor routing - Fixes #11
Implements [DATA-10] Interface routing - add new data vendors with:
- VendorRegistry: Thread-safe singleton for centralized vendor registration
- VendorCapability enum: STOCK_DATA, FUNDAMENTALS, NEWS, MACROECONOMIC, etc.
- BaseVendor ABC: 3-stage lifecycle (transform_query, extract_data, transform_data)
- SimpleVendor: Wrapper for migrating existing vendor functions
- Decorators: @register_vendor, @vendor_method, @rate_limited, @with_retry, @cache_result
- RateLimiter: Thread-safe sliding window rate limiting
- 84 tests covering registry, base vendor, and decorators

Files:
- tradingagents/dataflows/vendor_registry.py (253 lines)
- tradingagents/dataflows/base_vendor.py (222 lines)
- tradingagents/dataflows/vendor_decorators.py (188 lines)
- tests/unit/dataflows/test_vendor_registry.py (30 tests)
- tests/unit/dataflows/test_base_vendor.py (27 tests)
- tests/unit/dataflows/test_vendor_decorators.py (27 tests)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 16:47:41 +11:00
Andrew Kaszubski bbd85c91b6 feat(dataflows): add benchmark data module with SPY, sector ETFs, RS, correlation, beta - Fixes #10 2025-12-26 16:14:57 +11:00
Andrew Kaszubski 19171a4b31 feat(dataflows): add multi-timeframe OHLCV aggregation - Fixes #9 2025-12-26 15:48:40 +11:00
Andrew Kaszubski 4d693fb331 feat(dataflows): add FRED API integration for economic data - Fixes #8 2025-12-26 15:25:54 +11:00
Andrew Kaszubski 68be12c451 feat(db): fix Alembic migrations and add documentation (#7) - SQLite batch mode for constraints, migrations README 2025-12-26 14:50:09 +11:00
Andrew Kaszubski 1ea006e41f feat(db): add Trade model with CGT tracking and Australian FY support (#6) - TradeSide/TradeStatus/TradeOrderType enums, 50% discount for >12mo holdings, multi-currency FX, 87 tests 2025-12-26 14:46:06 +11:00
Andrew Kaszubski 1c6c2fadf1 feat(db): add Settings model with risk profiles and alert preferences (#5) - Implements RiskProfile enum, risk parameters, JSON alert_preferences, one-to-one User relationship, CheckConstraints, cascade delete, 43 tests 2025-12-26 14:16:42 +11:00
Andrew Kaszubski 0d09f15bd6 feat(db): add Portfolio model with LIVE/PAPER/BACKTEST types - Fixes #4 2025-12-26 13:46:39 +11:00
Andrew Kaszubski d3892b0da9 feat(db): add User model fields for tax, timezone, API key - Fixes #3 2025-12-26 13:15:37 +11:00
Andrew Kaszubski 9933a929df feat(api): add FastAPI backend with JWT auth and strategies endpoint (#48)
- Add FastAPI application with async/await support (tradingagents/api/)
- Implement JWT authentication with Argon2 password hashing (PyJWT, pwdlib)
- Create /api/v1/auth/login endpoint for user authentication
- Create /api/v1/strategies CRUD endpoints (list, create, get, update, delete)
- Add SQLAlchemy 2.0 async models (User, Strategy) with PostgreSQL/SQLite
- Add Alembic migrations for database schema management
- Add comprehensive test suite (208 tests in tests/api/)
- Add Pydantic schemas for request/response validation
- Add CORS and error handling middleware
- Update documentation (CHANGELOG.md, README.md)

Security: Argon2 password hashing, JWT expiration, user isolation,
SQL injection prevention via SQLAlchemy ORM, no hardcoded secrets

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 11:50:03 +11:00
Andrew Kaszubski e5575250df feat(tests): add UAT and evaluation tests for agent outputs - Fixes #53
- Created tradingagents/utils/output_validator.py with ValidationResult dataclass

- Added validate_report_completeness(), validate_decision_quality() for content validation

- Added validate_debate_state(), validate_agent_state() for state coherence

- Created tests/unit/test_output_validators.py with 54 unit tests

- Created tests/e2e/test_uat_agent_outputs.py with 23 UAT scenarios

- Added agent state fixtures to tests/conftest.py (sample_agent_state, debates)

- Total: 77 tests covering report quality, signal extraction, and state integrity

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 11:38:37 +11:00
Andrew Kaszubski b4653ca37b feat(tests): add test fixtures directory with mock data - Fixes #51
- Created tests/fixtures/ with FixtureLoader class (14 loader methods)

- Added stock_data fixtures: US, CN (with Chinese columns), standardized OHLCV

- Added metadata fixtures: 5 analysis examples with datetime parsing

- Added report_sections fixtures: 7 complete analyst report sections

- Added api_responses fixtures: OpenAI embeddings and error responses

- Added configurations fixtures: vendor and LLM provider configs

- Created comprehensive README.md (595 lines) documenting fixture usage

- Updated docs/testing/writing-tests.md with fixture examples

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 11:23:29 +11:00
Andrew Kaszubski edae1ab2cc feat(llm): add DeepSeek provider and HuggingFace embedding fallback (Issue #41) 2025-12-26 11:07:48 +11:00
Andrew Kaszubski 5ea9e905c5 feat(tests): restructure tests into unit/integration/e2e directories - Fixes #50
- Moved 5 unit tests to tests/unit/ (exceptions, logging, report, docs, conftest)

- Moved 4 integration tests to tests/integration/ (openrouter, akshare, cli, deepseek)

- Created tests/e2e/ directory with README.md and conftest.py placeholder

- Added pytestmark = pytest.mark.unit/integration to all test files

- Updated pytest.ini with testpaths for new structure

- Updated docs/testing/README.md with new directory structure

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 11:04:20 +11:00
Andrew Kaszubski d6b9df162e feat(dataflows): add AKShare data vendor for US and Chinese stock data (Issue #16) 2025-12-26 10:42:15 +11:00
Andrew Kaszubski 36de8f0470 feat(tests): add pytest conftest.py hierarchy with shared fixtures - Fixes #49
- Created tests/conftest.py with 12 shared fixtures (environment mocks, LangChain/ChromaDB mocking, configuration)

- Created tests/unit/conftest.py with 6 unit-specific fixtures (data vendors, sample data)

- Created tests/integration/conftest.py with 2 integration fixtures (live ChromaDB, temp dirs)

- Added pytest.ini with 7 custom markers (unit, integration, e2e, llm, chromadb, slow, requires_api_key)

- Added tests/test_conftest_hierarchy.py with 83 tests validating fixture infrastructure

- Updated docs/testing/README.md and writing-tests.md with fixture usage documentation

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 10:40:30 +11:00
Andrew Kaszubski c0dfb21c00 feat(docs): add comprehensive documentation structure - Fixes #52
- Add docs/ directory with 17 documentation files

- Architecture: multi-agent-system, data-flow, llm-integration

- API Reference: trading-graph, agents, dataflows

- Guides: adding-new-analyst, adding-llm-provider, adding-data-vendor, configuration

- Testing: README, running-tests, writing-tests

- Development: setup, contributing

- Update PROJECT.md with TESTING STRATEGY requirements

- Add test_documentation_structure.py for validation

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 10:18:50 +11:00
Andrew Kaszubski 436f6cc092 feat(reports): add report exporter with YAML frontmatter and JSON metadata (Issue #21) 2025-12-26 10:11:42 +11:00
Andrew Kaszubski bb0ea33100 feat(logging): add dual-output logging and rate limit error handling - Fixes #39 2025-12-26 09:54:07 +11:00
Andrew Kaszubski d8093aa889 chore: improve .env gitignore pattern and remove .env.example
- Update .gitignore to use .env* wildcard pattern

- Covers all variants: .env.local, .env.backup, .env.production, etc.

- Remove .env.example to prevent accidental secret exposure

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 09:30:08 +11:00
Andrew Kaszubski 9ee81be48b fix(memory): use get_or_create_collection for idempotent ChromaDB init - Fixes #30 2025-12-26 09:20:04 +11:00
Andrew Kaszubski 164cb0d2fc fix(tests): add mock_env_openrouter fixture to all OpenRouter tests
- Add mock_env_openrouter to tests that use openrouter_config
- Update API key validation tests to expect ValueError when OPENROUTER_API_KEY missing
- All 30 tests now pass

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 16:02:04 +11:00
Andrew Kaszubski 5443aaa209 feat(llm): add OpenRouter API support with proper headers and API key handling
- Add explicit OPENROUTER_API_KEY environment variable handling
- Add HTTP-Referer and X-Title headers for OpenRouter attribution
- Fix case sensitivity for provider names (ollama now case-insensitive)
- Add embedding fallback to OpenAI when using OpenRouter (since OpenRouter lacks embedding API)
- Add comprehensive test suite (30 tests) for OpenRouter integration
- Update README.md and PROJECT.md with OpenRouter configuration docs
- Add CHANGELOG.md documenting the changes

Patterns borrowed from ~/.claude/lib/genai_validate.py for multi-provider support.

Closes #1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 15:51:25 +11:00
Andrew Kaszubski 0bd3741e8a feat: Add Anthropic LLM support and fix data vendor compatibility
- Switch to Anthropic Claude as LLM provider in main.py

- Add get_google_global_news() wrapper for proper signature matching

- Add get_fundamentals() to yfinance vendor

- Register yfinance and google as vendors for fundamentals and global news

- Make memory system fail gracefully when OpenAI embeddings unavailable
2025-12-25 15:23:28 +11: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
luohy15 d23fb539e9 minor fix 2025-09-30 13:27:48 +08:00
luohy15 b01051b9f4 Switch default data vendor
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 12:43:27 +08:00
luohy15 8fdbbcca3d alpha vantage api key url 2025-09-29 18:22:31 +08:00
luohy15 86bc0e793f minor fix 2025-09-27 00:04:59 +08:00
luohy15 7fc9c28a94 Add environment variable configuration support
- Add .env.example file with API key placeholders
- Update README.md with .env file setup instructions
- Add dotenv loading in main.py for environment variables

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 23:58:51 +08:00
luohy15 7bcc2cbd8a Update configuration documentation for Alpha Vantage data vendor
Add data vendor configuration examples in README and main.py showing how to configure Alpha Vantage as the primary data provider. Update documentation to reflect the current default behavior of using Alpha Vantage for real-time market data access.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 23:52:26 +08:00
luohy15 6211b1132a Improve Alpha Vantage indicator column parsing with robust mapping
- Replace hardcoded column indices with column name lookup
- Add mapping for all supported indicators to their expected CSV column names
- Handle missing columns gracefully with descriptive error messages
- Strip whitespace from header parsing for reliability

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 23:36:36 +08:00
luohy15 8b04ec307f minor fix 2025-09-26 23:25:33 +08:00
luohy15 0ab323c2c6 Add Alpha Vantage API integration as primary data provider
- Replace FinnHub with Alpha Vantage API in README documentation
- Implement comprehensive Alpha Vantage modules:
  - Stock data (daily OHLCV with date filtering)
  - Technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands, ATR)
  - Fundamental data (overview, balance sheet, cashflow, income statement)
  - News and sentiment data with insider transactions
- Update news analyst tools to use ticker-based news search
- Integrate Alpha Vantage vendor methods into interface routing
- Maintain backward compatibility with existing vendor system

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 22:57:50 +08:00
luohy15 a6734d71bc WIP 2025-09-26 16:17:50 +08:00
Yijia Xiao a438acdbbd
Merge pull request #89 from Mirza-Samad-Ahmed-Baig/fixes
Enhancement: agent reflection, logging improvement
2025-07-03 10:15:39 -04:00
Yijia Xiao c73e374e7c
Update main.py 2025-07-03 10:14:06 -04: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 fda4f664e8
Merge pull request #49 from Zhongyi-Lu/a
Exclude `.env` from Git.
2025-07-01 09:17:46 -07:00
Yijia Xiao 718df34932
Merge pull request #29 from ZeroAct/save_results
Save results
2025-06-26 00:28:30 -04:00
Max Wong 43aa9c5d09
Local Ollama (#53)
- Fix typo 'Start' 'End'
- Add llama3.1 selection
- Use 'quick_think_llm' model instead of hard-coding GPT
2025-06-26 00:27:01 -04:00
Yijia Xiao 26c5ba5a78
Revert "Docker support and Ollama support (#47)" (#57)
This reverts commit 78ea029a0b.
2025-06-26 00:07:58 -04:00