fix: max_trades=99, leverage per symbol, crash recovery, test_live.py

- max_trades=99 в config/backtest — стратегия находит ВСЕ входы,
  лимит позиций контролирует executor (Phase 2)
- leverage setup per symbol (set[str] вместо bool)
- crash recovery: get_today_trade_keys() восстанавливает last_trade_ids
- flash trade exit по new_positions[-1] (slippage-safe)
- last_trade_ids.add() только в Phase 2 для исполненных трейдов
- test_live.py: cfg.strategy → per-symbol strat_cfg
- backtest_wf: risk 5%, max_trades=[99]
- cli daemon: per-symbol params display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-13 18:46:28 +10:00
co-authored by Claude Opus 4.6
parent e2d2dcbc4b
commit 650ab61168
7 changed files with 56 additions and 36 deletions
+8 -5
View File
@@ -98,13 +98,14 @@ def history(limit):
return
click.echo()
click.echo(f" {'Date':<12s} {'Dir':>6s} {'Entry':>10s} {'Exit':>10s} "
click.echo(f" {'Date':<12s} {'Sym':>4s} {'Dir':>6s} {'Entry':>10s} {'Exit':>10s} "
f"{'PnL':>10s} {'Reason':>6s}")
click.echo(f" {'─' * 58}")
click.echo(f" {'─' * 62}")
for t in reversed(trades):
pnl = t["pnl_net"] or 0
click.echo(f" {t['date']:<12s} {t['direction'].upper():>6s} "
tag = (t.get("symbol") or "").split("/")[0] or "?"
click.echo(f" {t['date']:<12s} {tag:>4s} {t['direction'].upper():>6s} "
f"${t['entry_price']:>9,.2f} ${(t['exit_price'] or 0):>9,.2f} "
f"${pnl:>+9,.2f} {(t['exit_reason'] or ''):>6s}")
@@ -122,8 +123,10 @@ def daemon():
symbols = ", ".join(s.split("/")[0] for s in cfg.symbols.keys())
click.echo(f"scalp-bot daemon starting ({cfg.mode} mode, {symbols})")
click.echo(f"Strategy: RR={cfg.strategy.rr_ratio} OR={cfg.strategy.or_minutes}m "
f"max_trades={cfg.strategy.max_trades}")
for sym, sc in cfg.symbols.items():
tag = sym.split("/")[0]
click.echo(f" {tag}: RR={sc.rr_ratio} OR={sc.or_minutes}m max={sc.max_trades} "
f"fvg_exp={sc.fvg_expiry} fvg_only={sc.first_fvg_only}")
click.echo(f"Risk: {cfg.risk.per_trade*100:.0f}% per trade, {cfg.risk.leverage}x leverage")
def scheduled_cycle():