From 43b7c1b480fe81cf2e6f006a7fec82d1ba743b97 Mon Sep 17 00:00:00 2001
From: "2569718930@qq.com" <2569718930@qq.com>
Date: Fri, 6 Mar 2026 12:31:15 +0800
Subject: [PATCH] feat: Implement PolyWeather application with a map-based
frontend, Python web services, market alert engine, and supporting utilities.
---
.env.example | 3 -
frontend/app/api/polymarket/[name]/route.ts | 53 --
frontend/app/page.tsx | 2 +-
frontend/public/legacy/index.html | 10 +-
frontend/public/static/app.js | 231 -------
frontend/public/static/style.css | 152 -----
src/analysis/market_alert_engine.py | 342 ++++------
src/data_collection/polymarket_client.py | 673 --------------------
src/utils/config_loader.py | 7 -
src/utils/telegram_push.py | 20 +-
tests/test_market_alert_engine.py | 72 ++-
tests/test_polymarket_client.py | 90 ---
web/app.py | 121 ----
web/static/app.js | 231 -------
web/static/index.html | 8 -
web/static/style.css | 152 -----
16 files changed, 159 insertions(+), 2008 deletions(-)
delete mode 100644 frontend/app/api/polymarket/[name]/route.ts
delete mode 100644 src/data_collection/polymarket_client.py
delete mode 100644 tests/test_polymarket_client.py
diff --git a/.env.example b/.env.example
index 7a77c9b7..2725fbe1 100644
--- a/.env.example
+++ b/.env.example
@@ -1,6 +1,3 @@
-# Polymarket API Credentials
-POLYMARKET_API_KEY=your_api_key_here
-
# Telegram Bot
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
diff --git a/frontend/app/api/polymarket/[name]/route.ts b/frontend/app/api/polymarket/[name]/route.ts
deleted file mode 100644
index 63b24928..00000000
--- a/frontend/app/api/polymarket/[name]/route.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { NextRequest, NextResponse } from "next/server";
-
-const API_BASE = process.env.POLYWEATHER_API_BASE_URL;
-
-export async function GET(
- req: NextRequest,
- context: { params: Promise<{ name: string }> },
-) {
- if (!API_BASE) {
- return NextResponse.json(
- { error: "POLYWEATHER_API_BASE_URL is not configured" },
- { status: 500 },
- );
- }
-
- const { name } = await context.params;
- const params = new URLSearchParams();
- const forceRefresh = req.nextUrl.searchParams.get("force_refresh");
- const targetDate = req.nextUrl.searchParams.get("target_date");
-
- if (forceRefresh != null) {
- params.set("force_refresh", forceRefresh);
- }
- if (targetDate) {
- params.set("target_date", targetDate);
- }
-
- const qs = params.toString();
- const url = `${API_BASE}/api/polymarket/${encodeURIComponent(name)}${qs ? `?${qs}` : ""}`;
-
- try {
- const res = await fetch(url, {
- headers: { Accept: "application/json" },
- cache: "no-store",
- });
-
- if (!res.ok) {
- const raw = await res.text();
- return NextResponse.json(
- { error: `Backend returned ${res.status}`, detail: raw.slice(0, 300) },
- { status: 502 },
- );
- }
-
- const data = await res.json();
- return NextResponse.json(data);
- } catch (error) {
- return NextResponse.json(
- { error: "Failed to fetch polymarket snapshot", detail: String(error) },
- { status: 500 },
- );
- }
-}
diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx
index 852e2630..f1568265 100644
--- a/frontend/app/page.tsx
+++ b/frontend/app/page.tsx
@@ -3,7 +3,7 @@ export default function HomePage() {
diff --git a/frontend/public/legacy/index.html b/frontend/public/legacy/index.html
index 4f61347f..e46673a7 100644
--- a/frontend/public/legacy/index.html
+++ b/frontend/public/legacy/index.html
@@ -108,14 +108,6 @@
-
- Market Prices
-
-
-
-
-
-
๐ฌ ๅคๆจกๅ้ขๆฅ
@@ -222,4 +214,4 @@