{% macro key_direction_label(k) -%} {% if k.direction == 'watch' %}双向{% elif k.direction == 'long' %}做多{% else %}做空{% endif %} {%- endmacro %} {% macro key_sl_tp_mode_label(k) -%} {% if (k.sl_tp_mode or 'standard') == 'standard' %}标准突破{% elif k.sl_tp_mode == 'box_1p5' %}箱体1R·止盈1.5H{% else %}趋势单{% endif %} {%- endmacro %} {% macro key_monitor_brief(k) -%} 上{{ k.upper }} / 下{{ k.lower }} · 提醒 {{ k.notification_count or 0 }}/{{ k.max_notify or 3 }} {%- if k.monitor_type in ['箱体突破','收敛突破'] %} · {{ key_sl_tp_mode_label(k) }}{% endif %} {%- if k.breakeven_enabled %} · 保本开{% else %} · 保本关{% endif %} {%- endmacro %} {% macro key_history_outcome_kind(h) -%} {%- set r = (h.close_reason or '')|trim -%} {%- if r in ['fib_filled', 'false_breakout_filled', 'trigger_entry_filled', 'key_level_alert_done', 'alerts_complete', 'auto_opened'] -%}success {%- elif r == 'manual' -%}manual {%- elif r -%}failed {%- else -%}neutral {%- endif -%} {%- endmacro %} {% macro key_history_outcome_label(h) -%} {%- set r = (h.close_reason or '')|trim -%} {%- if r == 'fib_filled' -%}斐波成交 {%- elif r == 'false_breakout_filled' -%}假突破成交 {%- elif r == 'trigger_entry_filled' -%}触价成交 {%- elif r == 'key_level_alert_done' -%}提醒完成 {%- elif r == 'alerts_complete' -%}提醒已满 {%- elif r == 'auto_opened' -%}自动开仓 {%- elif r == 'manual' -%}手动删除 {%- elif r == 'fib_invalidate' -%}斐波失效 {%- elif r == 'trigger_tp_invalidate' -%}触价止盈失效 {%- elif r == 'trigger_entry_expired' -%}触价过期 {%- elif r == 'trigger_exchange_failed' -%}触价下单失败 {%- elif r == 'false_breakout_expired' -%}假突破过期 {%- elif r == 'fib_plan_invalid' -%}计划无效 {%- elif r == 'rr_insufficient' -%}盈亏比不足 {%- elif r == 'exchange_failed' -%}下单失败 {%- else -%}{{ r or '—' }} {%- endif -%} {%- endmacro %} {% macro key_history_brief(h) -%} {{ key_history_outcome_label(h) }} · {{ (h.closed_at or '-')[:16] }} · 上{{ h.upper }} / 下{{ h.lower }} · 提醒 {{ h.notification_count or 0 }} {%- endmacro %}