Show tablet trade records as close-record table with action column.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -77,6 +77,21 @@ def purge_duplicate_local_trade_logs(conn) -> int:
|
||||
return removed
|
||||
|
||||
|
||||
def _attach_symbol_meta(t: dict[str, Any]) -> None:
|
||||
try:
|
||||
from symbols import position_symbol_meta
|
||||
|
||||
sym = (t.get("symbol") or "").strip()
|
||||
meta = position_symbol_meta(sym)
|
||||
if not t.get("symbol_name"):
|
||||
t["symbol_name"] = meta.get("name") or sym
|
||||
t["symbol_exchange"] = meta.get("exchange") or ""
|
||||
t["symbol_is_main"] = bool(meta.get("is_main"))
|
||||
except Exception:
|
||||
t.setdefault("symbol_exchange", "")
|
||||
t.setdefault("symbol_is_main", False)
|
||||
|
||||
|
||||
def enrich_trades_for_records(
|
||||
trades: list[dict[str, Any]],
|
||||
*,
|
||||
@@ -92,6 +107,7 @@ def enrich_trades_for_records(
|
||||
curve: list[dict[str, Any]] = []
|
||||
|
||||
for t in chrono:
|
||||
_attach_symbol_meta(t)
|
||||
pnl_net = float(t.get("pnl_net") or 0)
|
||||
eq = t.get("equity_after")
|
||||
if eq is None:
|
||||
|
||||
Reference in New Issue
Block a user