feat(backtest): show each cell as it starts, and the run id to continue with

- run_backtest takes a progress(done, total, ticker, date) callback; tradingagents backtest prints [n/total] per cell and ends with the --run-id that continues or settles the sweep
This commit is contained in:
Yijia-Xiao
2026-09-29 05:57:17 +00:00
parent 052a98d6eb
commit f4828b84ea
4 changed files with 59 additions and 13 deletions
+5 -1
View File
@@ -125,7 +125,10 @@ def backtest(
console.print("[red]No ticker to analyze; pass them comma-separated, e.g. NVDA,AAPL[/red]")
raise typer.Exit(code=1)
kwargs = {"asset_type": asset_type, "portfolio": book, "run_id": run_id}
def show_progress(done, total, ticker, date):
console.print(f"[dim][{done}/{total}] {ticker} {date}[/dim]")
kwargs = {"asset_type": asset_type, "portfolio": book, "run_id": run_id, "progress": show_progress}
if analysts:
kwargs["selected_analysts"] = [a.strip().lower() for a in analysts.split(",") if a.strip()]
@@ -136,6 +139,7 @@ def backtest(
raise typer.Exit(code=1) from None
console.print(summarize(result).render())
console.print(f"\nRan {result.cells_run} cells, skipped {result.skipped}. Log: {result.log_path}")
console.print(f"Continue or settle this sweep: --run-id {result.run_id}")
for ticker, date, reason in result.failures:
console.print(f"[yellow]failed:[/yellow] {ticker} {date}: {reason}")
for ticker, reason in result.settlement_failures: