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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user