From 56ddce4be0ccdb018ba3d606c9007d5507d1832d Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 25 May 2026 17:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=B8=B4=E6=97=B6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scratch_query_gamma.py | 36 ------------------------------- scratch_query_slugs.py | 23 -------------------- scratch_search_markets.py | 43 -------------------------------------- scratch_test_pagination.py | 42 ------------------------------------- 4 files changed, 144 deletions(-) delete mode 100644 scratch_query_gamma.py delete mode 100644 scratch_query_slugs.py delete mode 100644 scratch_search_markets.py delete mode 100644 scratch_test_pagination.py diff --git a/scratch_query_gamma.py b/scratch_query_gamma.py deleted file mode 100644 index c0868d3f..00000000 --- a/scratch_query_gamma.py +++ /dev/null @@ -1,36 +0,0 @@ -import httpx - -gamma_url = "https://gamma-api.polymarket.com" - -# 1. Search markets -print("Searching markets for 'temperature'...") -try: - resp = httpx.get(f"{gamma_url}/markets", params={"active": "true", "search": "temperature", "limit": 100}, timeout=10.0) - data = resp.json() - print(f"Found {len(data)} markets matching 'temperature':") - for m in data[:10]: - print(f" - {m.get('question')} | Slug: {m.get('slug')}") -except Exception as e: - print("Error:", e) - -# 2. Search events -print("\nSearching events for 'temperature'...") -try: - resp = httpx.get(f"{gamma_url}/events", params={"active": "true", "search": "temperature", "limit": 100}, timeout=10.0) - data = resp.json() - print(f"Found {len(data)} events matching 'temperature':") - for e in data[:10]: - print(f" - {e.get('title')} | Slug: {e.get('slug')}") -except Exception as e: - print("Error:", e) - -# 3. Search events for 'weather' -print("\nSearching events for 'weather'...") -try: - resp = httpx.get(f"{gamma_url}/events", params={"active": "true", "search": "weather", "limit": 100}, timeout=10.0) - data = resp.json() - print(f"Found {len(data)} events matching 'weather':") - for e in data[:10]: - print(f" - {e.get('title')} | Slug: {e.get('slug')}") -except Exception as e: - print("Error:", e) diff --git a/scratch_query_slugs.py b/scratch_query_slugs.py deleted file mode 100644 index 0679ef9b..00000000 --- a/scratch_query_slugs.py +++ /dev/null @@ -1,23 +0,0 @@ -import httpx - -gamma_url = "https://gamma-api.polymarket.com" - -cities = ["hong-kong", "beijing", "tokyo", "seoul", "shanghai"] -date_str = "may-25-2026" - -for city in cities: - slug = f"highest-temperature-in-{city}-on-{date_str}" - try: - resp = httpx.get(f"{gamma_url}/events", params={"slug": slug}, timeout=10.0) - data = resp.json() - print(f"Slug: {slug} -> Status: {resp.status_code}") - if data and isinstance(data, list): - print(f" Found Event: {data[0].get('title')} | ID: {data[0].get('id')}") - markets = data[0].get("markets", []) - print(f" Markets: {len(markets)}") - for m in markets: - print(f" - Market: {m.get('question')} | Group: {m.get('group_id')}") - else: - print(" No event found.") - except Exception as e: - print(f" Error for {slug}: {e}") diff --git a/scratch_search_markets.py b/scratch_search_markets.py deleted file mode 100644 index 679dcd8a..00000000 --- a/scratch_search_markets.py +++ /dev/null @@ -1,43 +0,0 @@ -import httpx - -gamma_url = "https://gamma-api.polymarket.com" -all_markets = [] -offset = 0 -limit = 100 - -while True: - params = { - "archived": "false", - "limit": limit, - "offset": offset, - "active": "true", - "closed": "false" - } - try: - resp = httpx.get(f"{gamma_url}/markets", params=params, timeout=10.0) - batch = resp.json() - except Exception as e: - print("Fetch error:", e) - break - if not isinstance(batch, list) and isinstance(batch, dict): - batch = batch.get("markets", []) - if not batch: - break - all_markets.extend(batch) - if len(batch) < limit: - break - offset += len(batch) - -print(f"Total active markets: {len(all_markets)}") - -cities = ["beijing", "tokyo", "seoul", "shanghai", "singapore", "manila", "jakarta", "taipei", "hong kong", "busan", "shenzhen"] - -for city in cities: - matched = [] - for m in all_markets: - q = m.get("question", "").lower() - if city in q: - matched.append(m) - print(f"City '{city}': matched {len(matched)} active markets") - for m in matched: - print(f" - {m.get('question')} (slug: {m.get('slug')})") diff --git a/scratch_test_pagination.py b/scratch_test_pagination.py deleted file mode 100644 index 2b658e28..00000000 --- a/scratch_test_pagination.py +++ /dev/null @@ -1,42 +0,0 @@ -import httpx - -gamma_url = "https://gamma-api.polymarket.com" -all_markets = [] -offset = 0 -limit = 100 -pages = 10 - -for page in range(pages): - params = { - "archived": "false", - "limit": limit, - "offset": offset, - "active": "true", - "closed": "false" - } - resp = httpx.get(f"{gamma_url}/markets", params=params) - batch = resp.json() - if not isinstance(batch, list) and isinstance(batch, dict): - batch = batch.get("markets", []) - - if not batch: - print(f"Page {page}: No more markets.") - break - - all_markets.extend(batch) - print(f"Page {page}: Fetched {len(batch)} markets (total: {len(all_markets)})") - if len(batch) < limit: - print(f"Page {page}: Batch size {len(batch)} < limit {limit}. Stopping.") - break - offset += len(batch) - -weather_markets = [] -for m in all_markets: - q = m.get("question", "").lower() - if "temperature" in q or "weather" in q or "highest temperature" in q: - weather_markets.append(m) - -print(f"\nTotal active markets found: {len(all_markets)}") -print(f"Total weather markets found: {len(weather_markets)}") -for wm in weather_markets[:20]: - print(f"- Question: {wm.get('question')} | Slug: {wm.get('slug')}")