Skip to content

fix: handle explicit None for look_back_days/limit in alpha_vantage get_global_news - #1336

Open
prithvirajrh wants to merge 1 commit into
TauricResearch:mainfrom
prithvirajrh:fix/alpha-vantage-global-news-none-args
Open

fix: handle explicit None for look_back_days/limit in alpha_vantage get_global_news#1336
prithvirajrh wants to merge 1 commit into
TauricResearch:mainfrom
prithvirajrh:fix/alpha-vantage-global-news-none-args

Conversation

@prithvirajrh

Copy link
Copy Markdown

Summary

  • The get_global_news LLM tool documents that passing None for look_back_days/limit inherits the configured default (see tradingagents/agents/utils/news_data_tools.py), but the Alpha Vantage vendor implementation only handled omitted arguments via literal defaults (=7, =50). When the LLM tool call explicitly passes look_back_days=None/limit=None (as reported in [Bug]: unexpected NoneType of timedelta #1326), those literal defaults are bypassed and the call crashes inside timedelta(days=None).
  • This brings alpha_vantage_news.get_global_news in line with the existing convention already used by the yfinance vendor (yfinance_news.get_global_news_yfinance): resolve None via get_config()'s global_news_lookback_days / global_news_article_limit.

Fixes #1326.

Test plan

  • Added test_global_news_none_args_use_config_defaults to tests/test_alpha_vantage_hardening.py, verifying None args resolve to config defaults and the vendor call succeeds instead of raising.
  • Confirmed the new test fails on main (pre-fix) and passes with the fix.
  • Full suite: 677 passed, 2 skipped (skips are pre-existing, due to an optional dependency and a missing live API key, unrelated to this change).

🤖 Generated with Claude Code

https://claude.ai/code/session_01W8ioPGbswhsFA6EhBaZNbT

…et_global_news

The LLM-facing get_global_news tool documents that passing None for
look_back_days/limit inherits the configured default, but the Alpha
Vantage vendor implementation only handled omitted arguments via literal
defaults (=7, =50). An explicit None (as agents actually send) bypassed
those defaults and crashed inside timedelta(days=None).

Bring it in line with the yfinance vendor's existing convention: resolve
None from DEFAULT_CONFIG's global_news_lookback_days /
global_news_article_limit.

Fixes TauricResearch#1326.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8ioPGbswhsFA6EhBaZNbT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: unexpected NoneType of timedelta

2 participants