Andrew Kaszubski
e7bff2c4cf
feat(simulation): add Scenario Runner for parallel portfolio simulations - Issue #33 (45 tests)
...
Implements parallel scenario execution framework:
- ScenarioRunner with sequential, threaded, and process execution modes
- ScenarioConfig for configuring simulation parameters
- ScenarioResult for capturing simulation outcomes
- RunnerProgress for tracking execution progress
- Progress callbacks for real-time updates
- Cancellation support for long-running batches
- ScenarioBatchBuilder for parameter sweeps and variations
- Result aggregation with best/worst scenario identification
Features:
- Thread-safe parallel execution with configurable worker count
- FIFO result ordering preserved regardless of completion order
- Exception handling with graceful degradation
- Timeout support per scenario
- Cartesian product generation for parameter variations
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 21:59:12 +11:00
Andrew Kaszubski
13f2bba0b3
feat(portfolio): add Australian CGT Calculator with 50% discount - Issue #32 (66 tests)
...
Implements comprehensive Australian Capital Gains Tax calculator:
- CGT calculation with 50% discount for assets held >12 months
- FIFO (First In, First Out) cost basis matching
- Australian financial year support (July 1 - June 30)
- Capital loss tracking and carry-forward
- Tax year summary generation
- ATO-compliant tax report generation
- Foreign currency conversions
- Unrealised gains calculation
Classes:
- CGTMethod enum (discount, indexation, other)
- AssetType enum (shares, ETF, crypto, property, etc.)
- CGTAssetAcquisition dataclass (cost base parcel)
- CGTDisposal dataclass (sale record)
- CGTEvent dataclass (gain/loss event)
- TaxYearSummary dataclass (annual summary)
- AustralianCGTCalculator class (main calculator)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 21:53:27 +11:00
Andrew Kaszubski
bedb59bce0
feat(portfolio): add Performance Metrics with Sharpe, drawdown, returns - Issue #31 (63 tests)
...
Implements comprehensive portfolio performance analytics:
- Returns calculation (daily, monthly, yearly, cumulative)
- Risk-adjusted metrics (Sharpe, Sortino, Calmar ratios)
- Volatility and downside deviation
- Drawdown analysis with period tracking
- Trade statistics (win rate, profit factor, expectancy)
- Benchmark comparison (alpha, beta, information ratio, tracking error)
- Utility functions (CAGR, rolling returns, period aggregation)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 21:44:15 +11:00
Andrew Kaszubski
6642047eaa
feat(portfolio): add Portfolio State for holdings and mark-to-market - Issue #29 (68 tests)
...
Implements comprehensive portfolio state management:
- Holding dataclass with long/short support and P&L calculations
- CashBalance for multi-currency cash management
- PortfolioState class with:
- Real-time mark-to-market valuation
- Multi-currency support with exchange rate conversion
- Thread-safe state updates
- Position tracking with average cost calculation
- Portfolio snapshots for historical tracking
- PriceProvider and ExchangeRateProvider protocols
- Serialization/deserialization support
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 21:37:17 +11:00
Andrew Kaszubski
9aee43312d
feat(execution): add Risk Controls for pre-trade validation - Issue #28 (45 tests)
2025-12-26 21:29:14 +11:00
Andrew Kaszubski
6863e3ed87
feat(execution): add Order Manager for lifecycle management - Issue #27 (47 tests)
2025-12-26 21:24:54 +11:00
Andrew Kaszubski
834d18fb51
feat(execution): add Paper broker for simulation mode - Issue #26 (63 tests)
2025-12-26 21:19:25 +11:00
Andrew Kaszubski
1e32c0e965
feat(execution): add IBKR broker for futures and ASX equities - Issue #25 (38 tests)
2025-12-26 21:11:56 +11:00
Andrew Kaszubski
593d59937c
feat(execution): add Alpaca broker for US stocks, ETFs, crypto - Issue #24 (37 tests)
2025-12-26 21:06:32 +11:00
Andrew Kaszubski
850346a47a
feat(execution): add broker router for multi-broker asset class routing - Issue #23 (57 tests)
2025-12-26 20:58:40 +11:00
Andrew Kaszubski
e4ef947c3b
feat(execution): add abstract broker base interface - Fixes #22
2025-12-26 20:49:17 +11:00
Andrew Kaszubski
4f6f7c1c14
feat(memory): add memory integration for agent prompts - Fixes #21
2025-12-26 20:40:21 +11:00
Andrew Kaszubski
25c31d5f5d
feat(memory): add risk profiles memory for user preferences - Fixes #20
2025-12-26 20:30:21 +11:00
Andrew Kaszubski
dbfcea3740
feat(memory): add trade history memory with outcome tracking - Fixes #19
2025-12-26 20:22:03 +11:00
Andrew Kaszubski
d72c214d4d
feat(memory): add layered memory system with FinMem pattern - Fixes #18
2025-12-26 20:17:26 +11:00
Andrew Kaszubski
5a0606b59f
feat(graph): integrate new analysts into workflow - Fixes #17
2025-12-26 20:11:28 +11:00
Andrew Kaszubski
a17fc1f029
feat(agents): add Position Sizing Manager with Kelly and risk parity - Fixes #16
...
Implements Position Sizing Manager for optimal position sizing calculations.
The manager supports multiple sizing methodologies to accommodate different
trading styles and risk tolerances.
Sizing Methods:
- Kelly Criterion (full, half, quarter) for edge-based optimal sizing
- ATR-based sizing for volatility-adjusted position sizing
- Risk Parity allocation for balanced portfolio risk
- Volatility targeting for consistent risk contribution
- Fixed fractional for controlled percentage risk
Key Features:
- Multiple sizing method comparison for best fit selection
- Risk level presets (conservative, moderate, aggressive)
- Position constraints and drawdown limits
- Stop loss level recommendations based on ATR
- Win/loss ratio analysis for Kelly calculations
Tools:
- calculate_kelly_position_size: Edge-based optimal sizing
- calculate_atr_position_size: Volatility-adjusted position sizing
- calculate_risk_parity_allocation: Multi-asset balanced risk allocation
- calculate_volatility_target_size: Target volatility-based sizing
- get_position_sizing_recommendation: Comprehensive multi-method comparison
Enums:
- SizingMethod: 8 different sizing approaches
- RiskLevel: Conservative, moderate, aggressive presets
Tests: 52 unit tests covering Kelly calculations, ATR sizing, risk parity
weights, volatility targeting, constraints, and integration workflows.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 17:39:20 +11:00
Andrew Kaszubski
b0140a82b3
feat(agents): add Correlation Analyst for cross-asset analysis - Fixes #15
...
Implements Correlation Analyst agent for cross-asset correlation analysis
and sector rotation detection. The agent analyzes inter-market relationships
to identify diversification opportunities and sector leadership changes.
Features:
- Cross-asset correlation analysis (stocks vs bonds, gold, oil, dollar)
- Sector rotation analysis across all 11 S&P 500 sectors
- Rolling correlation trend tracking with breakdown detection
- Relative strength calculation for sector leadership
- Economic cycle phase identification (early/mid/late cycle, recession)
- Cycle-based sector recommendations
Tools:
- get_cross_asset_correlation_analysis: Multi-asset correlation with regime interpretation
- get_sector_rotation_analysis: Sector rankings, leadership, rotation signals
- get_correlation_matrix: Pairwise correlation matrix for portfolio construction
- get_rolling_correlation_trend: Time-series correlation dynamics
Enums:
- CorrelationStrength: 9-level classification from very strong negative to very strong positive
- SectorPhase: Economic cycle phases for rotation timing
- SectorLeadership: Leading, lagging, improving, weakening classifications
Tests: 59 unit tests covering correlation calculations, classification logic,
sector rotation, breakdown detection, 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:30:53 +11:00
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
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
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
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
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