"""统计汇总：最大单笔亏损、连亏次数。"""

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
    )
