Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from .core import (
SleeveSignalEvaluation,
SleeveSignalResult,
build_gate,
build_sleeve_result,
threshold_bool,
exit_trigger_gate,
)
from .helpers import (
decimal_param,
Expand Down Expand Up @@ -198,22 +197,19 @@ def breakout_exit_result(
)
)
)
exit_gate = build_gate(
name="exit",
category="exit",
thresholds=(
threshold_bool(
metric="breakout_failure_confirmed",
passed=breakout_failure_confirmed,
threshold=True,
),
threshold_bool(
metric="session_strength_reversal_confirmed",
passed=session_strength_reversal_confirmed,
threshold=False,
value=session_strength_reversal_confirmed,
),
),
price_below_opening_range_high = (
resolved_request.price_vs_opening_range_high_bps is not None
and optional_max_threshold(
resolved_request.price_vs_opening_range_high_bps,
exit_price_below_opening_range_high_bps,
)
)
exit_gate = exit_trigger_gate(
reason_flags={
"breakout_failure_confirmed": breakout_failure_confirmed,
"price_below_opening_range_high": price_below_opening_range_high,
"session_strength_reversal_confirmed": session_strength_reversal_confirmed,
}
)
if breakout_failure_confirmed:
return build_sleeve_result(
Expand All @@ -231,13 +227,6 @@ def breakout_exit_result(
trace_enabled=resolved_request.trace_enabled,
context=resolved_request.trace_context,
)
price_below_opening_range_high = (
resolved_request.price_vs_opening_range_high_bps is not None
and optional_max_threshold(
resolved_request.price_vs_opening_range_high_bps,
exit_price_below_opening_range_high_bps,
)
)
if price_below_opening_range_high or session_strength_reversal_confirmed:
return build_sleeve_result(
strategy_id=resolved_request.strategy_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,14 +555,19 @@ def test_breakout_continuation_plugin_emits_sell_on_confirmed_breakout_failure(
)

feature_contract = normalize_feature_vector_v3(signal)
runtime = StrategyRuntime()
runtime = StrategyRuntime(trace_enabled=True)
decision = runtime.evaluate(strategy, feature_contract, timeframe="1Sec")

self.assertIsNotNone(decision)
assert decision is not None
self.assertEqual(decision.intent.action, "sell")
self.assertEqual(decision.plugin_id, "breakout_continuation_long")
self.assertIn("breakout_failed", decision.intent.rationale)
self.assertIsNotNone(decision.trace)
assert decision.trace is not None
exit_gate = decision.trace.gates[-1]
self.assertTrue(exit_gate.passed)
self.assertTrue(exit_gate.context["reasons"]["breakout_failure_confirmed"])

def test_breakout_continuation_plugin_does_not_exit_on_momentum_rollover_above_structure(
self,
Expand Down
Loading