Refactor code for improved readability and consistency
CI / lint-test-build (push) Successful in 54s

- Cleaned up multiline statements and removed unnecessary line breaks in various files.
- Ensured consistent formatting in function definitions and calls across the codebase.
- Updated docstrings and comments for clarity where applicable.
- Removed trailing newlines in module docstrings.
- Enhanced logging statements for better clarity in maintenance tasks.
This commit is contained in:
2026-06-07 21:59:09 +02:00
parent f221464daa
commit dc99f1604e
25 changed files with 409 additions and 324 deletions
+60 -10
View File
@@ -42,9 +42,24 @@ async def test_metrics_calculator_summarizes_execution_data() -> None:
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9),
($10, $11, $12, $13, $14, $15, $16, $17, $18)
""",
"trade-1", started, finished, "filled", 12.5, 10.0, 100.0, "USD->BTC->ETH->USD", 3,
"trade-2", started_two, finished_two, "filled", -
4.5, -2.0, 200.0, "USD->ETH->BTC->USD", 3,
"trade-1",
started,
finished,
"filled",
12.5,
10.0,
100.0,
"USD->BTC->ETH->USD",
3,
"trade-2",
started_two,
finished_two,
"filled",
-4.5,
-2.0,
200.0,
"USD->ETH->BTC->USD",
3,
)
await conn.execute(
"""
@@ -53,11 +68,24 @@ async def test_metrics_calculator_summarizes_execution_data() -> None:
($7, $8, $9, $10, $11, $12),
($13, $14, $15, $16, $17, $18)
""",
started, "USD->BTC->ETH->USD", 4.0, 3.0, 0.03, True,
started_two, "USD->ETH->BTC->USD", 2.0, 1.0, 0.01, False,
started_two +
timedelta(
seconds=30), "USD->BTC->ETH->USD", 5.0, 4.0, 0.04, True,
started,
"USD->BTC->ETH->USD",
4.0,
3.0,
0.03,
True,
started_two,
"USD->ETH->BTC->USD",
2.0,
1.0,
0.01,
False,
started_two + timedelta(seconds=30),
"USD->BTC->ETH->USD",
5.0,
4.0,
0.04,
True,
)
await conn.execute(
"""
@@ -67,8 +95,30 @@ async def test_metrics_calculator_summarizes_execution_data() -> None:
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12),
($13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24)
""",
"trade-1", "order-1", 0, "BTC/USD", "buy", 2.0, 101, "closed", 2.0, 100.0, "{}", started,
"trade-2", "order-2", 0, "ETH/USD", "sell", 4.0, 202, "closed", 3.0, 200.0, "{}", started_two,
"trade-1",
"order-1",
0,
"BTC/USD",
"buy",
2.0,
101,
"closed",
2.0,
100.0,
"{}",
started,
"trade-2",
"order-2",
0,
"ETH/USD",
"sell",
4.0,
202,
"closed",
3.0,
200.0,
"{}",
started_two,
)
metrics = await MetricsCalculator(store).compute()