feat(news): configurable fetch params via DEFAULT_CONFIG

Per-ticker article limit, global article limit, global lookback
window, and macro query list are now read from get_config()
instead of being hardcoded. Tool wrapper get_global_news passes
None defaults so config overrides flow through the LLM-tool path
too. Macro query defaults broadened from 4 US-centric strings to
5 covering Fed, S&P 500, geopolitics, ECB/BOJ/BOE, commodities.

#606 #558 #562
This commit is contained in:
Yijia-Xiao committed 2026-05-11 05:30:52 +00:00
1 parent 0fcf13624e
commit 384fe1a3d2
3 files changed
+42 -18

No files matched your search

+10 -6
View File
@@ -1,5 +1,5 @@
from langchain_core.tools import tool
from typing import Annotated
from typing import Annotated, Optional
from tradingagents.dataflows.interface import route_to_vendor
@tool
@@ -23,16 +23,20 @@ def get_news(
@tool
def get_global_news(
curr_date: Annotated[str, "Current date in yyyy-mm-dd format"],
look_back_days: Annotated[int, "Number of days to look back"] = 7,
limit: Annotated[int, "Maximum number of articles to return"] = 5,
look_back_days: Annotated[Optional[int], "Days to look back; omit to use the configured default"] = None,
limit: Annotated[Optional[int], "Max articles to return; omit to use the configured default"] = None,
) -> str:
"""
Retrieve global news data.
Uses the configured news_data vendor.
Uses the configured news_data vendor. Defaults for look_back_days and
limit come from DEFAULT_CONFIG (global_news_lookback_days,
global_news_article_limit); pass explicit values to override.
Args:
curr_date (str): Current date in yyyy-mm-dd format
look_back_days (int): Number of days to look back (default 7)
limit (int): Maximum number of articles to return (default 5)
look_back_days (int): Number of days to look back; omit to inherit config
limit (int): Maximum number of articles to return; omit to inherit config
Returns:
str: A formatted string containing global news data
"""