fix: показывать статус открытой позиции в cycle log

Раньше при удержании позиции без стоп-события лог был пустым,
теперь выводит "holding LONG/SHORT @ price (stop, current price)".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-08 23:30:32 +10:00
co-authored by Claude Opus 4.6
parent fedf2f3e37
commit d97bf3a7f0
+4
View File
@@ -60,6 +60,10 @@ def run_cycle(conn: sqlite3.Connection, cfg: Config) -> list[str]:
msg = _check_position(conn, pos, prices, dates, asset, asset_cfg, cfg)
if msg:
logs.append(f"{ticker}: {msg}")
else:
dir_str = "LONG" if pos["direction"] == 1 else "SHORT"
logs.append(f"{ticker}: holding {dir_str} @ ${pos['entry_price']:,.2f} "
f"(stop ${pos['stop_price']:,.2f}, price ${last_price:,.2f})")
# Re-fetch asset after potential close
asset = _get_or_skip(conn, ticker)
pos = get_open_position(conn, ticker)