Add risk management features: implement KillSwitch and StopConditionsGuard; update settings and tests

This commit is contained in:
2026-06-01 11:22:17 +02:00
parent 45e219d103
commit 240a591a64
9 changed files with 402 additions and 40 deletions
+27
View File
@@ -0,0 +1,27 @@
from __future__ import annotations
from arbitrade.risk.kill_switch import KillSwitch
def test_kill_switch_can_activate_and_deactivate() -> None:
kill_switch = KillSwitch()
assert not kill_switch.is_active
assert kill_switch.reason is None
kill_switch.activate(reason="manual")
assert kill_switch.is_active
assert kill_switch.reason == "manual"
kill_switch.deactivate()
assert not kill_switch.is_active
assert kill_switch.reason is None
def test_kill_switch_active_on_init_sets_reason() -> None:
kill_switch = KillSwitch(active=True)
assert kill_switch.is_active
assert kill_switch.reason == "manual"