Commit Graph

349 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] a8ccff31a0 Add YoY edge case tests for 5 and 4 quarter scenarios
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
Agent-Logs-Url: https://github.com/aguzererler/TradingAgents/sessions/b594017b-ed84-4786-9b81-200a78eb5d76
2026-03-21 16:59:03 +00:00
copilot-swe-agent[bot] 3d76acf17d Add financial tools analysis doc and fix YoY revenue growth bug in TTM analysis
- Create docs/FINANCIAL_TOOLS_ANALYSIS.md with comprehensive 4-point analysis:
  1. Implementation accuracy review for all indicators and metrics
  2. Library assessment (stockstats vs TA-Lib vs pandas-ta)
  3. Alpha Vantage debate (local calc vs API-fetched)
  4. Data flow & API mapping for every financial tool
- Fix off-by-one in ttm_analysis.py: YoY revenue used quarterly[-4]
  (3 quarters back) instead of quarterly[-5] (4 quarters = 1 year back)
- Add test_revenue_yoy_is_four_quarters_back test to validate the fix

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
Agent-Logs-Url: https://github.com/aguzererler/TradingAgents/sessions/b594017b-ed84-4786-9b81-200a78eb5d76
2026-03-21 16:57:21 +00:00
ahmet guzererler a7b8c996f2
Merge pull request #70 from aguzererler/fix/resolve-prs-56-58-60-4650038896702716891
🧪 Resolve PRs #56, #58, and #60
2026-03-21 17:54:10 +01:00
google-labs-jules[bot] c8465af163 🧪 Resolve PRs #56, #58, and #60
- Added edge case test for `_find_col` in `tests/unit/test_ttm_analysis.py` (from PR #56).
- Enhanced `_clean_dataframe` in `tradingagents/dataflows/stockstats_utils.py` to parse dates, drop invalid rows, fill price gaps, and lowercase columns (combining PRs #58 and #60).
- Expanded the test suite in `tests/unit/test_stockstats_utils.py` to cover the new `_clean_dataframe` functionality.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 16:51:49 +00:00
copilot-swe-agent[bot] 5f3fbd5abd Initial plan 2026-03-21 16:47:43 +00:00
ahmet guzererler 68df103ee9
Merge pull request #52 from aguzererler/fix/remove-unused-import-interface-7009076599669968401
🧹 Remove unused Annotated import from interface.py
2026-03-21 17:37:18 +01:00
ahmet guzererler 9ef73577f3
Merge pull request #53 from aguzererler/jules-12150822204137850232-2d21567f
🧹 Remove unused import 'Path' from trading_graph.py
2026-03-21 17:36:57 +01:00
ahmet guzererler 2ec8a17216
Merge pull request #54 from aguzererler/test-macro-regime-fmt-pct-18208719821293052000
🧪 Add tests for `_fmt_pct` in macro regime
2026-03-21 17:36:20 +01:00
ahmet guzererler 7b9510a99b
Merge pull request #61 from aguzererler/fix/agent-utils-unused-imports-948671579039994874
🧹 fix: remove unused imports from agent_utils.py
2026-03-21 17:35:19 +01:00
ahmet guzererler 86a0f5d9b7
Merge pull request #59 from aguzererler/testing/industry-deep-dive-parsing-12762969703991793840
🧪 test: add tests and parsing logic for text formats in _extract_top_sectors
2026-03-21 17:34:47 +01:00
ahmet guzererler a42676d8b6
Merge pull request #57 from aguzererler/remove-unused-imports-alpha-vantage-5385473624944698804
🧹 [Code Health] Remove unused imports in alpha_vantage.py
2026-03-21 17:33:57 +01:00
ahmet guzererler ae83ce74fa
Merge pull request #55 from aguzererler/fix/refactor-alpha-vantage-indicator-4324081028548110342
🧹 Refactor long `get_indicator` function to improve maintainability
2026-03-21 17:32:31 +01:00
ahmet guzererler cce5755b30
Merge pull request #62 from aguzererler/test-stockstats-utils-15966200471023157106
🧪 [testing improvement] Add unit tests for _clean_dataframe in stockstats_utils
2026-03-21 17:29:41 +01:00
ahmet guzererler 4747d98cb3
Merge pull request #63 from aguzererler/fix/macro-regime-refactor-299016324797440021
🧹 Refactor classify_macro_regime to improve readability
2026-03-21 17:29:23 +01:00
ahmet guzererler e5be3f4676
Merge pull request #64 from aguzererler/perf/lazy-load-portfolio-snapshot-8090947574151242031
 [performance] Lazy Load JSON Parsing for PortfolioSnapshot Holdings
2026-03-21 17:28:43 +01:00
ahmet guzererler b0424a36d7
Merge pull request #66 from aguzererler/jules-17548469684748509551-99819dec
🧪 [Fix Finnhub API error handling and add coverage]
2026-03-21 17:27:49 +01:00
ahmet guzererler 0dc6236e20
Merge pull request #67 from aguzererler/testing/cli-extract-content-string-6775172434327225745
🧪 [Testing Improvement] Add tests for `extract_content_string` in `cli/main.py`
2026-03-21 17:27:21 +01:00
ahmet guzererler f2ec1bd6aa
Merge pull request #51 from aguzererler/test-vix-trend-short-history-13411679154947690802
🧪 [testing improvement] Add missing edge case test for short history in _signal_vix_trend
2026-03-21 17:26:42 +01:00
ahmet guzererler 5c91aa8bb3
Merge pull request #50 from aguzererler/test-ttm-analysis-find-col-8347777247783205733
🧪 Add unit tests for _find_col in ttm_analysis
2026-03-21 17:26:22 +01:00
ahmet guzererler e5dcfb0e25
Merge pull request #49 from aguzererler/test-extract-article-data-17131555993247333235
🧪 Improve test coverage for `_extract_article_data`
2026-03-21 17:25:19 +01:00
ahmet guzererler e292c833ce
Merge pull request #48 from aguzererler/fix/unused-typing-imports-8765363568869734056
🧹 Remove unused imports in trading_graph.py
2026-03-21 17:24:14 +01:00
ahmet guzererler 319feac087
Merge pull request #65 from aguzererler/testing-macro-regime-edge-cases-7674628334263228754
🧪 Fix VIX trend logic and add extensive tests for macro regime short history edge cases
2026-03-21 17:23:38 +01:00
ahmet guzererler 0313cc629e
Merge pull request #47 from aguzererler/fix/test-config-sum-constraints-edge-case-6454385375638160819
🧪 test: add edge case for portfolio config sum constraints
2026-03-21 17:20:25 +01:00
ahmet guzererler e877f298bb
Merge pull request #46 from aguzererler/fix-unused-import-finnhub-scanner-619852487739765853
🧹 remove unused import _make_api_request from finnhub_scanner.py
2026-03-21 17:20:03 +01:00
ahmet guzererler 5d600480ce
Merge pull request #45 from aguzererler/code-health/risk-manager-unused-import-1634631888147245992
🧹 Remove unused imports and variables in risk manager
2026-03-21 17:18:31 +01:00
ahmet guzererler 1e10b4ca96
Merge pull request #44 from aguzererler/fix/unused-import-finnhub-stock-10302219538878494092
🧹 Remove unused pandas import from finnhub_stock.py
2026-03-21 17:18:10 +01:00
ahmet guzererler df735bf6e9
Merge pull request #68 from aguzererler/feat/test-tool-call-parsing-12253012184888559232
🧪 Add robust parsing and tests for LLM string tool calls
2026-03-21 17:17:18 +01:00
google-labs-jules[bot] 6f052fffea 🧪 Implement robust tool call parsing and unit tests
- Replaced potentially unsafe or missing tool call parsing logic with `ast.literal_eval` in `cli/main.py`.
- Created a new `parse_tool_call` helper to handle fallback parsing for LLM tool calls formatted as strings.
- Added comprehensive unit tests in `tests/unit/test_cli_main_tools.py` verifying behavior for valid strings, `ValueError`, `SyntaxError`, dicts, and objects.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 14:56:12 +00:00
google-labs-jules[bot] 811459b38f Add tests for `extract_content_string` error handling in `cli/main.py`
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 14:53:45 +00:00
google-labs-jules[bot] bdaf188b33 Fix Finnhub API error handling and add coverage
Extracted the API request logic in `finnhub_news.py` to a private `_fetch_company_news_data` helper to properly catch `Exception` and return an empty list without violating the `str` return type of the main `get_company_news` function. Explicitly allows `ThirdPartyTimeoutError` to propagate to preserve timeout behavior.

Added corresponding tests to mock generic API exceptions and invalid response types. Retained the test verifying fallback behavior for invalid numeric values within `get_insider_transactions`.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 14:51:29 +00:00
google-labs-jules[bot] 177d35ede5 🧪 Fix VIX trend logic and add extensive tests for macro regime short history edge cases
- Fixed `_signal_vix_trend` to correctly return neutral for insufficient history (`< 21`).
- Added `test_short_history_is_neutral` to `TestSignalVixTrend`.
- Extended coverage for short history and edge cases in `TestSignalCreditSpread`, `TestSignalYieldCurve`, `TestSignalMarketBreadth`, and `TestSignalSectorRotation`.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 14:48:20 +00:00
CadeYu 7d200d834a style: inline single-use instrument context vars 2026-03-21 21:31:38 +08:00
CadeYu 08bfe70a69 fix: preserve exchange-qualified tickers across agent prompts 2026-03-21 21:10:13 +08:00
google-labs-jules[bot] 7ab7cd7591 perf: lazy load json parsing in PortfolioSnapshot
This commit optimizes `PortfolioSnapshot` instantiation when loaded from the DB or JSON dictionaries by removing the immediate `json.loads(holdings_snapshot)` parsing inside the `from_dict` constructor. Instead, it overrides `__getattribute__` to implement a lazy-loading pattern, where the `holdings_snapshot` string is only parsed into a Python dictionary the very first time the field is accessed.

    This optimization ensures that parsing large JSON payloads doesn't block the instantiation of snapshots, which is particularly beneficial in workflows that load a large historical series of snapshots but never access their `holdings_snapshot` field.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:32:52 +00:00
google-labs-jules[bot] 77694d49c9 Refactor classify_macro_regime into helper functions
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:31:07 +00:00
google-labs-jules[bot] a7f5f67f94 🧪 [testing improvement] Add unit tests for _clean_dataframe in stockstats_utils
Added tests to verify the dataframe cleaning logic in stockstats_utils.
Tests cover lowercasing of columns, handling non-string columns, and ensuring original dataframe is not mutated.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:30:52 +00:00
google-labs-jules[bot] 3bed14e5c1 🧹 fix: remove unused imports from agent_utils.py
Removed re-exported tool imports from `tradingagents/agents/utils/agent_utils.py` to declutter the file and prevent unnecessary dependency loading. Updated all downstream modules (tests, analysts, scanners, and the trading graph) to import the required tools directly from their respective source files in `tradingagents/agents/utils/`.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:30:43 +00:00
google-labs-jules[bot] 644ce57b9c test: add tests and parsing logic for text formats in _extract_top_sectors
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:28:35 +00:00
google-labs-jules[bot] 1129c0cd21 Refactor interface.py to remove unused imports in alpha_vantage.py
The file `tradingagents/dataflows/alpha_vantage.py` previously acted as an aggregator but did not use the imports it defined, leading to linter warnings (ruff). The dependencies in `tradingagents/dataflows/interface.py` were refactored to import directly from the specialized modules instead. This safely allowed removing all unused imports from `alpha_vantage.py`, improving code health and module clarity without affecting functionality.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:27:10 +00:00
google-labs-jules[bot] 0a53060ce9 Refactor `get_indicator` function in `alpha_vantage_indicator.py`
This change refactors the large monolithic `get_indicator` function by extracting large mapping dictionaries out of the function scope as constants and separating API fetching logic and CSV parsing logic into private helper functions. This drastically improves the maintainability and readability of `alpha_vantage_indicator.py` without introducing any behavioral changes.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:26:02 +00:00
google-labs-jules[bot] ab86ccb3a7 test: add tests for _fmt_pct in macro regime
Added `TestFmtPct` class to `tests/unit/test_macro_regime.py` to test the `_fmt_pct` function from `tradingagents.dataflows.macro_regime`.
The test covers `None`, positive, negative, and zero values.
Also updated `_fmt_pct` implementation to match the requested `+.1f` formatting.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:24:45 +00:00
google-labs-jules[bot] 86d1afc0fd 🧹 Remove unused import 'Path' from trading_graph.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:24:12 +00:00
google-labs-jules[bot] b9c4cf2859 Remove unused Annotated import from interface.py
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:23:52 +00:00
google-labs-jules[bot] 433af4d1e4 Add edge case test for short history in _signal_vix_trend
Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:23:47 +00:00
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