feat: Add Polymarket API client for enhanced market price fetching and include local time in bot output.

This commit is contained in:
2569718930@qq.com
2026-02-06 21:53:05 +08:00
parent e0aefbcea7
commit 35db1e3839
4 changed files with 63 additions and 22 deletions
+12 -2
View File
@@ -211,12 +211,22 @@ class WeatherDataCollector:
data = response.json()
current = data.get("current_weather", {})
utc_offset = data.get("utc_offset_seconds", 0)
timezone_name = data.get("timezone", "UTC")
# 计算精确的当地时间而不是气象站 bucket 时间
now_utc = datetime.utcnow()
local_now = now_utc + timedelta(seconds=utc_offset)
local_time_str = local_now.strftime("%Y-%m-%d %H:%M")
return {
"source": "open-meteo",
"timestamp": datetime.utcnow().isoformat(),
"timestamp": now_utc.isoformat(),
"timezone": timezone_name,
"utc_offset": utc_offset,
"current": {
"temp": current.get("temperature"),
"local_time": current.get("time", "").replace("T", " "),
"local_time": local_time_str,
},
"daily": data.get("daily", {}),
"unit": "fahrenheit" if use_fahrenheit else "celsius",