Implement P1 local matcher/ledger and P2 strategy engine.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class ExitDecision:
|
||||
should_close: bool
|
||||
reason: str = ""
|
||||
|
||||
|
||||
def check_exits(
|
||||
*,
|
||||
perp_upl: float,
|
||||
initial_premium: float,
|
||||
move_points: float,
|
||||
exit_move_points: float,
|
||||
) -> ExitDecision:
|
||||
if initial_premium > 0 and perp_upl + 1e-9 >= initial_premium:
|
||||
return ExitDecision(True, "premium_cover")
|
||||
if exit_move_points > 0 and move_points + 1e-9 >= exit_move_points:
|
||||
return ExitDecision(True, "move_points")
|
||||
return ExitDecision(False, "")
|
||||
Reference in New Issue
Block a user