style: Clean up code formatting for improved readability
CI / lint-test-build (push) Failing after 14s
CI / lint-test-build (push) Failing after 14s
This commit is contained in:
@@ -30,8 +30,7 @@ def _parse_balances(raw: str) -> Mapping[str, float]:
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Run a deterministic replay backtest.")
|
||||
parser = argparse.ArgumentParser(description="Run a deterministic replay backtest.")
|
||||
parser.add_argument("--events", type=Path, required=True)
|
||||
parser.add_argument("--starting-balances", type=str, default="USD=1000.0")
|
||||
parser.add_argument("--trade-capital", type=float, default=100.0)
|
||||
@@ -56,18 +55,15 @@ def main() -> int:
|
||||
started_at=events[0].occurred_at if events else datetime.now(UTC),
|
||||
)
|
||||
report = asyncio.run(
|
||||
engine.run(events, starting_balances=_parse_balances(
|
||||
args.starting_balances))
|
||||
engine.run(events, starting_balances=_parse_balances(args.starting_balances))
|
||||
)
|
||||
|
||||
print("Backtest report:")
|
||||
print(f"- processed_events: {report.processed_events}")
|
||||
print(f"- opportunities_seen: {report.opportunities_seen}")
|
||||
print(f"- trades_executed: {report.trades_executed}")
|
||||
print(
|
||||
f"- win_rate: {report.win_rate if report.win_rate is not None else 'n/a'}")
|
||||
print(
|
||||
f"- fill_rate: {report.fill_rate if report.fill_rate is not None else 'n/a'}")
|
||||
print(f"- win_rate: {report.win_rate if report.win_rate is not None else 'n/a'}")
|
||||
print(f"- fill_rate: {report.fill_rate if report.fill_rate is not None else 'n/a'}")
|
||||
print(f"- realized_pnl_usd: {report.realized_pnl_usd:.4f}")
|
||||
print(f"- max_drawdown_usd: {report.max_drawdown_usd:.4f}")
|
||||
print(f"- miss_reasons: {dict(report.miss_reasons)}")
|
||||
|
||||
@@ -63,16 +63,13 @@ def scan_worktree() -> list[str]:
|
||||
|
||||
for rule_name, pattern in PATTERNS:
|
||||
if pattern.search(content):
|
||||
findings.append(
|
||||
f"worktree:{path.relative_to(WORKSPACE)}:{rule_name}")
|
||||
findings.append(f"worktree:{path.relative_to(WORKSPACE)}:{rule_name}")
|
||||
return findings
|
||||
|
||||
|
||||
def scan_git_history() -> list[str]:
|
||||
cmd = ["git", "-C", str(WORKSPACE), "log", "--all",
|
||||
"-p", "--pretty=format:%H"]
|
||||
completed = subprocess.run(
|
||||
cmd, check=False, capture_output=True, text=True)
|
||||
cmd = ["git", "-C", str(WORKSPACE), "log", "--all", "-p", "--pretty=format:%H"]
|
||||
completed = subprocess.run(cmd, check=False, capture_output=True, text=True)
|
||||
if completed.returncode != 0:
|
||||
return ["history_scan_failed"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user