From 22082b9a83524eaa35333290a2aff16ce198130a Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Thu, 12 Mar 2026 08:17:11 +0800 Subject: [PATCH] feat: add Polymarket wallet activity watcher and update .env example with its configuration. --- .env.example | 2 ++ src/onchain/polymarket_wallet_activity_watcher.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 10529fcf..2af711d4 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/src/onchain/polymarket_wallet_activity_watcher.py b/src/onchain/polymarket_wallet_activity_watcher.py index 4fc45ac4..8bf4bf85 100644 --- a/src/onchain/polymarket_wallet_activity_watcher.py +++ b/src/onchain/polymarket_wallet_activity_watcher.py @@ -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} "