Add fleet stats table with funds, fees, loss streak, and totals.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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
|
||||
)
|
||||
Reference in New Issue
Block a user