Gate opens when ATM-spot offset exceeds configurable max (default 3).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 12:32:36 +08:00
parent a4bcc3ab0d
commit ee0ec57f89
12 changed files with 93 additions and 13 deletions
+6
View File
@@ -31,6 +31,7 @@ KEYS = (
"leverage",
"min_option_hours",
"min_option_leverage",
"max_atm_open_offset",
"close_bid_mark_max_pct",
"perp_qty_eth",
"option_qty_eth",
@@ -49,6 +50,7 @@ class StrategySettingsBody(BaseModel):
leverage: float | None = Field(default=None, ge=1, le=125)
min_option_hours: float | None = Field(default=None, ge=1, le=720)
min_option_leverage: float | None = Field(default=None, ge=1, le=10000)
max_atm_open_offset: float | None = Field(default=None, ge=0, le=100)
close_bid_mark_max_pct: float | None = Field(default=None, ge=1, le=100)
perp_qty_eth: float | None = Field(default=None, ge=0.01, le=100)
option_qty_eth: float | None = Field(default=None, ge=0.01, le=100)
@@ -100,6 +102,10 @@ def _read_settings() -> dict:
db.get_setting("min_option_leverage", str(s.min_option_leverage))
or s.min_option_leverage
),
"max_atm_open_offset": float(
db.get_setting("max_atm_open_offset", str(s.max_atm_open_offset))
or s.max_atm_open_offset
),
"close_bid_mark_max_pct": float(
db.get_setting("close_bid_mark_max_pct", str(s.close_bid_mark_max_pct))
or s.close_bid_mark_max_pct
+1 -1
View File
@@ -52,7 +52,7 @@ async def sim_open_group(
if pick is None:
raise HTTPException(
status_code=409,
detail="无合格期权:请检查剩余时长(≥设置小时)与杠杆(现价/卖一)",
detail="无合格期权:请检查剩余时长、ATM距现价(≤开仓偏差上限)与杠杆(现价/卖一)",
)
force = (body.force_option_side if body else None) or None