Add fixed-direction switch for perp/option open side.
When enabled, lock perp long→buy Put or short→buy Call with ITM/ATM only; off keeps ATM/ask rules. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,3 +66,38 @@ def decide(
|
||||
put_ask=pa,
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def decide_fixed(
|
||||
call_ask: float | None,
|
||||
put_ask: float | None,
|
||||
*,
|
||||
perp_side: str,
|
||||
) -> Signal | None:
|
||||
"""
|
||||
固定方向:
|
||||
- 永续多 → 买 Put
|
||||
- 永续空 → 买 Call
|
||||
"""
|
||||
if call_ask is None or put_ask is None:
|
||||
return None
|
||||
side = (perp_side or "").strip().lower()
|
||||
ca = float(call_ask)
|
||||
pa = float(put_ask)
|
||||
if side == "long":
|
||||
return Signal(
|
||||
bias="fixed_long_put",
|
||||
option_side="put",
|
||||
perp_side="long",
|
||||
call_ask=ca,
|
||||
put_ask=pa,
|
||||
)
|
||||
if side == "short":
|
||||
return Signal(
|
||||
bias="fixed_short_call",
|
||||
option_side="call",
|
||||
perp_side="short",
|
||||
call_ask=ca,
|
||||
put_ask=pa,
|
||||
)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user