Implement P1 local matcher/ledger and P2 strategy engine.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-24 17:03:46 +08:00
parent 0fca5f025e
commit 51b8bb8f8a
30 changed files with 2086 additions and 150 deletions
+23
View File
@@ -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, "")