Add daily loss force-flatten at configurable equity limit
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -818,6 +818,12 @@ def _execute_local_close(
|
||||
direction = (mon.get("direction") or "long").strip().lower()
|
||||
if close_pending_active(sym, direction):
|
||||
return
|
||||
try:
|
||||
from modules.risk.account_risk_lib import should_skip_sl_tp_for_daily_loss
|
||||
if should_skip_sl_tp_for_daily_loss(conn):
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
positions = ctp_list_positions(mode)
|
||||
pos = _find_position(positions, sym, direction)
|
||||
if not pos:
|
||||
@@ -849,6 +855,7 @@ def _execute_local_close(
|
||||
lots=lots,
|
||||
price=mark,
|
||||
order_type="market",
|
||||
urgency="stop_loss",
|
||||
)
|
||||
mark_close_pending(sym, direction)
|
||||
_close_all_monitors_for_symbol(conn, sym, direction)
|
||||
|
||||
Reference in New Issue
Block a user