mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-19 19:25:24 +03:00
fix(dataflows): bound insider filings and prediction markets by the trade date
- insider transactions are filtered to filings on or before the run date - prediction-market odds are withheld from a historical run
This commit is contained in:
@@ -15,6 +15,8 @@ from datetime import datetime, timezone
|
||||
|
||||
import requests
|
||||
|
||||
from .utils import get_current_date
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
GAMMA_BASE = "https://gamma-api.polymarket.com"
|
||||
@@ -65,7 +67,7 @@ def _is_forward_looking(market: dict, now: datetime) -> bool:
|
||||
)
|
||||
|
||||
|
||||
def get_prediction_markets(topic: str, limit: int | None = None) -> str:
|
||||
def get_prediction_markets(topic: str, limit: int | None = None, curr_date: str | None = None) -> str:
|
||||
"""Return live prediction-market probabilities for an event topic.
|
||||
|
||||
Args:
|
||||
@@ -73,12 +75,20 @@ def get_prediction_markets(topic: str, limit: int | None = None) -> str:
|
||||
"US election", or a sector/company event.
|
||||
limit: Max markets to return (ranked by traded volume); ``None`` uses
|
||||
DEFAULT_LIMIT.
|
||||
curr_date: The analysis date. Polymarket serves only live odds, so a
|
||||
date before today withholds them.
|
||||
|
||||
Returns:
|
||||
A markdown report of the most-traded open markets matching the topic,
|
||||
each with its implied probability, traded volume, resolution date, and
|
||||
recent (1-week) move.
|
||||
"""
|
||||
if curr_date and curr_date < get_current_date():
|
||||
return (
|
||||
f"Prediction-market odds are withheld for {curr_date}. Polymarket serves "
|
||||
f"only live odds on open markets, with no historical vintage, so serving "
|
||||
f"them would put post-decision information into a {curr_date} analysis."
|
||||
)
|
||||
if limit is None:
|
||||
limit = DEFAULT_LIMIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user