feat: strategy records dual panels with filters and 100-row cap

Split trend and roll snapshot lists with expandable rows, client filters, and DB prune to latest 100 entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-04 10:55:34 +08:00
parent 7037dc2334
commit f1e95afb89
3 changed files with 402 additions and 72 deletions
+15 -4
View File
@@ -6,12 +6,23 @@ from typing import Any
from flask import flash, redirect, url_for
from strategy_snapshot_lib import list_strategy_snapshots
from strategy_snapshot_lib import (
STRATEGY_SNAPSHOTS_MAX_ROWS,
list_strategy_snapshots_split,
)
def load_strategy_records_page(conn, *, limit: int = 200) -> dict[str, Any]:
snaps = list_strategy_snapshots(conn, limit=limit)
return {"strategy_snapshots": snaps, "strategy_records_limit": limit}
def load_strategy_records_page(
conn, *, limit: int = STRATEGY_SNAPSHOTS_MAX_ROWS
) -> dict[str, Any]:
trend, roll, symbols = list_strategy_snapshots_split(conn, limit=limit)
return {
"strategy_trend_records": trend,
"strategy_roll_records": roll,
"strategy_record_symbols": symbols,
"strategy_records_limit": limit,
"strategy_snapshots": trend + roll,
}
def register_strategy_records(app, cfg: dict[str, Any]) -> None: