清理临时测试脚本
This commit is contained in:
@@ -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)
|
|
||||||
@@ -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}")
|
|
||||||
@@ -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')})")
|
|
||||||
@@ -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')}")
|
|
||||||
Reference in New Issue
Block a user