diff --git a/.cursor/rules/auto-push-deploy.mdc b/.cursor/rules/auto-push-deploy.mdc new file mode 100644 index 0000000..d000d0f --- /dev/null +++ b/.cursor/rules/auto-push-deploy.mdc @@ -0,0 +1,18 @@ +--- +description: After each completed code change, commit, push origin/main, and deploy to zk.hyf2.cc +alwaysApply: true +--- + +# Auto push & deploy + +When a user-facing code change is **finished** (not mid-debug / not "先不要改代码"): + +1. Commit only the relevant files (skip unrelated CRLF-only docs noise). +2. `git push origin main` to `https://git.bz121.com/dekun/crypto_monitor.git`. +3. Deploy to production `zk.hyf2.cc`:`cd /opt/crypto_monitor && git pull && bash deploy/pull_and_restart.sh`. +4. Confirm PM2 processes are online; briefly report commit hash + deploy status. + +Do **not** wait for the user to say "推送并部署" again unless they cancel this habit. + +SSH: Prefer key auth; if BatchMode fails, use existing Paramiko root login path used in this project. +Do not print or put passwords in user-facing replies. diff --git a/lib/common/static/hedge_plan.js b/lib/common/static/hedge_plan.js index 442da9f..db9700e 100644 --- a/lib/common/static/hedge_plan.js +++ b/lib/common/static/hedge_plan.js @@ -276,13 +276,11 @@ }); } - function pickContract(c, list) { + function pickContract(c) { if (!c) return; state.selected = c; const el = $("hp-sel-inst"); if (el) el.textContent = c.inst_id; - const sel = $("hp-strike-select"); - if (sel) sel.value = c.inst_id; const tbody = $("hp-strike-tbody"); if (tbody) { tbody.querySelectorAll(".opt-strike-row").forEach(function (r) { @@ -295,33 +293,6 @@ updatePremiumLine(); } - function strikeOptionLabel(c) { - return ( - "K" + - c.strike + - " " + - (c.moneyness_label || c.opt_type || "") + - " " + - fmtPxSz(c.ask, c.ask_sz, c.ask_estimated, c.tick_sz) - ); - } - - function fillStrikeSelect(list, prevInst) { - const sel = $("hp-strike-select"); - if (!sel) return; - const rest = (list || []).slice(5); - sel.innerHTML = '"; - rest.forEach(function (c) { - const opt = document.createElement("option"); - opt.value = c.inst_id; - opt.textContent = strikeOptionLabel(c); - sel.appendChild(opt); - }); - if (prevInst && rest.some(function (c) { return c.inst_id === prevInst; })) { - sel.value = prevInst; - } - } - function renderListStrikes() { const tbody = $("hp-strike-tbody"); if (!tbody) return; @@ -332,7 +303,6 @@ tbody.innerHTML = ""; if (!exp) { tbody.innerHTML = '请选择到期日'; - fillStrikeSelect([], null); return; } const list = (exp.contracts || []).filter(function (c) { @@ -340,12 +310,9 @@ }); if (!list.length) { tbody.innerHTML = '无匹配合约'; - fillStrikeSelect([], null); return; } - const visible = list.slice(0, 5); - fillStrikeSelect(list, prevInst); - visible.forEach(function (c) { + list.forEach(function (c) { const tr = document.createElement("tr"); tr.className = "opt-strike-row" + (c.moneyness ? " opt-row-" + c.moneyness : ""); if (prevInst && c.inst_id === prevInst) tr.classList.add("opt-row-selected"); @@ -366,21 +333,13 @@ '">选用'; tbody.appendChild(tr); }); - if (list.length > 5) { - const tip = document.createElement("tr"); - tip.innerHTML = - '仅显示前 5 行,其余 ' + - (list.length - 5) + - " 条请用上方下拉框选用"; - tbody.appendChild(tip); - } tbody.querySelectorAll(".hp-pick").forEach(function (btn) { btn.addEventListener("click", function () { const inst = btn.getAttribute("data-inst"); const c = list.find(function (x) { return x.inst_id === inst; }); - pickContract(c, list); + pickContract(c); }); }); } @@ -687,17 +646,6 @@ }); if ($("hp-exp-select")) $("hp-exp-select").addEventListener("change", renderListStrikes); if ($("hp-oo-exp-select")) $("hp-oo-exp-select").addEventListener("change", renderTStrikes); - if ($("hp-strike-select")) { - $("hp-strike-select").addEventListener("change", function () { - const inst = $("hp-strike-select").value; - if (!inst || !state.chain) return; - const exp = currentExp("hp-exp-select"); - const c = ((exp && exp.contracts) || []).find(function (x) { - return x.inst_id === inst; - }); - if (c) pickContract(c); - }); - } if ($("hp-sheets")) $("hp-sheets").addEventListener("input", updatePremiumLine); if ($("hp-preview-btn")) $("hp-preview-btn").addEventListener("click", function () { diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index 666356f..76acfb7 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -3296,8 +3296,7 @@ html[data-theme="light"] .opt-be-dist-down { margin: 4px 0; align-items: center; } -.hedge-plan-page-wrap .hp-opt-toolbar select, -.hedge-plan-page-wrap .hp-strike-pick-label select { +.hedge-plan-page-wrap .hp-opt-toolbar select { max-width: 168px; font-size: 0.72rem; padding: 3px 6px; @@ -3309,9 +3308,14 @@ html[data-theme="light"] .opt-be-dist-down { min-height: 26px; font-size: 0.72rem; } -.hedge-plan-page-wrap .hp-strike-table-wrap--5 { - max-height: 168px; /* 表头 + 约 5 行 */ +/* 视口约 5 行数据 + 表头;超出表内滚动 */ +.hedge-plan-page-wrap .hp-strike-table-wrap--5, +.hedge-plan-page-wrap .options-strike-table-wrap--t { + max-height: 220px; + min-height: 220px; + overflow-y: auto; margin-top: 4px; + flex: 1 1 auto; } .hedge-plan-page-wrap .hp-opt-bal-line { margin-top: 4px; @@ -3319,12 +3323,10 @@ html[data-theme="light"] .opt-be-dist-down { .hedge-plan-page-wrap .hp-acct-hint { display: none; } -.hedge-plan-page-wrap .options-strike-table-wrap--t { - max-height: 168px; -} .hedge-plan-page-wrap .options-dual-grid { grid-template-columns: 1fr 1fr; align-items: stretch; + margin-bottom: 20px; } .hedge-plan-page-wrap .options-dual-grid > .card { height: 100%; @@ -3332,6 +3334,10 @@ html[data-theme="light"] .opt-be-dist-down { display: flex; flex-direction: column; } +.hedge-plan-page-wrap .hp-preview-card { + margin-top: 8px; + clear: both; +} .hedge-plan-page-wrap .hp-pick.active, .hedge-plan-page-wrap .opt-row-selected td { background: rgba(90, 140, 255, 0.18); diff --git a/lib/hedge_plan/templates/hedge_plan_panel.html b/lib/hedge_plan/templates/hedge_plan_panel.html index ef86a62..3bab432 100644 --- a/lib/hedge_plan/templates/hedge_plan_panel.html +++ b/lib/hedge_plan/templates/hedge_plan_panel.html @@ -57,16 +57,6 @@
-
- - - - -
@@ -83,10 +73,15 @@
+
+ + + +
-
+

情景测算

@@ -155,7 +150,7 @@
-
+

情景测算

@@ -197,4 +192,4 @@
- + diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index 3cc52f0..cf9921b 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -7,7 +7,7 @@ - + {{ exchange_display }} · 加密货币 | 交易监控复盘系统 diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index 16a6bbe..53d512b 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -17,7 +17,7 @@ {{ exchange_display }} · 加密货币 | 交易监控复盘系统 - +