增加k线图

This commit is contained in:
dekun
2026-05-22 13:47:27 +08:00
parent ee621976db
commit 74f98af40d
13 changed files with 543 additions and 8 deletions
+7
View File
@@ -11,6 +11,7 @@ from .db import get_latest_snapshot, init_db, log_push, save_snapshot, was_pushe
from .exceptions import BinanceRateLimitedError
from .periods import get_today_period, get_yesterday_period, now_shanghai
from .state import get_today_cache, set_today_cache
from .kline_store import prefetch_symbols
from .wecom import build_markdown, send_wecom_markdown
logger = logging.getLogger(__name__)
@@ -53,6 +54,9 @@ async def job_finalize_yesterday() -> None:
)
save_snapshot("yesterday", start, end, items)
logger.info("Yesterday snapshot saved: %d items", len(items))
syms = [x["symbol"] for x in items if x.get("symbol")]
if syms:
await prefetch_symbols(syms)
except BinanceRateLimitedError as e:
logger.error("Finalize yesterday rate limited %ss", e.retry_after_sec)
except Exception as e:
@@ -113,6 +117,9 @@ async def job_refresh_today() -> None:
save_snapshot("today", start, end, items)
set_today_cache(meta)
logger.info("Today cache refreshed: %d items", len(items))
syms = [x["symbol"] for x in items if x.get("symbol")]
if syms:
await prefetch_symbols(syms)
except BinanceRateLimitedError as e:
logger.error("Refresh today rate limited %ss — use cache", e.retry_after_sec)
_restore_today_from_db()