strategy: implement model assist be-lock path and clarify audit note
All checks were successful
Gitea CI / test (push) Successful in 32s
Gitea CI / test (pull_request) Successful in 33s

This commit is contained in:
agentson
2026-03-02 09:31:38 +09:00
parent 2332ba868f
commit 5e4c94bfeb
6 changed files with 27 additions and 8 deletions

View File

@@ -22,12 +22,12 @@ def test_take_profit_exit_for_backward_compatibility() -> None:
assert out.reason == "arm_take_profit"
def test_model_assist_signal_does_not_exit_directly() -> None:
def test_model_assist_signal_promotes_be_lock_without_direct_exit() -> None:
out = evaluate_exit(
current_state=PositionState.ARMED,
config=ExitRuleConfig(model_prob_threshold=0.62, arm_pct=10.0),
current_state=PositionState.HOLDING,
config=ExitRuleConfig(model_prob_threshold=0.62, be_arm_pct=1.2, arm_pct=10.0),
inp=ExitRuleInput(
current_price=101.0,
current_price=100.5,
entry_price=100.0,
peak_price=105.0,
pred_down_prob=0.8,
@@ -35,4 +35,5 @@ def test_model_assist_signal_does_not_exit_directly() -> None:
),
)
assert out.should_exit is False
assert out.reason == "hold"
assert out.state == PositionState.BE_LOCK
assert out.reason == "model_assist_be_lock"

View File

@@ -30,7 +30,20 @@ def test_exited_has_priority_over_promotion() -> None:
assert state == PositionState.EXITED
def test_model_signal_is_assist_only_not_direct_exit() -> None:
def test_model_signal_promotes_be_lock_as_assist() -> None:
state = promote_state(
PositionState.HOLDING,
StateTransitionInput(
unrealized_pnl_pct=0.5,
be_arm_pct=1.2,
arm_pct=2.8,
model_exit_signal=True,
),
)
assert state == PositionState.BE_LOCK
def test_model_signal_does_not_force_exit_directly() -> None:
state = promote_state(
PositionState.ARMED,
StateTransitionInput(