blob: f5c694c907464fe930f5e434131bb85f3646ef8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
"""Tests for the report formatter."""
from decimal import Decimal
from backtester.engine import BacktestResult
from backtester.reporter import format_report
def test_format_report_contains_key_metrics():
result = BacktestResult(
strategy_name="sma_crossover",
symbol="BTCUSDT",
total_trades=10,
initial_balance=Decimal("10000"),
final_balance=Decimal("11500"),
profit=Decimal("1500"),
profit_pct=Decimal("15"),
trades=[],
)
report = format_report(result)
assert "sma_crossover" in report
assert "BTCUSDT" in report
assert "10000" in report
assert "11500" in report
assert "1500" in report
assert "15" in report
|