Drive semi quote ladder by min remaining hours input.

Picks nearest expiry with hours >= threshold and refreshes the list as the field changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-08 14:20:28 +08:00
parent ebd88718a7
commit 7db8b724ac
3 changed files with 51 additions and 24 deletions
+3 -2
View File
@@ -23,13 +23,14 @@ async def market_option_ladder(
_user: Annotated[str, Depends(require_user)],
wings: int = Query(default=5, ge=1, le=12),
side: str = Query(default="call", pattern="^(call|put)$"),
min_hours: float = Query(default=30, ge=1, le=720),
) -> dict:
"""半自动页单边报价列表:ATM 上下各 wings 档;side=call|put"""
"""半自动页单边报价:选剩余时长≥min_hours 的最近到期"""
gw = get_gateway()
ladder = getattr(gw, "option_ladder", None)
if not callable(ladder):
raise HTTPException(status_code=501, detail="当前会话不支持 option-ladder")
return ladder(wings=wings, side=side)
return ladder(wings=wings, side=side, min_hours=min_hours)
@router.post("/realign")