Commit Graph

5 Commits

Author SHA1 Message Date
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