fix: track last_published_at per source to avoid re-fetching same articles — applies to both news_api and macro_news
This commit is contained in:
@@ -128,6 +128,10 @@ class PolygonNewsAdapter(NewsDataAdapter):
|
||||
if config.get("published_utc_lte"):
|
||||
params["published_utc.lte"] = config["published_utc_lte"]
|
||||
|
||||
# Auto-filter to only fetch articles newer than last successful fetch
|
||||
if config.get("last_published_at") and "published_utc.gt" not in params:
|
||||
params["published_utc.gt"] = config["last_published_at"]
|
||||
|
||||
url = f"{self.base_url}{self.NEWS_ENDPOINT}"
|
||||
return url, params
|
||||
|
||||
|
||||
Reference in New Issue
Block a user