feat(data): add Polymarket prediction markets as a keyless vendor
Surface live, market-implied probabilities for forward-looking events (Fed decisions, recession, elections, geopolitics, crypto) to the news analyst via a new get_prediction_markets tool and a prediction_markets vendor category. Backed by Polymarket's public Gamma API (no key). Results are filtered to open, forward-looking markets (closed and past-dated events excluded), ranked by traded volume, and rendered with implied probability, volume, resolution date, and the recent move. External errors degrade to a clear unavailable message rather than interrupting the analyst.
This commit is contained in:
8 files changed
+321
-2
No files matched your search
@@ -26,6 +26,9 @@ from tradingagents.agents.utils.news_data_tools import (
|
||||
from tradingagents.agents.utils.macro_data_tools import (
|
||||
get_macro_indicators
|
||||
)
|
||||
from tradingagents.agents.utils.prediction_markets_tools import (
|
||||
get_prediction_markets
|
||||
)
|
||||
from tradingagents.agents.utils.market_data_validation_tools import (
|
||||
get_verified_market_snapshot
|
||||
)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
from typing import Annotated
|
||||
|
||||
from langchain_core.tools import tool
|
||||
|
||||
from tradingagents.dataflows.interface 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,
|
||||
) -> 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)
|
||||
Reference in new issue
Block a user