Allow roll add-ons while position-limit freeze is active.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -142,27 +142,8 @@ def entry_reason_for_monitor_type(monitor_type: str | None) -> str:
|
||||
|
||||
|
||||
def order_monitor_excluded_from_position_limit(conn, row) -> bool:
|
||||
"""趋势回调 / 顺势加仓不计入 MAX_ACTIVE_POSITIONS 与仓位上限冻结。"""
|
||||
if order_monitor_source_type(row) in (MONITOR_TYPE_TREND_PULLBACK, MONITOR_TYPE_ROLL):
|
||||
return True
|
||||
oid = None
|
||||
try:
|
||||
keys = row.keys() if hasattr(row, "keys") else []
|
||||
if "id" in keys and row["id"] is not None:
|
||||
oid = int(row["id"])
|
||||
except Exception:
|
||||
oid = None
|
||||
if oid and oid > 0:
|
||||
try:
|
||||
hit = conn.execute(
|
||||
"SELECT 1 FROM roll_groups WHERE order_monitor_id=? AND status='active' LIMIT 1",
|
||||
(oid,),
|
||||
).fetchone()
|
||||
if hit is not None:
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
"""趋势回调不计入 MAX_ACTIVE_POSITIONS;顺势加仓在已有持仓上操作,单独放行。"""
|
||||
return order_monitor_source_type(row) == MONITOR_TYPE_TREND_PULLBACK
|
||||
|
||||
|
||||
def count_position_limit_active_monitors(conn) -> int:
|
||||
|
||||
Reference in New Issue
Block a user