Allow roll add-ons while position-limit freeze is active.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -499,7 +499,8 @@ class AccountRiskLibTests(unittest.TestCase):
|
||||
self.assertEqual(st["status_label"], "仓位上限冻结")
|
||||
self.assertFalse(st["can_trade"])
|
||||
self.assertIn("2/2", st["reason"])
|
||||
self.assertIn("不含趋势回调", st["reason"])
|
||||
self.assertIn("顺势加仓", st["reason"])
|
||||
self.assertTrue(st.get("can_roll"))
|
||||
self.assertEqual(st["max_active_positions"], 2)
|
||||
|
||||
def test_position_limit_normal_when_under_cap(self):
|
||||
|
||||
@@ -3,7 +3,6 @@ import unittest
|
||||
|
||||
from strategy_db import init_strategy_tables
|
||||
from strategy_trade_labels import (
|
||||
MONITOR_TYPE_ROLL,
|
||||
MONITOR_TYPE_TREND_PULLBACK,
|
||||
count_position_limit_active_monitors,
|
||||
)
|
||||
@@ -47,16 +46,7 @@ class PositionLimitCountTests(unittest.TestCase):
|
||||
conn.commit()
|
||||
self.assertEqual(count_position_limit_active_monitors(conn), 0)
|
||||
|
||||
def test_roll_monitor_type_excluded(self):
|
||||
conn = _mem_conn()
|
||||
conn.execute(
|
||||
"INSERT INTO order_monitors (symbol, status, monitor_type) VALUES ('ETH/USDT', 'active', ?)",
|
||||
(MONITOR_TYPE_ROLL,),
|
||||
)
|
||||
conn.commit()
|
||||
self.assertEqual(count_position_limit_active_monitors(conn), 0)
|
||||
|
||||
def test_active_roll_group_excludes_monitor(self):
|
||||
def test_active_roll_group_still_counts_regular_monitor(self):
|
||||
conn = _mem_conn()
|
||||
conn.execute(
|
||||
"INSERT INTO order_monitors (id, symbol, status, monitor_type) VALUES (1, 'ETH/USDT', 'active', '下单监控')"
|
||||
@@ -67,7 +57,7 @@ class PositionLimitCountTests(unittest.TestCase):
|
||||
VALUES (1, 'ETH/USDT', 'long', 'active')"""
|
||||
)
|
||||
conn.commit()
|
||||
self.assertEqual(count_position_limit_active_monitors(conn), 0)
|
||||
self.assertEqual(count_position_limit_active_monitors(conn), 1)
|
||||
|
||||
def test_mixed_monitors(self):
|
||||
conn = _mem_conn()
|
||||
|
||||
Reference in New Issue
Block a user