Add daily loss-count freeze for account risk cooldown.
RISK_DAILY_LOSS_LIMIT (default 2, 0 disables) freezes new opens after N losing closes in the trading day. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -160,6 +160,8 @@ RISK_CONTROL_ENABLED=true
|
||||
RISK_COOLING_HOURS_MANUAL=4
|
||||
RISK_COOLING_HOURS_MANUAL_JOURNAL=1
|
||||
RISK_MANUAL_CLOSE_DAILY_LIMIT=2
|
||||
# 日亏损次数上限:平仓盈亏<0 计1次;达限当日冻结开仓;0=不启用
|
||||
RISK_DAILY_LOSS_LIMIT=2
|
||||
RISK_MOOD_ISSUES_DAILY_FREEZE=true
|
||||
|
||||
# 资金与仓位刷新周期(秒)
|
||||
|
||||
@@ -2445,6 +2445,17 @@ def insert_trade_record(
|
||||
sync_trade_records_from_exchange(conn, force=False)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
from lib.trade.account_risk_lib import on_closed_trade_pnl
|
||||
|
||||
close_dt = parse_dt_for_trading_day(close_ts)
|
||||
on_closed_trade_pnl(
|
||||
conn,
|
||||
pnl_amount=pnl_amount,
|
||||
trading_day=get_trading_day(close_dt),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return tid
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user