07.4.4.1.3 — Journal Runtime Cleanup & Event Titles Layer
This commit is contained in:
@@ -125,7 +125,7 @@ class ExecutionEngine:
|
||||
state.execution_block_reason = None
|
||||
state.last_flip_block_reason = None
|
||||
state.last_execution_action = action
|
||||
state.last_execution_reason = f"Paper ENTRY {side} открыта."
|
||||
state.last_execution_reason = f"Позиция {side} открыта."
|
||||
|
||||
payload = {
|
||||
"execution_type": "ENTRY",
|
||||
@@ -157,7 +157,7 @@ class ExecutionEngine:
|
||||
|
||||
EventBus.emit("paper_position_opened", payload)
|
||||
|
||||
return ExecutionDecision(action, True, f"Paper ENTRY {side} открыта.")
|
||||
return ExecutionDecision(action, True, f"Позиция {side} открыта.")
|
||||
|
||||
def _flip_position(self, state: AutoTradeState) -> ExecutionDecision:
|
||||
position = type(self)._position
|
||||
@@ -227,7 +227,7 @@ class ExecutionEngine:
|
||||
state.execution_block_reason = None
|
||||
state.last_flip_block_reason = None
|
||||
state.last_execution_action = f"FLIP_{old_side}_TO_{new_side}"
|
||||
state.last_execution_reason = "Paper FLIP выполнен."
|
||||
state.last_execution_reason = "Направление позиции изменено."
|
||||
state.last_flip_at = now
|
||||
type(self)._last_flip_block_key = None
|
||||
|
||||
@@ -278,7 +278,7 @@ class ExecutionEngine:
|
||||
return ExecutionDecision(
|
||||
f"FLIP_{old_side}_TO_{new_side}",
|
||||
True,
|
||||
f"Paper FLIP выполнен: {old_side} → {new_side}.",
|
||||
f"Направление позиции изменено: {old_side} → {new_side}.",
|
||||
)
|
||||
|
||||
def _close_position(
|
||||
@@ -359,9 +359,9 @@ class ExecutionEngine:
|
||||
else "CLOSE"
|
||||
)
|
||||
state.last_execution_reason = (
|
||||
f"Paper EXIT выполнена по риску: {forced_reason}."
|
||||
f"Позиция закрыта по правилу защиты: {forced_reason}."
|
||||
if forced_reason is not None
|
||||
else "Paper EXIT выполнена."
|
||||
else "Позиция закрыта."
|
||||
)
|
||||
type(self)._last_flip_block_key = None
|
||||
|
||||
@@ -369,10 +369,10 @@ class ExecutionEngine:
|
||||
return ExecutionDecision(
|
||||
f"FORCE_CLOSE_{forced_reason}",
|
||||
True,
|
||||
f"Paper EXIT выполнена по риску: {forced_reason}.",
|
||||
f"Позиция закрыта по правилу защиты: {forced_reason}.",
|
||||
)
|
||||
|
||||
return ExecutionDecision("CLOSE", True, "Paper EXIT выполнена.")
|
||||
return ExecutionDecision("CLOSE", True, "Позиция закрыта.")
|
||||
|
||||
def _risk_close_decision(self, state: AutoTradeState) -> ExecutionDecision | None:
|
||||
position = type(self)._position
|
||||
@@ -472,26 +472,26 @@ class ExecutionEngine:
|
||||
|
||||
if confidence < self._min_flip_confidence:
|
||||
return (
|
||||
"Flip blocked: signal confidence "
|
||||
f"{confidence:.2f} < {self._min_flip_confidence:.2f}."
|
||||
"уверенность сигнала ниже порога "
|
||||
f"({confidence:.2f} < {self._min_flip_confidence:.2f})"
|
||||
)
|
||||
|
||||
if repeat_count < self._min_flip_repeat_count:
|
||||
return (
|
||||
"Flip blocked: repeat count "
|
||||
f"{repeat_count} < {self._min_flip_repeat_count}."
|
||||
"сигнал ещё не подтверждён нужным количеством повторов "
|
||||
f"({repeat_count} < {self._min_flip_repeat_count})"
|
||||
)
|
||||
|
||||
if hold_seconds is not None and hold_seconds < self._min_flip_hold_seconds:
|
||||
return (
|
||||
"Flip blocked: position hold time "
|
||||
f"{hold_seconds}s < {self._min_flip_hold_seconds}s."
|
||||
"позиция открыта слишком недавно "
|
||||
f"({hold_seconds}с < {self._min_flip_hold_seconds}с)"
|
||||
)
|
||||
|
||||
if unrealized_pnl < 0 and confidence < self._loss_flip_confidence:
|
||||
return (
|
||||
"Flip blocked: position is negative and signal is not strong enough "
|
||||
f"({confidence:.2f} < {self._loss_flip_confidence:.2f})."
|
||||
"позиция сейчас в минусе, а сигнал недостаточно сильный "
|
||||
f"({confidence:.2f} < {self._loss_flip_confidence:.2f})"
|
||||
)
|
||||
|
||||
return None
|
||||
@@ -535,7 +535,7 @@ class ExecutionEngine:
|
||||
|
||||
JournalService().log_ui_warning(
|
||||
event_type="position_flip_blocked",
|
||||
message=f"Смена направления позиции заблокирована: {reason}",
|
||||
message=f"Смена направления позиции заблокирована: {reason}.",
|
||||
screen="auto",
|
||||
action="paper_execution",
|
||||
payload=payload,
|
||||
|
||||
Reference in New Issue
Block a user