fix(hub): archive labels, symbol column, and time-close dropdown
Force exchange_key on archive sync; add contract column and tag select styles on inner-light-mind; serve time_close_ui.js on instances so order/key time-close duration can be selected. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+11
-2
@@ -422,6 +422,7 @@ def _existing_trend_plan_ids(conn) -> set[int]:
|
||||
def _normalize_snapshot_archive_row(
|
||||
snap: dict,
|
||||
*,
|
||||
exchange_key: str = "",
|
||||
reset_hour: int = 8,
|
||||
) -> dict[str, Any] | None:
|
||||
result = str(snap.get("result_label") or "").strip()
|
||||
@@ -458,6 +459,7 @@ def _normalize_snapshot_archive_row(
|
||||
entry_type = entry_reason_for_monitor_type(monitor_type) or monitor_type
|
||||
return {
|
||||
"id": -snap_id,
|
||||
"exchange_key": (exchange_key or "").strip().lower(),
|
||||
"symbol": (snap.get("symbol") or "").strip().upper(),
|
||||
"direction": snap.get("direction"),
|
||||
"result": result,
|
||||
@@ -495,6 +497,7 @@ def _parse_ms_from_row(raw: Any) -> int | None:
|
||||
def _fetch_strategy_snapshots_for_archive(
|
||||
conn,
|
||||
*,
|
||||
exchange_key: str = "",
|
||||
days: int = 365,
|
||||
reset_hour: int = 8,
|
||||
limit: int = 2000,
|
||||
@@ -527,7 +530,9 @@ def _fetch_strategy_snapshots_for_archive(
|
||||
source_id = 0
|
||||
if source_id > 0 and source_id in skip:
|
||||
continue
|
||||
norm = _normalize_snapshot_archive_row(d, reset_hour=reset_hour)
|
||||
norm = _normalize_snapshot_archive_row(
|
||||
d, exchange_key=exchange_key, reset_hour=reset_hour
|
||||
)
|
||||
if norm:
|
||||
out.append(norm)
|
||||
if len(out) >= lim:
|
||||
@@ -538,6 +543,7 @@ def _fetch_strategy_snapshots_for_archive(
|
||||
def fetch_trades_for_archive(
|
||||
conn,
|
||||
*,
|
||||
exchange_key: str = "",
|
||||
days: int = 365,
|
||||
row_to_dict_fn: Optional[Callable] = None,
|
||||
reset_hour: int = 8,
|
||||
@@ -565,7 +571,9 @@ def fetch_trades_for_archive(
|
||||
records = []
|
||||
for row in rows:
|
||||
d = _row_dict(row, row_to_dict_fn)
|
||||
norm = _normalize_archive_trade_row(d, reset_hour=reset_hour)
|
||||
norm = _normalize_archive_trade_row(
|
||||
d, exchange_key=exchange_key, reset_hour=reset_hour
|
||||
)
|
||||
if norm:
|
||||
records.append(norm)
|
||||
if len(records) >= lim:
|
||||
@@ -586,6 +594,7 @@ def fetch_trades_for_archive(
|
||||
snaps = _fetch_strategy_snapshots_for_archive(
|
||||
conn,
|
||||
days=days,
|
||||
exchange_key=exchange_key,
|
||||
reset_hour=reset_hour,
|
||||
limit=max(0, lim - len(records)),
|
||||
skip_plan_ids=skip_ids,
|
||||
|
||||
Reference in New Issue
Block a user