优化时间戳处理,使用本地时区转换以提高准确性
This commit is contained in:
7
main.py
7
main.py
@@ -3,7 +3,7 @@
|
||||
import json
|
||||
import time
|
||||
import subprocess
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
from collections import defaultdict
|
||||
import logging
|
||||
from pathlib import Path
|
||||
@@ -70,9 +70,8 @@ def calculate_daily_stats(transactions):
|
||||
)
|
||||
|
||||
for tx in transactions:
|
||||
date = datetime.fromtimestamp(tx["blockTimestamp"], timezone.utc).strftime(
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
# 使用本地时区转换时间戳
|
||||
date = datetime.fromtimestamp(tx["blockTimestamp"]).strftime("%Y-%m-%d")
|
||||
price = tx.get("price", 0)
|
||||
tokens_sold = tx.get("tokensSold", 0)
|
||||
|
||||
|
Reference in New Issue
Block a user