From 8849ef8fe63e4e796d597b5acaf7eac3d02babb7 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 25 May 2026 02:57:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=AE=BD=E6=89=AB=E6=8F=8F=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E7=A1=AC=E8=BF=87=E6=BB=A4=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E9=80=82=E9=85=8D=20Polymarket=20=E4=BD=8E=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E6=80=A7=E9=95=BF=E5=B0=BE=E6=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit min_price 0.05→0.001,max_price 0.95→0.999,min_liquidity 500→50, max_spread 0.03→0.2,edge 过滤从定向改为绝对值以捕获空头信号。 --- src/data_collection/polymarket_readonly.py | 10 +++++----- tests/test_polymarket_readonly.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data_collection/polymarket_readonly.py b/src/data_collection/polymarket_readonly.py index 42863590..b12c0fca 100644 --- a/src/data_collection/polymarket_readonly.py +++ b/src/data_collection/polymarket_readonly.py @@ -434,7 +434,7 @@ class PolymarketReadOnlyLayer: 200, ) self.min_liquidity_for_signal = ( - _safe_float(os.getenv("POLYMARKET_SIGNAL_MIN_LIQUIDITY")) or 500.0 + _safe_float(os.getenv("POLYMARKET_SIGNAL_MIN_LIQUIDITY")) or 50.0 ) self.edge_threshold = _safe_float(os.getenv("POLYMARKET_SIGNAL_EDGE_PCT")) or 2.0 fast_price_only = _safe_bool(os.getenv("POLYMARKET_FAST_PRICE_ONLY", "false")) @@ -2804,9 +2804,9 @@ class PolymarketReadOnlyLayer: min_price = _clamp_float(_safe_float(raw.get("min_price")), 0.0, 1.0) max_price = _clamp_float(_safe_float(raw.get("max_price")), 0.0, 1.0) if min_price is None: - min_price = 0.05 + min_price = 0.001 if max_price is None: - max_price = 0.95 + max_price = 0.999 if min_price > max_price: min_price, max_price = max_price, min_price @@ -2827,7 +2827,7 @@ class PolymarketReadOnlyLayer: "market_type": str(raw.get("market_type") or "maxtemp").strip().lower() or "maxtemp", "time_range": str(raw.get("time_range") or "today").strip().lower() or "today", "limit": max(1, _safe_int(raw.get("limit"), 60)), - "max_spread": max(0.0, _safe_float(raw.get("max_spread")) or 0.03), + "max_spread": max(0.0, _safe_float(raw.get("max_spread")) or 0.2), } def _build_window_meta( @@ -3691,7 +3691,7 @@ class PolymarketReadOnlyLayer: _reason = "order_book_disabled" elif ask < filters["min_price"] or ask > filters["max_price"]: _reason = f"price_range ask={ask} min={filters['min_price']} max={filters['max_price']}" - elif edge_percent < filters["min_edge_pct"]: + elif abs(edge_percent) < filters["min_edge_pct"]: _reason = f"edge_too_low edge={edge_percent} min={filters['min_edge_pct']}" elif spread is not None and spread > filters["max_spread"]: _reason = f"spread_too_wide spread={spread} max={filters['max_spread']}" diff --git a/tests/test_polymarket_readonly.py b/tests/test_polymarket_readonly.py index 810a0a7b..d2d180e5 100644 --- a/tests/test_polymarket_readonly.py +++ b/tests/test_polymarket_readonly.py @@ -732,7 +732,7 @@ def test_distribution_scan_hard_filters_block_unusable_extreme_quotes(): "buy": 0.99 if token_id.startswith("yes") else 0.01, "sell": 0.95 if token_id.startswith("yes") else 0.0, "midpoint": 0.97 if token_id.startswith("yes") else 0.03, - "spread": 0.04, + "spread": 0.3, "book_liquidity": 100, } for token_id in token_ids