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
+34
View File
@@ -0,0 +1,34 @@
from __future__ import annotations
from dataclasses import dataclass
@dataclass(slots=True)
class Signal:
bias: str # call_ask_gt_put | put_ask_gt_call
option_side: str # call | put
perp_side: str # long | short
call_ask: float
put_ask: float
def decide(call_ask: float | None, put_ask: float | None) -> Signal | None:
if call_ask is None or put_ask is None:
return None
if call_ask > put_ask:
return Signal(
bias="call_ask_gt_put",
option_side="call",
perp_side="short",
call_ask=float(call_ask),
put_ask=float(put_ask),
)
if put_ask > call_ask:
return Signal(
bias="put_ask_gt_call",
option_side="put",
perp_side="long",
call_ask=float(call_ask),
put_ask=float(put_ask),
)
return None