Hide SIM label in WeCom; count completed rounds from closed groups.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -119,7 +119,7 @@ class StrategyEngine:
|
||||
return {
|
||||
"running": bool(row["running"]),
|
||||
"phase": row["phase"],
|
||||
"rounds_done": int(row["rounds_done"] or 0),
|
||||
"rounds_done": self._closed_rounds(),
|
||||
"window_key": row["window_key"],
|
||||
"rest_until_ms": rest_until,
|
||||
"rest_left_sec": rest_left,
|
||||
@@ -266,11 +266,16 @@ class StrategyEngine:
|
||||
"""全平成功后进入组间休息(自动 / 手动 / 紧急共用)。"""
|
||||
self._after_close()
|
||||
|
||||
def _closed_rounds(self) -> int:
|
||||
"""已完成组数 = 已平仓组数量(与顶栏总交易口径一致,避免计数漂移)。"""
|
||||
row = self.db.fetchone(
|
||||
"SELECT COUNT(*) AS n FROM groups WHERE status='closed'"
|
||||
)
|
||||
return int(row["n"] or 0) if row else 0
|
||||
|
||||
def _after_close(self) -> None:
|
||||
s = get_settings()
|
||||
row = self.db.fetchone("SELECT * FROM strategy_state WHERE id=1")
|
||||
assert row is not None
|
||||
rounds = int(row["rounds_done"] or 0) + 1
|
||||
rounds = self._closed_rounds()
|
||||
rest_sec = self.ledger.get_setting_int("rest_seconds", s.rest_seconds)
|
||||
rest_until = int(time.time() * 1000) + rest_sec * 1000
|
||||
self._set_state(
|
||||
|
||||
Reference in New Issue
Block a user