fix(HEL-356): preserve derived limit streaks
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -80,6 +80,50 @@ class LimitOverlayTests(unittest.TestCase):
|
||||
self.assertEqual(rows[0]["fd_amount"], 82000000)
|
||||
self.assertEqual(rows[0]["turnover_ratio"], 18.4)
|
||||
|
||||
def test_overlay_replaces_provisional_first_board_with_observed_streak(self) -> None:
|
||||
mixin = DailyMarketMixin()
|
||||
mixin._load_limit_lists = lambda trade_date: []
|
||||
mixin.try_limit_pool = lambda trade_date: [
|
||||
{"ts_code": "000737.SZ", "limit_times": 3}
|
||||
]
|
||||
|
||||
rows = mixin._overlay_board_fields(
|
||||
[{"ts_code": "000737.SZ", "limit_times": 1, "limit_type": "U"}],
|
||||
"20260909",
|
||||
)
|
||||
|
||||
self.assertEqual(rows[0]["limit_times"], 3)
|
||||
|
||||
def test_daily_fallback_extends_yesterday_streak(self) -> None:
|
||||
mixin = DailyMarketMixin()
|
||||
mixin.query = lambda *args, **kwargs: []
|
||||
mixin._load_limit_lists = lambda trade_date: []
|
||||
|
||||
rows = mixin._derive_limits(
|
||||
"20260909",
|
||||
[
|
||||
{
|
||||
"ts_code": "000737.SZ",
|
||||
"trade_date": "20260909",
|
||||
"close": 11.0,
|
||||
"high": 11.0,
|
||||
"pct_chg": 10.0,
|
||||
"amount": 100000,
|
||||
}
|
||||
],
|
||||
price_limits=[
|
||||
{"ts_code": "000737.SZ", "up_limit": 11.0, "down_limit": 9.0}
|
||||
],
|
||||
basic_rows=[
|
||||
{"ts_code": "000737.SZ", "name": "北方铜业", "industry": "有色"}
|
||||
],
|
||||
previous_limit_rows=[
|
||||
{"ts_code": "000737.SZ", "limit_times": 2}
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(rows[0]["limit_times"], 3)
|
||||
|
||||
|
||||
class ShenwanRealtimeSourceTests(unittest.TestCase):
|
||||
def test_transport_refuses_rt_sw_k(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user