@@ -46,8 +46,6 @@
|
|||||||
options: "show_nav_options",
|
options: "show_nav_options",
|
||||||
"options-review": "show_nav_options_review",
|
"options-review": "show_nav_options_review",
|
||||||
options_review: "show_nav_options_review",
|
options_review: "show_nav_options_review",
|
||||||
"hedge-plan": "show_nav_hedge_plan",
|
|
||||||
hedge_plan: "show_nav_hedge_plan",
|
|
||||||
risk_policy: "show_nav_risk_policy",
|
risk_policy: "show_nav_risk_policy",
|
||||||
system_guide: "show_nav_system_guide",
|
system_guide: "show_nav_system_guide",
|
||||||
env_config: "show_nav_env_config",
|
env_config: "show_nav_env_config",
|
||||||
@@ -59,6 +57,11 @@
|
|||||||
.forEach((a) => {
|
.forEach((a) => {
|
||||||
const tab = a.getAttribute("data-embed-tab") || (a.getAttribute("href") || "").replace(/^\//, "").split("?")[0];
|
const tab = a.getAttribute("data-embed-tab") || (a.getAttribute("href") || "").replace(/^\//, "").split("?")[0];
|
||||||
if (tab === "more") return;
|
if (tab === "more") return;
|
||||||
|
if (tab === "hedge_plan" || tab === "hedge-plan") {
|
||||||
|
a.classList.add("nav-hidden");
|
||||||
|
a.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
const key = map[tab];
|
const key = map[tab];
|
||||||
if (!key) return;
|
if (!key) return;
|
||||||
const show = navPrefShow(display, key);
|
const show = navPrefShow(display, key);
|
||||||
@@ -70,6 +73,7 @@
|
|||||||
|
|
||||||
function pageNavAllowed(tab) {
|
function pageNavAllowed(tab) {
|
||||||
const d = DISPLAY();
|
const d = DISPLAY();
|
||||||
|
if (tab === "hedge_plan" || tab === "hedge-plan") return false;
|
||||||
const map = {
|
const map = {
|
||||||
dashboard: "show_nav_dashboard",
|
dashboard: "show_nav_dashboard",
|
||||||
account_ledger: "show_nav_account_ledger",
|
account_ledger: "show_nav_account_ledger",
|
||||||
@@ -82,8 +86,6 @@
|
|||||||
options: "show_nav_options",
|
options: "show_nav_options",
|
||||||
"options-review": "show_nav_options_review",
|
"options-review": "show_nav_options_review",
|
||||||
options_review: "show_nav_options_review",
|
options_review: "show_nav_options_review",
|
||||||
"hedge-plan": "show_nav_hedge_plan",
|
|
||||||
hedge_plan: "show_nav_hedge_plan",
|
|
||||||
risk_policy: "show_nav_risk_policy",
|
risk_policy: "show_nav_risk_policy",
|
||||||
system_guide: "show_nav_system_guide",
|
system_guide: "show_nav_system_guide",
|
||||||
env_config: "show_nav_env_config",
|
env_config: "show_nav_env_config",
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ DEFAULT_INSTANCE_DISPLAY: dict[str, bool] = {
|
|||||||
"show_nav_env_config": True,
|
"show_nav_env_config": True,
|
||||||
"show_nav_options": True,
|
"show_nav_options": True,
|
||||||
"show_nav_options_review": True,
|
"show_nav_options_review": True,
|
||||||
"show_nav_hedge_plan": False,
|
|
||||||
"show_settings_transfer": False, # 永续资金划转默认隐藏
|
"show_settings_transfer": False, # 永续资金划转默认隐藏
|
||||||
"show_settings_export": True,
|
"show_settings_export": True,
|
||||||
"show_settings_password": True,
|
"show_settings_password": True,
|
||||||
@@ -43,7 +42,6 @@ DISPLAY_LABELS: dict[str, str] = {
|
|||||||
"show_nav_env_config": "env配置",
|
"show_nav_env_config": "env配置",
|
||||||
"show_nav_options": "期权",
|
"show_nav_options": "期权",
|
||||||
"show_nav_options_review": "期权复盘",
|
"show_nav_options_review": "期权复盘",
|
||||||
"show_nav_hedge_plan": "对冲计划",
|
|
||||||
"show_settings_transfer": "永续资金划转",
|
"show_settings_transfer": "永续资金划转",
|
||||||
"show_settings_export": "数据导出",
|
"show_settings_export": "数据导出",
|
||||||
"show_settings_password": "账户密码修改",
|
"show_settings_password": "账户密码修改",
|
||||||
@@ -65,7 +63,6 @@ NAV_TAB_ALLOWED: dict[str, str] = {
|
|||||||
"env_config": "show_nav_env_config",
|
"env_config": "show_nav_env_config",
|
||||||
"options": "show_nav_options",
|
"options": "show_nav_options",
|
||||||
"options_review": "show_nav_options_review",
|
"options_review": "show_nav_options_review",
|
||||||
"hedge_plan": "show_nav_hedge_plan",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -111,8 +108,8 @@ def display_prefs_template_context(get_db: Callable) -> dict[str, Any]:
|
|||||||
def tab_allowed(tab: str, display: Optional[dict[str, bool]] = None) -> bool:
|
def tab_allowed(tab: str, display: Optional[dict[str, bool]] = None) -> bool:
|
||||||
prefs = normalize_display_prefs(display or {})
|
prefs = normalize_display_prefs(display or {})
|
||||||
t = (tab or "").strip()
|
t = (tab or "").strip()
|
||||||
if t in ("trade", "records", "stats"):
|
if t in ("trade", "records", "stats", "hedge_plan"):
|
||||||
return False # 实盘下单 / 交易记录复盘 / 统计分析 已移除
|
return False # 实盘下单 / 交易记录复盘 / 统计分析 / 对冲计划 已移除
|
||||||
key = NAV_TAB_ALLOWED.get(t)
|
key = NAV_TAB_ALLOWED.get(t)
|
||||||
if not key:
|
if not key:
|
||||||
return True
|
return True
|
||||||
@@ -129,7 +126,6 @@ def display_meta_for_ui() -> list[dict[str, Any]]:
|
|||||||
"show_nav_env_config",
|
"show_nav_env_config",
|
||||||
"show_nav_options",
|
"show_nav_options",
|
||||||
"show_nav_options_review",
|
"show_nav_options_review",
|
||||||
"show_nav_hedge_plan",
|
|
||||||
]
|
]
|
||||||
settings_keys = [
|
settings_keys = [
|
||||||
"show_settings_transfer",
|
"show_settings_transfer",
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ EMBED_TABS: tuple[str, ...] = (
|
|||||||
"key_monitor",
|
"key_monitor",
|
||||||
"options",
|
"options",
|
||||||
"options_review",
|
"options_review",
|
||||||
"hedge_plan",
|
|
||||||
"risk_policy",
|
"risk_policy",
|
||||||
"system_guide",
|
"system_guide",
|
||||||
"env_config",
|
"env_config",
|
||||||
@@ -33,7 +32,7 @@ PATH_TO_EMBED_TAB: dict[str, str] = {
|
|||||||
"/key_monitor": "key_monitor",
|
"/key_monitor": "key_monitor",
|
||||||
"/options": "options",
|
"/options": "options",
|
||||||
"/options/review": "options_review",
|
"/options/review": "options_review",
|
||||||
"/hedge-plan": "hedge_plan",
|
"/hedge-plan": "options", # 对冲计划已移除,旧链接落到期权
|
||||||
"/risk_policy": "risk_policy",
|
"/risk_policy": "risk_policy",
|
||||||
"/system_guide": "system_guide",
|
"/system_guide": "system_guide",
|
||||||
"/env_config": "env_config",
|
"/env_config": "env_config",
|
||||||
|
|||||||
@@ -127,8 +127,6 @@
|
|||||||
{% include 'options_panel.html' %}
|
{% include 'options_panel.html' %}
|
||||||
{% elif page == 'options_review' %}
|
{% elif page == 'options_review' %}
|
||||||
{% include 'options_review_panel.html' %}
|
{% include 'options_review_panel.html' %}
|
||||||
{% elif page == 'hedge_plan' %}
|
|
||||||
{% include 'hedge_plan_panel.html' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
>
|
>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>加密货币|OKX 期权与对冲</h1>
|
<h1>加密货币|OKX 期权</h1>
|
||||||
</div>
|
</div>
|
||||||
<nav class="top-nav embed-top-nav" aria-label="实例导航">
|
<nav class="top-nav embed-top-nav" aria-label="实例导航">
|
||||||
<div class="top-nav-links">
|
<div class="top-nav-links">
|
||||||
@@ -48,9 +48,6 @@
|
|||||||
{% if options_nav_visible and display.show_nav_options_review %}
|
{% if options_nav_visible and display.show_nav_options_review %}
|
||||||
<a href="/options/review" data-embed-tab="options_review" class="{% if initial_tab == 'options_review' %}active{% endif %}">期权复盘</a>
|
<a href="/options/review" data-embed-tab="options_review" class="{% if initial_tab == 'options_review' %}active{% endif %}">期权复盘</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
|
||||||
<a href="/hedge-plan" data-embed-tab="hedge_plan" class="{% if initial_tab == 'hedge_plan' %}active{% endif %}">对冲计划</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if display.show_nav_risk_policy %}
|
{% if display.show_nav_risk_policy %}
|
||||||
<a href="/risk_policy" data-embed-tab="risk_policy" class="{% if initial_tab == 'risk_policy' %}active{% endif %}">风控说明</a>
|
<a href="/risk_policy" data-embed-tab="risk_policy" class="{% if initial_tab == 'risk_policy' %}active{% endif %}">风控说明</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -97,9 +94,6 @@
|
|||||||
{% if options_nav_visible and display.show_nav_options %}
|
{% if options_nav_visible and display.show_nav_options %}
|
||||||
<a href="/options" class="inst-m-tab{% if initial_tab == 'options' %} active{% endif %}" data-embed-tab="options">期权</a>
|
<a href="/options" class="inst-m-tab{% if initial_tab == 'options' %} active{% endif %}" data-embed-tab="options">期权</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
|
||||||
<a href="/hedge-plan" class="inst-m-tab{% if initial_tab == 'hedge_plan' %} active{% endif %}" data-embed-tab="hedge_plan">对冲</a>
|
|
||||||
{% endif %}
|
|
||||||
<a href="/key_monitor" class="inst-m-tab{% if initial_tab == 'key_monitor' %} active{% endif %}" data-embed-tab="key_monitor"{% if not display.show_nav_key_monitor %} style="display:none"{% endif %}>关键位</a>
|
<a href="/key_monitor" class="inst-m-tab{% if initial_tab == 'key_monitor' %} active{% endif %}" data-embed-tab="key_monitor"{% if not display.show_nav_key_monitor %} style="display:none"{% endif %}>关键位</a>
|
||||||
<button type="button" class="inst-m-tab" data-embed-tab="more" id="inst-m-tab-more" aria-haspopup="dialog" aria-expanded="false">更多</button>
|
<button type="button" class="inst-m-tab" data-embed-tab="more" id="inst-m-tab-more" aria-haspopup="dialog" aria-expanded="false">更多</button>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -115,9 +109,6 @@
|
|||||||
{% if options_nav_visible and display.show_nav_options_review %}
|
{% if options_nav_visible and display.show_nav_options_review %}
|
||||||
<a href="/options/review" data-embed-tab="options_review">期权复盘</a>
|
<a href="/options/review" data-embed-tab="options_review">期权复盘</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
|
||||||
<a href="/hedge-plan" data-embed-tab="hedge_plan">对冲计划</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if display.show_nav_risk_policy %}
|
{% if display.show_nav_risk_policy %}
|
||||||
<a href="/risk_policy" data-embed-tab="risk_policy">风控说明</a>
|
<a href="/risk_policy" data-embed-tab="risk_policy">风控说明</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -176,9 +176,6 @@
|
|||||||
{% if options_nav_visible and display.show_nav_options_review %}
|
{% if options_nav_visible and display.show_nav_options_review %}
|
||||||
<a href="/options/review" class="{% if page == 'options_review' %}active{% endif %}">期权复盘</a>
|
<a href="/options/review" class="{% if page == 'options_review' %}active{% endif %}">期权复盘</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
|
||||||
<a href="/hedge-plan" class="{% if page == 'hedge_plan' %}active{% endif %}">对冲计划</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if display.show_nav_risk_policy %}
|
{% if display.show_nav_risk_policy %}
|
||||||
<a href="/risk_policy" class="{% if page == 'risk_policy' %}active{% endif %}">风控说明</a>
|
<a href="/risk_policy" class="{% if page == 'risk_policy' %}active{% endif %}">风控说明</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -191,7 +188,7 @@
|
|||||||
{% with msg=get_flashed_messages() %}{% if msg %}<div class="flash">{{ msg[0] }}</div>{% endif %}{% endwith %}
|
{% with msg=get_flashed_messages() %}{% if msg %}<div class="flash">{{ msg[0] }}</div>{% endif %}{% endwith %}
|
||||||
|
|
||||||
{% include 'instance_header_panel.html' %}
|
{% include 'instance_header_panel.html' %}
|
||||||
{% if page not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options', 'options_review', 'hedge_plan') %}
|
{% if page not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options', 'options_review') %}
|
||||||
{% include 'instance_top_bar.html' %}
|
{% include 'instance_top_bar.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -365,8 +362,6 @@
|
|||||||
{% include 'options_panel.html' %}
|
{% include 'options_panel.html' %}
|
||||||
{% elif page == 'options_review' %}
|
{% elif page == 'options_review' %}
|
||||||
{% include 'options_review_panel.html' %}
|
{% include 'options_review_panel.html' %}
|
||||||
{% elif page == 'hedge_plan' %}
|
|
||||||
{% include 'hedge_plan_panel.html' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,15 @@ class RemoveHedgeSmokeTests(unittest.TestCase):
|
|||||||
src = inspect.getsource(m)
|
src = inspect.getsource(m)
|
||||||
self.assertNotIn("hedge_plan", src)
|
self.assertNotIn("hedge_plan", src)
|
||||||
|
|
||||||
|
def test_nav_display_meta_no_hedge(self):
|
||||||
|
from lib.instance.instance_display_prefs_lib import display_meta_for_ui, tab_allowed
|
||||||
|
from lib.instance.instance_embed_lib import EMBED_TABS
|
||||||
|
|
||||||
|
labels = [e["label"] for g in display_meta_for_ui() for e in g["entries"]]
|
||||||
|
self.assertNotIn("对冲计划", labels)
|
||||||
|
self.assertFalse(tab_allowed("hedge_plan"))
|
||||||
|
self.assertNotIn("hedge_plan", EMBED_TABS)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user