Add fleet stats table with funds, fees, loss streak, and totals.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-02 12:25:30 +08:00
parent 5982cb7414
commit 8745d8e6d1
5 changed files with 298 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
"""统计汇总:最大单笔亏损、连亏次数。"""
from __future__ import annotations
from app.api.stats import _current_loss_streak
def test_current_loss_streak() -> None:
assert _current_loss_streak([]) == 0
assert (
_current_loss_streak(
[
{"realized_pnl": 10},
{"realized_pnl": -1},
{"realized_pnl": -2},
]
)
== 2
)
assert (
_current_loss_streak(
[
{"realized_pnl": -5},
{"realized_pnl": 1},
]
)
== 0
)