Commit Graph

241 Commits

Author SHA1 Message Date
google-labs-jules[bot] 9a6e8c5c7c Add edge case tests for _find_col in ttm_analysis
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:23:16 +00:00
google-labs-jules[bot] bb7d22d3a3 🧪 Add tests for _extract_article_data in yfinance_news.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:23:12 +00:00
google-labs-jules[bot] 369bc02ef5 🧹 Remove unused imports in trading_graph.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:22:55 +00:00
google-labs-jules[bot] 2663661be9 test: add edge case for sum constraints validation
Adds an edge case test in `test_config.py` to verify that `min_cash_pct` + `max_position_pct` can be exactly `1.0` without raising a `ValueError`.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:22:53 +00:00
google-labs-jules[bot] 404edc56b7 🧹 remove unused import _make_api_request from finnhub_scanner.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:22:49 +00:00
google-labs-jules[bot] 0955568391 refactor: remove unused imports in risk manager
Removed unused `import json` and `import time` from `tradingagents/agents/managers/risk_manager.py` to improve code health and cleanliness. Also removed unused variable `company_name`. Tested to ensure no functionality is affected.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:22:14 +00:00
google-labs-jules[bot] f82a810c3b Remove unused pandas import and clean up finnhub_stock.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:21:43 +00:00
copilot-swe-agent[bot] 33b61910e3 Address code review: clarify token estimation descriptions
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
Agent-Logs-Url: https://github.com/aguzererler/TradingAgents/sessions/94532c4f-3d37-464e-9a74-3c2e9899a532
2026-03-21 02:35:26 +00:00
copilot-swe-agent[bot] ada257ac3e Update portfolio flow diagram, add token estimation per model, add CLI/test commands to README
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
Agent-Logs-Url: https://github.com/aguzererler/TradingAgents/sessions/94532c4f-3d37-464e-9a74-3c2e9899a532
2026-03-21 02:34:23 +00:00
copilot-swe-agent[bot] 59acce14a9 Initial plan 2026-03-21 02:23:53 +00:00
ahmet guzererler 5799bb3f00
Merge pull request #42 from aguzererler/feat/portfolio-cli
feat: Portfolio Manager Auto and Check CLI Commands
2026-03-21 03:21:00 +01:00
Ahmet Guzererler 1d589c0621 feat(portfolio): add end-to-end auto and check-portfolio commands 2026-03-21 03:18:20 +01:00
Ahmet Guzererler d7a932bc83 feat(portfolio): integrate portfolio manager into cli, add pm command 2026-03-21 03:10:06 +01:00
ahmet guzererler 69e6bee34b
Merge pull request #40 from aguzererler/fix/remove-unused-timedelta-import-16675261317014341937
🧹 Remove unused `timedelta` import in finnhub_indicators.py
2026-03-21 02:56:10 +01:00
ahmet guzererler 5fed2ff3c0
Merge pull request #41 from aguzererler/testing/memory-tokenization-5207856762792060376
🧪 Add tests for memory tokenization
2026-03-21 02:55:53 +01:00
google-labs-jules[bot] 3b9eef380d test: add unit tests for _tokenize in FinancialSituationMemory
Adds comprehensive tests for `_tokenize` method inside
`tradingagents/agents/utils/memory.py` focusing on regex behavior
`\b\w+\b` with case mixing, punctuation, edges (empty string),
numbers, underscores, quoting, and hyphenation strings.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 01:54:23 +00:00
google-labs-jules[bot] 5fa0fe3178 🧹 Remove unused `timedelta` import in finnhub_indicators.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 01:54:05 +00:00
ahmet guzererler 3e90f13bf5
Merge pull request #39 from aguzererler/chore/remove-unused-json-import-11845664957182921108
🧹 chore: remove unused json import in research_manager.py
2026-03-21 02:53:14 +01:00
google-labs-jules[bot] 8bc92344f8 🧹 chore: remove unused json import in research_manager.py
Removed the unused `import json` line from `tradingagents/agents/managers/research_manager.py` to improve code health and maintainability.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 01:52:39 +00:00
ahmet guzererler 25457930ae
Merge pull request #36 from aguzererler/fix-unused-imports-utils-14929046510086826793
🧹 Remove unused imports in utils.py
2026-03-21 02:39:50 +01:00
ahmet guzererler 2becf7fca4
Merge pull request #37 from aguzererler/fix-max-positions-validation-test-9122767223538480688
🧪 Add comprehensive unit tests for portfolio config validation
2026-03-21 02:36:49 +01:00
ahmet guzererler 279081d3c7
Merge pull request #38 from aguzererler/perf-optimize-json-extraction-regex-3266597981569245080
 Pre-compile regex in JSON extraction utility
2026-03-21 02:36:33 +01:00
google-labs-jules[bot] 646fe40754 perf: pre-compile regex patterns in extract_json util
Compile THINK_PATTERN and FENCE_PATTERN at the module level to improve
the performance of extract_json by avoiding redundant regex compilation
during function calls.

Measured a ~5% performance improvement in an isolated benchmark.
- Baseline: 51.98 us/call
- Optimized: 49.26 us/call

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 01:34:43 +00:00
google-labs-jules[bot] a14de62f1e 🧪 Add comprehensive unit tests for portfolio config validation
Implemented `tests/portfolio/test_config.py` to test the `validate_config` function in `tradingagents/portfolio/config.py`.

Key improvements:
- Added `test_validate_config_max_positions_invalid` to verify `max_positions` boundary conditions (0, -1).
- Added happy path test `test_validate_config_valid`.
- Added tests for `max_position_pct`, `max_sector_pct`, `min_cash_pct`, and `default_budget` validation.
- Verified that tests correctly catch bugs by temporarily disabling validation logic.

These tests ensure the portfolio manager configuration is robustly validated before use.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 01:34:31 +00:00
google-labs-jules[bot] 13e5534043 chore: remove unused imports `os` and `json` from `tradingagents/dataflows/utils.py`
Identified by `ruff check`, these imports were not being used in the module. Removing them improves code health and maintainability.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 01:34:15 +00:00
ahmet guzererler c3954c966d
Merge pull request #34 from aguzererler/copilot/refactor-agent-workflows-and-risk-metrics
feat: portfolio risk metrics computation + LangChain agent tools
2026-03-21 02:31:57 +01:00
ahmet guzererler 9d8566f878
Merge branch 'main' into copilot/refactor-agent-workflows-and-risk-metrics 2026-03-21 02:30:18 +01:00
ahmet guzererler 9f72dbaea5
Merge pull request #33 from aguzererler/copilot/extend-portfolio-manager-implementation 2026-03-20 17:30:42 +01:00
copilot-swe-agent[bot] 96a2c79cb3 Implement Portfolio Manager Phases 2-5: risk evaluation, candidate prioritization, holding reviewer agent, PM decision agent, trade executor, and portfolio graph orchestration
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-20 14:44:22 +00:00
copilot-swe-agent[bot] 066460a501 feat: add portfolio risk metrics module and LangChain agent tools
- tradingagents/portfolio/risk_metrics.py: pure-Python computation of
  Sharpe, Sortino, VaR, max drawdown, beta, sector concentration from
  PortfolioSnapshot NAV history — no LLM, no external dependencies
- tradingagents/portfolio/__init__.py: export compute_risk_metrics
- tradingagents/agents/utils/portfolio_tools.py: 4 LangChain tools
  wrapping Holding.enrich, Portfolio.enrich, ReportStore APIs, and
  compute_risk_metrics so agents can access portfolio data without
  reimplementing computations
- tests/portfolio/test_risk_metrics.py: 48 tests for risk metrics
- tests/unit/test_portfolio_tools.py: 19 tests for portfolio tools
- tests/portfolio/test_repository.py: fix pre-existing import error

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-20 14:42:43 +00:00
copilot-swe-agent[bot] 1444e8438c feat: Portfolio Manager Phases 2-5 — risk evaluation, candidate prioritization, LLM agents, trade executor
- tradingagents/portfolio/risk_evaluator.py: pure-Python risk metrics
  (log returns, Sharpe, Sortino, VaR, max drawdown, beta, sector
  concentration, portfolio/holding aggregation, constraint checking)
- tradingagents/portfolio/candidate_prioritizer.py: conviction × thesis ×
  diversification × held_penalty scoring; sorted candidate ranking
- tradingagents/portfolio/trade_executor.py: executes BUY/SELL decisions
  (SELLs first), pre-flight constraint checks, EOD snapshot
- tradingagents/agents/portfolio/holding_reviewer.py: LLM agent using
  run_tool_loop() — reviews all holdings, outputs HOLD/SELL JSON
- tradingagents/agents/portfolio/pm_decision_agent.py: pure-reasoning LLM
  agent (no tools) — produces structured BUY/SELL/HOLD decision JSON
- tradingagents/portfolio/portfolio_states.py: PortfolioManagerState
  (MessagesState + Annotated _last_value reducers)
- tradingagents/graph/portfolio_setup.py: PortfolioGraphSetup — sequential
  6-node workflow with factory-pattern non-LLM nodes
- tradingagents/graph/portfolio_graph.py: PortfolioGraph — mirrors
  ScannerGraph pattern with mid/deep_think LLM tiers
- tests/portfolio/test_risk_evaluator.py: 28 tests (pure Python)
- tests/portfolio/test_candidate_prioritizer.py: 10 tests (pure Python)
- tests/portfolio/test_trade_executor.py: 10 tests (MagicMock repo)
- tradingagents/portfolio/__init__.py: exports new symbols

All 93 tests pass (4 integration skipped, no regressions).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-20 14:38:48 +00:00
copilot-swe-agent[bot] c94c3373b2 Initial plan for portfolio manager phases 2-5
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-20 14:27:37 +00:00
copilot-swe-agent[bot] 94c4a2e43d Initial plan 2026-03-20 14:27:11 +00:00
copilot-swe-agent[bot] 766e60234e Initial plan 2026-03-20 14:20:24 +00:00
ahmet guzererler 3e9322ae4b
Merge pull request #32 from aguzererler/copilot/create-data-foundation-layer
feat: implement Portfolio models, ReportStore, tests; fix SQL constraint & document float decision
2026-03-20 14:07:15 +01:00
Ahmet Guzererler a17e5f3707 feat: complete portfolio data foundation — psycopg2 client, repository, tests
Replace supabase-py stubs with working psycopg2 implementation using
Supabase pooler connection string. Implement full business logic in
repository (avg cost basis, cash accounting, trade recording, snapshots).
Add 12 unit tests + 4 integration tests (51 total portfolio tests pass).
Fix cash_pct bug in models.py, update docs for psycopg2 + pooler pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 14:06:50 +01:00
Ahmet Guzererler da7f078b5b removed hooks 2026-03-20 12:58:21 +01:00
copilot-swe-agent[bot] aa4dcdeb80 feat: implement Portfolio models, ReportStore, and tests; fix SQL constraint
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-20 11:16:39 +00:00
copilot-swe-agent[bot] 7ea9866d1d docs: ADR-012 — raw supabase-py over Prisma/SQLAlchemy for portfolio data layer
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-20 10:48:40 +00:00
copilot-swe-agent[bot] f1cabe7a4a feat: portfolio manager data foundation — docs, SQL migration, and module scaffolding
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-20 10:40:48 +00:00
copilot-swe-agent[bot] 29e75384cc Initial plan 2026-03-20 10:28:36 +00:00
Copilot 179e55f264
fix(tests): complete PR #26 — enforce socket isolation in unit tier and add test suite reference doc (#30)
* Initial plan

* fix(tests): complete PR #26 — move integration tests to tests/integration/ and fix 4 failing unit tests

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>

* docs: create docs/testing.md — comprehensive test suite reference with 5 Mermaid flowcharts

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-19 17:41:25 +01:00
ahmet guzererler d92fd9cab1
feat: NotebookLM sync with date-specific sources and consolidation (#28) 2026-03-19 15:39:25 +01:00
ahmet guzererler d2e967c4fc
simplify Architect agent prompt from ~165 to ~45 lines (#27)
Condense 7 verbose phases into 6 concise steps, remove redundant
error-handling table and bloated principles section while preserving
all critical rules (max 3 context calls, model: sonnet, self-contained
prompts, parallel spawning).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 14:47:34 +01:00
Ahmet Guzererler 7635bdec36 env var 2026-03-19 14:29:35 +01:00
Ahmet Guzererler 659cb3bafb architext change 2026-03-19 14:27:41 +01:00
Ahmet Guzererler 57c9b3ecaa refactor(tests): consolidate live-API tests into integration/, move mocked tests to unit/
- Replaced 7 duplicate live-API test files in tests/ root with:
  - tests/integration/test_scanner_live.py — consolidated scanner + yfinance + vendor fallback tests (marked @pytest.mark.integration, excluded from default run)
  - tests/e2e/test_llm_e2e.py — LLM e2e test extracted from test_scanner_comprehensive
  - tests/unit/test_industry_deep_dive.py — mocked _extract_top_sectors + run_tool_loop tests
  - tests/unit/test_scanner_fallback.py — mocked AV failover tests
- Removed record_mode hardcode from integration/conftest.py (VCR.py cannot intercept curl_cffi used by yfinance; integration tests run live against real APIs on demand)

Deleted: test_scanner_tools, test_scanner_end_to_end, test_scanner_complete_e2e,
         test_scanner_final, test_scanner_comprehensive, test_scanner_fallback,
         test_industry_deep_dive

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 14:24:52 +01:00
Ahmet Guzererler 8c9183cf10 Add integration and unit tests for scanner routing, TTM analysis, vendor fail-fast, and yfinance data layer
- Implement integration tests for scanner vendor routing, ensuring correct routing to Alpha Vantage and fallback to yfinance.
- Create comprehensive unit tests for TTM analysis, covering metrics computation and report formatting.
- Introduce fail-fast vendor routing tests to verify immediate failure for methods not in FALLBACK_ALLOWED.
- Develop extensive integration tests for the yfinance data layer, mocking external calls to validate functionality across various financial data retrieval methods.
2026-03-19 13:51:57 +01:00
ahmet guzererler d2af8991ed
fix: streamline Architect agent to stop stalling on context gathering (#25)
Collapsed 9 sequential phases into 5 core + 2 optional phases. The agent
was spending all its turns reading memory files, ADRs, and conventions
before ever spawning implementation agents. Now it caps initial context
gathering at 3 tool calls, skips memory-reader skill invocation (CLAUDE.md
already has conventions), writes plans as plain text instead of using
EnterPlanMode, and makes cleanup/memory-update phases optional.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 13:46:16 +01:00
ahmet guzererler 504ef60de5
agents (#24) 2026-03-19 12:21:52 +01:00