Show options position source (纯期权/永期/期期) on holdings cards.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user