4df2cb4253
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
190 lines
8.6 KiB
HTML
190 lines
8.6 KiB
HTML
<div class="hedge-plan-page-wrap" style="grid-column:1/-1" id="hedge-plan-root"
|
|
data-default-underly="{{ options_default_underly | default('ETH') }}"
|
|
data-hedge-enabled="{{ '1' if hedge_plan_enabled else '0' }}"
|
|
data-options-enabled="{{ '1' if options_enabled else '0' }}"
|
|
data-sizing-mode="{{ position_sizing_mode | default('risk') }}"
|
|
data-is-full-margin="{{ '1' if position_sizing_mode == 'full_margin' else '0' }}">
|
|
{% if not hedge_plan_enabled %}
|
|
<div class="flash" style="margin-bottom:12px">对冲计划未启用:请在 <code>env配置 → 对冲计划</code> 打开 <code>HEDGE_PLAN_ENABLED</code>(可热更).</div>
|
|
{% endif %}
|
|
{% if not options_enabled %}
|
|
<div class="flash" style="margin-bottom:12px">期权模块未启用,无法拉期权链.请先配置期权账户.</div>
|
|
{% endif %}
|
|
|
|
<div class="card hp-head-card">
|
|
<div class="hp-head-row">
|
|
<h2 class="hp-title">对冲计划 <span class="muted hp-title-sub">P0 测算</span></h2>
|
|
<button type="button" class="btn-secondary" id="hp-refresh" title="刷新永续行情与期权链">刷新行情</button>
|
|
</div>
|
|
<div class="hp-tabs" role="tablist" aria-label="对冲计划分类">
|
|
<button type="button" class="hp-tab active" role="tab" aria-selected="true" data-tab="perp_options">永期对冲</button>
|
|
<button type="button" class="hp-tab" role="tab" aria-selected="false" data-tab="options_options">期期对冲</button>
|
|
<button type="button" class="hp-tab" role="tab" aria-selected="false" data-tab="history">历史记录</button>
|
|
<button type="button" class="hp-tab" role="tab" aria-selected="false" data-tab="stats">统计分析</button>
|
|
</div>
|
|
<p class="muted" id="hp-gate-line"></p>
|
|
</div>
|
|
|
|
<div id="hp-tab-perp_options" class="hp-tab-panel" role="tabpanel">
|
|
<div class="options-dual-grid" id="hp-po-layout">
|
|
<div class="card">
|
|
<h2>永续(列表行情)</h2>
|
|
<div class="form-row">
|
|
<button type="button" class="btn-secondary hp-uly-btn active" data-uly="ETH">ETH</button>
|
|
<button type="button" class="btn-secondary hp-uly-btn" data-uly="BTC">BTC</button>
|
|
<select id="hp-direction">
|
|
<option value="long">做多</option>
|
|
<option value="short">做空</option>
|
|
</select>
|
|
</div>
|
|
<div id="hp-perp-quote" class="muted" style="margin:8px 0;line-height:1.6">加载中…</div>
|
|
<div class="form-row" style="flex-wrap:wrap">
|
|
<label>开仓价 <input type="number" step="any" id="hp-entry" /></label>
|
|
<label>止盈 <input type="number" step="any" id="hp-tp" /></label>
|
|
<label>止损 <input type="number" step="any" id="hp-sl" /></label>
|
|
<label>张数 <input type="number" step="any" id="hp-contracts" /></label>
|
|
</div>
|
|
<p class="muted" id="hp-sizing-line"></p>
|
|
</div>
|
|
<div class="card">
|
|
<h2>期权(列表) · <span id="hp-opt-type-label">Put</span></h2>
|
|
<div class="form-row">
|
|
<select id="hp-exp-select"><option value="">选择到期日</option></select>
|
|
<button type="button" class="btn-secondary" id="hp-load-chain">刷新链</button>
|
|
</div>
|
|
<div id="hp-index-line" class="muted"></div>
|
|
<div class="options-strike-table-wrap">
|
|
<table class="options-strike-table" id="hp-strike-table">
|
|
<thead>
|
|
<tr>
|
|
<th>行权价</th>
|
|
<th>类型</th>
|
|
<th>卖一/张</th>
|
|
<th>买一</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="hp-strike-tbody">
|
|
<tr><td colspan="5" class="muted">请刷新期权链</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="form-row" style="margin-top:8px;flex-wrap:wrap">
|
|
<label>已选合约 <code id="hp-sel-inst">—</code></label>
|
|
<label>张数 <input type="number" step="1" min="1" id="hp-sheets" value="1" /></label>
|
|
<span class="muted" id="hp-premium-line"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card" style="margin-top:12px" id="hp-preview-card-po">
|
|
<div style="display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between">
|
|
<h2 style="margin:0">情景测算</h2>
|
|
<div class="form-row" style="margin:0">
|
|
<button type="button" class="primary" id="hp-preview-btn">计算</button>
|
|
<button type="button" class="btn-secondary" id="hp-start-btn" disabled title="P0 不开仓">启动计划(P0禁用)</button>
|
|
</div>
|
|
</div>
|
|
<div id="hp-summary" class="muted" style="margin:8px 0"></div>
|
|
<div class="options-strike-table-wrap">
|
|
<table class="options-strike-table" id="hp-result-table">
|
|
<thead>
|
|
<tr>
|
|
<th>情景</th>
|
|
<th>现货价</th>
|
|
<th>永续/腿盈亏</th>
|
|
<th>期权盈亏</th>
|
|
<th>合计≈U</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="hp-result-tbody">
|
|
<tr><td colspan="6" class="muted">填写参数后点计算</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="hp-tab-options_options" class="hp-tab-panel hidden" role="tabpanel" hidden>
|
|
<div class="options-dual-grid" id="hp-oo-layout">
|
|
<div class="card">
|
|
<h2>期期参数</h2>
|
|
<div class="form-row">
|
|
<button type="button" class="btn-secondary hp-uly-btn-oo active" data-uly="ETH">ETH</button>
|
|
<button type="button" class="btn-secondary hp-uly-btn-oo" data-uly="BTC">BTC</button>
|
|
<label>目标价 S* <input type="number" step="any" id="hp-target" /></label>
|
|
</div>
|
|
<div id="hp-oo-index" class="muted"></div>
|
|
<div id="hp-oo-legs" class="muted" style="margin-top:8px;line-height:1.6">尚未选用两腿</div>
|
|
</div>
|
|
<div class="card">
|
|
<h2>期权 T 型报价</h2>
|
|
<div class="form-row">
|
|
<select id="hp-oo-exp-select"><option value="">选择到期日</option></select>
|
|
<button type="button" class="btn-secondary" id="hp-oo-load-chain">刷新链</button>
|
|
</div>
|
|
<div class="options-strike-table-wrap options-strike-table-wrap--t">
|
|
<table class="options-strike-table options-strike-table--t" id="hp-oo-table">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="2" class="opt-t-head-call">Call</th>
|
|
<th class="opt-t-head-mid">行权</th>
|
|
<th colspan="2" class="opt-t-head-put">Put</th>
|
|
</tr>
|
|
<tr>
|
|
<th>卖一</th><th>选用</th>
|
|
<th>K</th>
|
|
<th>卖一</th><th>选用</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="hp-oo-tbody">
|
|
<tr><td colspan="5" class="muted">请刷新期权链</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card" style="margin-top:12px">
|
|
<div style="display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between">
|
|
<h2 style="margin:0">情景测算</h2>
|
|
<button type="button" class="primary" id="hp-preview-btn-oo">计算</button>
|
|
</div>
|
|
<div id="hp-summary-oo" class="muted" style="margin:8px 0"></div>
|
|
<div class="options-strike-table-wrap">
|
|
<table class="options-strike-table">
|
|
<thead>
|
|
<tr>
|
|
<th>情景</th>
|
|
<th>现货价</th>
|
|
<th>腿盈亏</th>
|
|
<th>期权</th>
|
|
<th>合计≈U</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="hp-result-tbody-oo">
|
|
<tr><td colspan="6" class="muted">选用两腿并填目标价后点计算</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="hp-tab-history" class="hp-tab-panel hidden" role="tabpanel" hidden>
|
|
<div class="card">
|
|
<h2>历史记录</h2>
|
|
<p class="muted">独立对冲计划历史(永期 / 期期)将在此展示合计盈亏、平仓原因与复盘短评.</p>
|
|
<p class="hp-placeholder">P1–P5 落地后可查;当前无计划记录.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="hp-tab-stats" class="hp-tab-panel hidden" role="tabpanel" hidden>
|
|
<div class="card">
|
|
<h2>统计分析</h2>
|
|
<p class="muted">止盈口径:止盈盈利 − 权利金;止损口径:期权盈利 − 永续亏损;期期到期无盈利记总亏损.</p>
|
|
<p class="hp-placeholder">统计看板随历史表上线后提供.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/static/hedge_plan.js?v=3"></script>
|