summaryrefslogtreecommitdiff
path: root/services/backtester/tests/test_reporter.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 15:56:35 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-01 15:56:35 +0900
commit33b14aaa2344b0fd95d1629627c3d135b24ae102 (patch)
tree90b214758bc3b076baa7711226a1a1be6268e72e /services/backtester/tests/test_reporter.py
parent9360f1a800aa29b40399a2f3bfbfcf215a04e279 (diff)
feat: initial trading platform implementation
Binance spot crypto trading platform with microservices architecture: - shared: Pydantic models, Redis Streams broker, asyncpg DB layer - data-collector: Binance WebSocket/REST market data collection - strategy-engine: Plugin-based strategy execution (RSI, Grid) - order-executor: Order execution with risk management - portfolio-manager: Position tracking and PnL calculation - backtester: Historical strategy testing with simulator - cli: Click-based CLI for all operations - Docker Compose orchestration with Redis and PostgreSQL - 24 test files covering all modules
Diffstat (limited to 'services/backtester/tests/test_reporter.py')
-rw-r--r--services/backtester/tests/test_reporter.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/services/backtester/tests/test_reporter.py b/services/backtester/tests/test_reporter.py
new file mode 100644
index 0000000..f5c694c
--- /dev/null
+++ b/services/backtester/tests/test_reporter.py
@@ -0,0 +1,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