Show options position source (纯期权/永期/期期) on holdings cards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-19 08:45:17 +08:00
parent fa2127d66c
commit 899a2de931
8 changed files with 136 additions and 18 deletions
+3 -1
View File
@@ -52,12 +52,14 @@ def build_options_hub_snapshot(cfg: dict[str, Any]) -> dict[str, Any]:
)
inst = str(p.get("inst_id") or "")
source_key, source_label = _resolve_options_source(conn, inst)
source_key, source_label, source_plan_id = _resolve_options_source(conn, inst)
p["source"] = source_key
p["source_label"] = source_label
p["source_plan_id"] = source_plan_id
p["target_monitor_text"] = _format_options_target(p)
except Exception:
p.setdefault("source_label", "")
p.setdefault("source_plan_id", None)
p.setdefault("target_monitor_text", "")
finally:
conn.close()
+11
View File
@@ -763,6 +763,17 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
hedge_target = hedge_target_map.get(inst)
if hedge_target:
row["hedge_plan_target"] = hedge_target
try:
from lib.instance.instance_dashboard_lib import _resolve_options_source
source_key, source_label, source_plan_id = _resolve_options_source(conn, inst)
row["source"] = source_key
row["source_label"] = source_label
row["source_plan_id"] = source_plan_id
except Exception:
row.setdefault("source", "option")
row.setdefault("source_label", "纯期权")
row.setdefault("source_plan_id", None)
rows.append(row)
finally:
conn.close()
+1 -1
View File
@@ -274,4 +274,4 @@
</div>
</div>
<script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/options_panel.js?v=39"></script>
<script src="/static/options_panel.js?v=40"></script>