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 = "趋势回调计划"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{# 复盘表单:首行按字段宽度比例;开仓类型与离场触发同一行 #}
|
||||
{% macro journal_form_fields(entry_reason_options) -%}
|
||||
{# 复盘表单:首行按字段宽度比例;下单类型/开仓类型与离场触发同一行 #}
|
||||
{% macro journal_form_fields(entry_reason_options, order_type_options) -%}
|
||||
<div class="form-grid journal-form-row1">
|
||||
<input type="datetime-local" name="open_datetime" class="journal-field-datetime" required>
|
||||
<input type="datetime-local" name="close_datetime" class="journal-field-datetime" required>
|
||||
@@ -10,7 +10,13 @@
|
||||
<input name="real_rr" class="journal-field-num" placeholder="实际RR">
|
||||
</div>
|
||||
<div class="form-grid journal-form-row2">
|
||||
<select name="entry_reason" id="journal-entry-reason" class="journal-field-entry-reason" required title="日内:假破/结构突破/回调触价/突破触价;趋势户:反转/顺势/波段或策略项">
|
||||
<select name="order_type" id="journal-order-type" class="journal-field-order-type" required title="下单来源:下单监控/关键位/趋势回调/顺势加仓">
|
||||
<option value="">下单类型(必选)</option>
|
||||
{% for ot in order_type_options %}
|
||||
<option value="{{ ot }}">{{ ot }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="entry_reason" id="journal-entry-reason" class="journal-field-entry-reason" required title="日内:假破/结构突破/回调触价/突破触价;趋势户:反转/顺势/波段小分歧等">
|
||||
<option value="">开仓类型(必选)</option>
|
||||
{% for er in entry_reason_options %}
|
||||
<option value="{{ er }}">{{ er }}</option>
|
||||
|
||||
Reference in New Issue
Block a user