feat: add Polymarket wallet activity watcher and update .env example with its configuration.

This commit is contained in:
2569718930@qq.com
2026-03-12 08:17:11 +08:00
parent 0c976ac846
commit 22082b9a83
2 changed files with 7 additions and 4 deletions
+2
View File
@@ -65,6 +65,8 @@ POLYMARKET_WALLET_ACTIVITY_USERS=0x0000000000000000000000000000000000000000
# Optional wallet nicknames:
# - CSV: 0xabc...=Whale_A,0xdef...=Main_Account
# - JSON: {"0xabc...":"Whale A","0xdef...":"Main Account"}
# - Env key: POLYMARKET_WALLET_ACTIVITY_USER_ALIASES
# (legacy typo POLYMARKET_WALLET_ACTIVITY_USERS_ALIASES is also accepted)
POLYMARKET_WALLET_ACTIVITY_USER_ALIASES=
POLYMARKET_WALLET_ACTIVITY_DATA_API_URL=https://data-api.polymarket.com
POLYMARKET_WALLET_ACTIVITY_INTERVAL_SEC=20
@@ -152,12 +152,11 @@ def _market_url(position: Dict[str, Any]) -> str:
slug = str(position.get("slug") or "").strip()
event_slug = str(position.get("event_slug") or "").strip()
if slug and event_slug:
return f"https://polymarket.com/event/{event_slug}/{slug}"
if slug:
return f"https://polymarket.com/market/{slug}"
# Prefer event-level URL first: Telegram preview is usually more stable.
if event_slug:
return f"https://polymarket.com/event/{event_slug}"
if slug:
return f"https://polymarket.com/market/{slug}"
return ""
@@ -519,6 +518,7 @@ def start_polymarket_wallet_activity_loop(bot: Any) -> Optional[threading.Thread
users = _parse_addresses(os.getenv("POLYMARKET_WALLET_ACTIVITY_USERS"))
user_aliases = _parse_address_aliases(
os.getenv("POLYMARKET_WALLET_ACTIVITY_USER_ALIASES")
or os.getenv("POLYMARKET_WALLET_ACTIVITY_USERS_ALIASES")
)
if not enabled:
@@ -586,6 +586,7 @@ def start_polymarket_wallet_activity_loop(bot: Any) -> Optional[threading.Thread
logger.info(
f"polymarket wallet activity watcher started users={len(users)} "
f"poll={poll_sec}s data_api={data_api_url} price_filter={min_price}-{max_price} "
f"aliases={len(user_aliases)} link_preview={link_preview} "
f"min_avg_price_delta={min_avg_price_delta} "
f"immediate_on_size_delta={immediate_on_size_delta} "
f"immediate_size_delta_min={immediate_size_delta_min} "