mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-26 14:32:28 +03:00
- interface -> router; symbol_utils -> symbols, which also takes safe_ticker_component - utils is split: get_current_date to date_window, the HTTP helpers to net - dataflows imports are absolute; the NoMarketDataError re-export from symbols is gone
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
from typing import Annotated
|
|
|
|
from langchain_core.tools import tool
|
|
from langgraph.prebuilt import InjectedState
|
|
|
|
from tradingagents.dataflows.router import route_to_vendor
|
|
|
|
|
|
@tool
|
|
def get_prediction_markets(
|
|
topic: Annotated[
|
|
str,
|
|
"Event topic/keyword, e.g. 'Fed rate cut', 'recession 2026', "
|
|
"'US election', or a sector/company event.",
|
|
],
|
|
limit: Annotated[int | None, "Max markets to return; omit for a default of 6"] = None,
|
|
trade_date: Annotated[str, InjectedState("trade_date")] = "",
|
|
) -> str:
|
|
"""
|
|
Retrieve live, market-implied probabilities for forward-looking events from
|
|
prediction markets (Polymarket): Fed decisions, recession, elections,
|
|
geopolitics, crypto. Returns the most-traded open markets matching the
|
|
topic, each with its implied probability, traded volume, resolution date,
|
|
and recent move. Uses the configured prediction_markets vendor.
|
|
|
|
Args:
|
|
topic (str): Event keyword(s) to search
|
|
limit (int): Max markets to return; omit for a default of 6
|
|
|
|
Returns:
|
|
str: A formatted markdown report of matching prediction markets
|
|
"""
|
|
return route_to_vendor("get_prediction_markets", topic, limit, trade_date or None)
|