fix: intraday journal entry type limited to four options
日内复盘开仓类型仅保留假破、结构突破、回调触价、突破触价;移除旧趋势长句与策略项。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<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="启动A/B、大分歧A/B、小分歧或策略项">
|
||||
<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>
|
||||
|
||||
@@ -302,9 +302,16 @@ def normalize_review_entry_reason(raw: Optional[str], allowed: Sequence[str]) ->
|
||||
return ""
|
||||
|
||||
|
||||
# 日内复盘开仓类型:手动假破/结构突破 + 自动触价(与 KEY_ENTRY_REASON_TRIGGER_OPTIONS 一致)
|
||||
_INTRADAY_JOURNAL_KEY_ENTRY_REASONS: Tuple[str, ...] = (
|
||||
"关键位回调触价开仓",
|
||||
"关键位突破触价开仓",
|
||||
)
|
||||
|
||||
|
||||
def trend_manual_entry_reason_count(policy: TradePolicy) -> int:
|
||||
if is_intraday_trading_profile(policy):
|
||||
return len(INTRADAY_LEGACY_TREND_ENTRY_REASONS) + len(intraday_entry_reason_display_options())
|
||||
return len(intraday_entry_reason_display_options())
|
||||
return len(trend_div_entry_reason_display_options()) + len(TRADE_STYLE_FALLBACK_ENTRY_REASONS)
|
||||
|
||||
|
||||
@@ -318,12 +325,9 @@ def build_intraday_entry_reason_options(
|
||||
key_options: Sequence[str],
|
||||
strategy_options: Sequence[str],
|
||||
) -> Tuple[str, ...]:
|
||||
return (
|
||||
INTRADAY_LEGACY_TREND_ENTRY_REASONS
|
||||
+ intraday_entry_reason_display_options()
|
||||
+ tuple(key_options)
|
||||
+ tuple(strategy_options)
|
||||
)
|
||||
del strategy_options # 日内户无趋势回调/顺势加仓
|
||||
del key_options
|
||||
return intraday_entry_reason_display_options() + _INTRADAY_JOURNAL_KEY_ENTRY_REASONS
|
||||
|
||||
|
||||
def entry_reason_options_for_policy(
|
||||
|
||||
@@ -8,6 +8,7 @@ from lib.trade.entry_model_lib import (
|
||||
ENTRY_MODEL_SMALL_DIV,
|
||||
ENTRY_CATEGORY_REVERSAL,
|
||||
ENTRY_CATEGORY_TREND,
|
||||
build_intraday_entry_reason_options,
|
||||
build_trend_div_entry_reason_options,
|
||||
entry_model_categories,
|
||||
entry_model_category,
|
||||
@@ -35,7 +36,7 @@ class TestEntryModelLib(unittest.TestCase):
|
||||
}
|
||||
)
|
||||
self.assertTrue(is_intraday_trading_profile(policy))
|
||||
self.assertEqual(trend_manual_entry_reason_count(policy), 7)
|
||||
self.assertEqual(trend_manual_entry_reason_count(policy), 2)
|
||||
|
||||
def test_trend_div_profile_alt(self):
|
||||
policy = load_trade_policy(
|
||||
@@ -149,6 +150,25 @@ class TestEntryModelLib(unittest.TestCase):
|
||||
self.assertIn("波段单", opts)
|
||||
self.assertIn("趋势回调", opts)
|
||||
|
||||
def test_build_intraday_journal_options_only_four(self):
|
||||
opts = build_intraday_entry_reason_options(
|
||||
(
|
||||
"关键位箱体突破",
|
||||
"关键位回调触价开仓",
|
||||
"关键位突破触价开仓",
|
||||
),
|
||||
("趋势回调", "顺势加仓"),
|
||||
)
|
||||
self.assertEqual(
|
||||
opts,
|
||||
(
|
||||
"波段单/假破",
|
||||
"波段单/结构突破",
|
||||
"关键位回调触价开仓",
|
||||
"关键位突破触价开仓",
|
||||
),
|
||||
)
|
||||
|
||||
def test_normalize_review_entry_reason(self):
|
||||
from lib.trade.entry_model_lib import normalize_review_entry_reason
|
||||
|
||||
|
||||
Reference in New Issue
Block a user