Split journal order type from entry reason and fix review edit toggle in embed shell.
Adds order_type to journal uploads, removes legacy swing/trend labels from entry reason options, and ensures review-edit buttons sync when the records tab loads dynamically. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,15 +5,48 @@ from typing import Optional
|
||||
|
||||
MONITOR_TYPE_TREND_PULLBACK = "趋势回调"
|
||||
MONITOR_TYPE_ROLL = "顺势加仓"
|
||||
ORDER_TYPE_MANUAL = "下单监控"
|
||||
ORDER_TYPE_KEY = "关键位监控"
|
||||
|
||||
ENTRY_REASON_TREND_PULLBACK = "趋势回调"
|
||||
ENTRY_REASON_ROLL = "顺势加仓"
|
||||
|
||||
JOURNAL_ORDER_TYPE_OPTIONS = (
|
||||
ORDER_TYPE_MANUAL,
|
||||
ORDER_TYPE_KEY,
|
||||
MONITOR_TYPE_TREND_PULLBACK,
|
||||
MONITOR_TYPE_ROLL,
|
||||
)
|
||||
|
||||
STRATEGY_ENTRY_REASON_OPTIONS = (
|
||||
ENTRY_REASON_TREND_PULLBACK,
|
||||
ENTRY_REASON_ROLL,
|
||||
)
|
||||
|
||||
|
||||
def normalize_journal_order_type(raw: Optional[str]) -> str:
|
||||
s = (raw or "").strip()
|
||||
if s in JOURNAL_ORDER_TYPE_OPTIONS:
|
||||
return s
|
||||
if "关键位" in s:
|
||||
return ORDER_TYPE_KEY
|
||||
return ""
|
||||
|
||||
|
||||
def order_type_from_monitor_type(
|
||||
monitor_type: Optional[str],
|
||||
key_signal_type: Optional[str] = None,
|
||||
) -> str:
|
||||
del key_signal_type
|
||||
mt = (monitor_type or "").strip()
|
||||
if mt == MONITOR_TYPE_TREND_PULLBACK:
|
||||
return MONITOR_TYPE_TREND_PULLBACK
|
||||
if mt == MONITOR_TYPE_ROLL:
|
||||
return MONITOR_TYPE_ROLL
|
||||
if mt == ORDER_TYPE_KEY or "关键位" in mt:
|
||||
return ORDER_TYPE_KEY
|
||||
return ORDER_TYPE_MANUAL
|
||||
|
||||
# 趋势回调保本移交下单监控:order_monitors.key_signal_type / 平仓备注
|
||||
TREND_HANDOFF_KEY_SIGNAL = ENTRY_REASON_TREND_PULLBACK
|
||||
TREND_HANDOFF_TRADE_NOTE = "趋势回调计划"
|
||||
|
||||
Reference in New Issue
Block a user