From a6bef9a57fa0469bc1663cd6b6bed59bb8eb80ee Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Wed, 11 Mar 2026 00:55:11 +0800 Subject: [PATCH] feat: wallet activity filter max_price to 0.10 and apply price filter to closed positions --- .env.example | 4 +++- src/onchain/polymarket_wallet_activity_watcher.py | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 53d3e7ca..f2dd1d6d 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,8 @@ TELEGRAM_ALERT_PUSH_INTERVAL_SEC=300 TELEGRAM_ALERT_PUSH_COOLDOWN_SEC=1800 TELEGRAM_ALERT_MIN_TRIGGER_COUNT=2 TELEGRAM_ALERT_MIN_SEVERITY=medium +# Mispricing radar: skip push when YES buy price is above this cap (10c = 0.10) +TELEGRAM_ALERT_MISPRICING_MAX_YES_BUY=0.10 TELEGRAM_ALERT_CITIES=ankara,london,paris,seoul,toronto,buenos aires,wellington,new york,chicago,dallas,miami,atlanta,seattle,lucknow,sao paulo,munich # AI @@ -62,7 +64,7 @@ POLYMARKET_WALLET_ACTIVITY_TIMEOUT_SEC=10 POLYMARKET_WALLET_ACTIVITY_MIN_SIZE_ABS=0.001 POLYMARKET_WALLET_ACTIVITY_MIN_SIZE_DELTA=0.001 POLYMARKET_WALLET_ACTIVITY_MAX_CHANGES_PER_MSG=5 -POLYMARKET_WALLET_ACTIVITY_NOTIFY_CLOSED=true +POLYMARKET_WALLET_ACTIVITY_NOTIFY_CLOSED=false POLYMARKET_WALLET_ACTIVITY_BOOTSTRAP_ALERT=false POLYMARKET_WALLET_ACTIVITY_AVG_PRICE_SHOW_MIN=0.01 POLYMARKET_WALLET_ACTIVITY_AVG_PRICE_SHOW_MAX=0.99 diff --git a/src/onchain/polymarket_wallet_activity_watcher.py b/src/onchain/polymarket_wallet_activity_watcher.py index d9d1e00d..58072388 100644 --- a/src/onchain/polymarket_wallet_activity_watcher.py +++ b/src/onchain/polymarket_wallet_activity_watcher.py @@ -232,7 +232,11 @@ def _diff_positions( if notify_closed: for key, old_pos in previous.items(): if key not in current: - # 关闭仓位时通常也检查一下关闭时的价格(如果需要的话,这里暂时保留 notify_closed 逻辑) + # 关仓也按价格过滤:只推送买入价在 [min_price, max_price] 范围内的关仓 + closed_price = _safe_float(old_pos.get("avg_price")) + if closed_price < min_price or closed_price > max_price: + logger.debug(f"skipped closed position due to price range limit: market={old_pos.get('title')} price={closed_price}") + continue changes.append(("closed", old_pos)) return changes @@ -363,7 +367,7 @@ def start_polymarket_wallet_activity_loop(bot: Any) -> Optional[threading.Thread min_size_abs = max(0.0, _env_float("POLYMARKET_WALLET_ACTIVITY_MIN_SIZE_ABS", 0.001)) min_size_delta = max(0.0, _env_float("POLYMARKET_WALLET_ACTIVITY_MIN_SIZE_DELTA", 0.001)) max_changes = max(1, _env_int("POLYMARKET_WALLET_ACTIVITY_MAX_CHANGES_PER_MSG", 5)) - notify_closed = _env_bool("POLYMARKET_WALLET_ACTIVITY_NOTIFY_CLOSED", True) + notify_closed = _env_bool("POLYMARKET_WALLET_ACTIVITY_NOTIFY_CLOSED", False) bootstrap_alert = _env_bool("POLYMARKET_WALLET_ACTIVITY_BOOTSTRAP_ALERT", False) # 价格过滤范围配置 @@ -453,4 +457,3 @@ def start_polymarket_wallet_activity_loop(bot: Any) -> Optional[threading.Thread -