Add live expiry countdown for options positions on instance page and trading hub.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-08 11:14:30 +08:00
parent f68197b775
commit 189b27e076
12 changed files with 185 additions and 6 deletions
+11
View File
@@ -771,6 +771,7 @@ _TRADE_STATS_CALENDAR_CSS = _REPO_STATIC / "trade_stats_calendar.css"
_TRADE_STATS_CALENDAR_JS = _REPO_STATIC / "trade_stats_calendar.js"
_ACCOUNT_RISK_BADGE_CSS = _REPO_STATIC / "account_risk_badge.css"
_ACCOUNT_RISK_BADGE_JS = _REPO_STATIC / "account_risk_badge.js"
_OPTIONS_EXPIRY_COUNTDOWN_JS = _REPO_STATIC / "options_expiry_countdown.js"
@app.get("/assets/account_risk_badge.css")
@@ -795,6 +796,16 @@ def hub_account_risk_badge_js():
)
@app.get("/assets/options_expiry_countdown.js")
def hub_options_expiry_countdown_js():
if not _OPTIONS_EXPIRY_COUNTDOWN_JS.is_file():
raise HTTPException(status_code=404, detail="options_expiry_countdown.js not found")
return FileResponse(
str(_OPTIONS_EXPIRY_COUNTDOWN_JS),
media_type="application/javascript; charset=utf-8",
)
@app.get("/assets/ai_review_render.js")
def hub_ai_review_render_js():
"""与三所实例共用仓库根 static/ai_review_render.js(须在 /assets mount 之前注册)。"""