TradingAgents/tests
Ahmet Guzererler 2201afd33a fix: harden dataflows layer against silent failures and data corruption
The pipeline was emitting hundreds of errors:
  'Invalid number of return arguments after parsing column name: Date'

Root cause: after _clean_dataframe() lowercases all columns, stockstats.wrap()
promotes 'date' to the DataFrame index. Subsequent df['Date'] access caused
stockstats to try parsing 'Date' as a technical indicator name.

- stockstats_utils.py + y_finance.py: use df.index.strftime() instead of
  df['Date'] after wrap()

- Eliminates duplicated 30-line download+cache boilerplate in two places
- Cache filename is always derived from today's date — hardcoded stale date
  '2015-01-01-2025-03-25' in local mode is gone
- Corruption/truncation detection: files <50 rows or unparseable are deleted
  and re-fetched rather than silently returning bad data
- Drops on_bad_lines='skip' — malformed CSVs now raise instead of silently
  dropping rows that would distort indicator calculations

- Defined in stockstats_utils.py; raised instead of print()+return ''
- get_stockstats_indicator now raises YFinanceError on failure so errors
  surface to callers rather than delivering empty strings to LLM agents
- interface.py route_to_vendor now catches YFinanceError alongside
  AlphaVantageError and FinnhubError — failures appear in observability
  telemetry and can trigger vendor fallback

- _filter_csv_by_date_range: replaced df.columns[0] positional assumption
  with explicit search for 'time'/'timestamp'/'date' column
- ValueError re-raised (not swallowed) so bad API response shape is visible

- Replaced all print() calls in changed files with logging.getLogger()
- Added logging import + logger to alpha_vantage_common

- tests/unit/test_incident_fixes.py: 12 new unit tests covering all fixes
  (dynamic cache filename, corruption re-fetch, YFinanceError propagation,
  explicit column lookup, empty download raises)
- tests/integration/test_stockstats_live.py: 11 live tests against real
  yfinance API (all major indicators, weekend N/A, regression guard)
- All 70 tests pass (59 unit + 11 live integration)
2026-03-22 07:23:14 +01:00
..
cassettes Add integration and unit tests for scanner routing, TTM analysis, vendor fail-fast, and yfinance data layer 2026-03-19 13:51:57 +01:00
cli 🧪 Add unit tests for StatsCallbackHandler 2026-03-21 22:18:51 +00:00
e2e refactor(tests): consolidate live-API tests into integration/, move mocked tests to unit/ 2026-03-19 14:24:52 +01:00
integration fix: harden dataflows layer against silent failures and data corruption 2026-03-22 07:23:14 +01:00
portfolio perf(portfolio): batch database writes during bulk SELL executions 2026-03-21 20:06:45 +00:00
unit fix: harden dataflows layer against silent failures and data corruption 2026-03-22 07:23:14 +01:00
__init__.py Initial plan for portfolio manager phases 2-5 2026-03-20 14:27:37 +00:00
conftest.py fix(tests): complete PR #26 — enforce socket isolation in unit tier and add test suite reference doc (#30) 2026-03-19 17:41:25 +01:00