Require aligned action for qualified setups
This commit is contained in:
@@ -31,6 +31,7 @@ STRICT_GATE = {
|
||||
|
||||
def _setup(**kwargs):
|
||||
base = dict(
|
||||
direction="long",
|
||||
rr_ratio=3.0,
|
||||
confidence_score=80.0,
|
||||
recommended_action="LONG_HIGH",
|
||||
@@ -124,6 +125,15 @@ class TestExcludeNeutral:
|
||||
def test_directional_passes_when_on(self):
|
||||
assert setup_qualifies(_setup(recommended_action="LONG_MODERATE"), NEUTRAL_GATE) is True
|
||||
|
||||
def test_opposing_short_action_fails_for_long_setup(self):
|
||||
assert setup_qualifies(_setup(direction="long", recommended_action="SHORT_MODERATE"), NEUTRAL_GATE) is False
|
||||
|
||||
def test_matching_short_action_still_fails_long_only_momentum_gate(self):
|
||||
assert setup_qualifies(
|
||||
_setup(direction="short", recommended_action="SHORT_MODERATE", momentum_percentile=95.0),
|
||||
{**NEUTRAL_GATE, "min_momentum_percentile": 80.0},
|
||||
) is False
|
||||
|
||||
def test_neutral_allowed_when_off(self):
|
||||
# Flag absent from the config → NEUTRAL still qualifies (backward compatible).
|
||||
assert setup_qualifies(_setup(recommended_action="NEUTRAL"), DEFAULT_GATE) is True
|
||||
|
||||
Reference in New Issue
Block a user